HomeDocsAdapters › LlamaIndex

LlamaIndex Adapter

agent402-llamaindex

FunctionTool instances for LlamaIndex agents. Works with OpenAIAgent, ReActAgent, and custom query engines.

Install

npm install agent402-llamaindex

Quick start

import { agent402Tools } from "agent402-llamaindex";
import { OpenAIAgent } from "llamaindex";

const { tools } = await agent402Tools();

const agent = new OpenAIAgent({ tools });

const response = await agent.chat({
  message: "Hash 'hello world' with SHA-256",
});
console.log(response.toString());

Configuration

OptionTypeDescription
categories string[] Filter tools by category.
slugs string[] Load only specific tools by slug.
baseUrl string Point to a self-hosted Agent402 instance.
agentKey string Private key for wallet-only (paid) tools.
// Filter tools by category.
agent402Tools({ categories: ["finance"] })

// Load only specific tools by slug.
agent402Tools({ slugs: ["stock-quote", "stock-history"] })

// Point to a self-hosted Agent402 instance.
agent402Tools({ baseUrl: "https://my-agent402.example.com" })

// Private key for wallet-only (paid) tools.
agent402Tools({ agentKey: process.env.AGENT_KEY })

Works with

LlamaIndex TS OpenAIAgent ReActAgent FunctionTool Any LlamaIndex query engine