Vercel AI SDK integration for Monad Agent Kit
npm install @monad-agent-kit/ai-vercelVercel AI SDK integration for Monad Agent Kit — converts all registered agent actions into Vercel AI tools.
``bash`
bun add @monad-agent-kit/core @monad-agent-kit/ai-vercel ai
`typescript
import { MonadAgentKit } from "@monad-agent-kit/core"
import { tokenPlugin } from "@monad-agent-kit/plugin-token"
import { defiPlugin } from "@monad-agent-kit/plugin-defi"
import { createVercelAITools } from "@monad-agent-kit/ai-vercel"
import { generateText } from "ai"
import { createOpenRouter } from "@openrouter/ai-sdk-provider"
// 1. Set up the agent with plugins
const agent = new MonadAgentKit({ privateKey: process.env.PRIVATE_KEY })
await agent.use(tokenPlugin)
await agent.use(defiPlugin)
// 2. Convert all actions to Vercel AI tools
const tools = createVercelAITools(agent)
// 3. Use with any Vercel AI-compatible model
const openrouter = createOpenRouter({ apiKey: process.env.OPENROUTER_API_KEY })
const result = await generateText({
model: openrouter("anthropic/claude-sonnet-4"),
tools,
maxSteps: 10,
prompt: "Check my MON balance, then swap 0.1 MON for USDC",
})
console.log(result.text)
`
createVercelAITools() takes a MonadAgentKit instance and converts every registered action into a Vercel AI SDK tool:
- Action name becomes the tool namedescription
- Action becomes the tool descriptionparameters
- Action (JSON Schema) are converted to Zod schemasagent.execute()
- Tool execution calls and returns the result
Any plugins registered before calling createVercelAITools() will have their actions included.
Works with any model provider supported by Vercel AI SDK:
- OpenRouter (Claude, GPT-4, Llama, etc.)
- OpenAI
- Anthropic
- Google Gemini
- And more
- ai` >= 6.0.0 (Vercel AI SDK)
MIT