Drop-in tool objects for the Vercel AI SDK. Works with streamText, generateText, and generateObject across any supported provider.
npm install agent402-ai-sdk
import { agent402Tools } from "agent402-ai-sdk";
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
const { tools, execute } = await agent402Tools();
const { text, toolCalls } = await generateText({
model: openai("gpt-4o"),
prompt: "Hash 'hello world' with SHA-256",
tools,
});
// Tool calls are executed automatically by the AI SDK,
// or handle them manually:
for (const call of toolCalls) {
const result = await execute(call.toolName, call.args);
console.log(result);
}
| Option | Type | Description |
|---|---|---|
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: ["pdf"] })
// Load only specific tools by slug.
agent402Tools({ slugs: ["pdf-to-markdown", "extract"] })
// 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 })