41 Vercel AI SDK tools for autonomous DeFi analysis on Monad
RampartAgent extends the Rampart class and exposes every SDK function as a structured Vercel AI SDK v6 tool. Pass agent.tools directly to generateText, streamText, or any AI SDK function - the agent handles schema validation and execution automatically.
RampartAgent wraps all Rampart functions using tool() from the Vercel AI SDK v6. Each tool uses inputSchema: (Zod) for input validation and an execute function that delegates to the underlying protocol function. This means any LLM with tool-calling support can query Monad DeFi data autonomously.
import { RampartAgent } from 'rampart-monad'import { generateText } from 'ai'import { anthropic } from '@ai-sdk/anthropic'const agent = new RampartAgent()const { text } = await generateText({ model: anthropic('claude-3-5-sonnet-20241022'), tools: agent.tools, system: 'You are a Monad DeFi analyst.', prompt: 'Find the best yield for USDC right now', maxSteps: 5,})console.log(text)
import { RampartAgent } from 'rampart-monad'import { generateText } from 'ai'import { anthropic } from '@ai-sdk/anthropic'const agent = new RampartAgent()// Multi-step: the model can call multiple tools in sequenceconst { text, steps } = await generateText({ model: anthropic('claude-3-5-sonnet-20241022'), tools: agent.tools, system: `You are a Monad DeFi analyst. Use the available tools to answer questions about yields, prices, liquidity, and portfolio positions. Always verify prices using the cross-oracle tool before making recommendations.`, prompt: 'Compare the best LST option versus the best Euler supply rate for MON.', maxSteps: 8,})console.log(`Model called ${steps.length} tools`)console.log(text)
import { RampartAgent } from 'rampart-monad'import { streamText } from 'ai'import { anthropic } from '@ai-sdk/anthropic'const agent = new RampartAgent()const result = streamText({ model: anthropic('claude-3-5-sonnet-20241022'), tools: agent.tools, system: 'You are a Monad DeFi analyst.', prompt: 'What is the current total TVL on Monad and where is most of it?', maxSteps: 5,})for await (const chunk of result.textStream) { process.stdout.write(chunk)}