A modular SDK for building AI agents in Next.js and React. Structured output, tool calling, reasoning, planning, and more.
Import only what you need. Each module is independent and optimized for tree-shaking.
Generate type-safe structured data with Zod validation
const result = await createStructuredOutput({
model: 'openai/gpt-5',
schema: z.object({
sentiment: z.enum(['positive', 'negative']),
confidence: z.number(),
}),
prompt: 'Analyze this text...',
})Real-time streaming responses with React hooks
const stream = await createStreamingResponse({
model: 'openai/gpt-5',
messages,
onToken: (token) => console.log(token),
})Define and execute AI tools with middleware support
const toolkit = createToolkit({
tools: [searchTool, calculatorTool],
middleware: [loggingMiddleware],
})
const result = await toolkit.execute(toolCall)Manage conversation history with auto-summarization
const manager = new ConversationManager({
maxMessages: 50,
summarizeAfter: 20,
})
await manager.addMessage(id, { role: 'user', content })Chain-of-thought and tree-of-thought reasoning
const reasoner = createReasoningAgent({
model: 'openai/o1-mini',
reasoningStyle: 'chain-of-thought',
maxSteps: 10,
})
const { steps, conclusion } = await reasoner.reason({
problem: 'Analyze this fraud case...',
})Break complex goals into executable steps
const planner = createPlanningAgent({
model: 'openai/gpt-5',
tools: toolkit,
allowReplanning: true,
})
const plan = await planner.plan({
goal: 'Generate competitor analysis report',
})From cognitive reasoning to safety guardrails — every building block you need for production AI agents.
7 available
Coming soon
1 beta
Coming soon
1 beta
Coming soon
1 beta
Coming soon
Coming soon
Coming soon
Coming soon
Built on Vercel AI Gateway, agent-tools-kit supports all major AI providers with a unified API. Switch between OpenAI, Anthropic, Google, and more by changing a single line of code.
// Switch providers with one line
import { createStructuredOutput } from 'agent-tools-kit/structured'
// Use OpenAI
const result1 = await createStructuredOutput({
model: 'openai/gpt-5',
schema: mySchema,
prompt: 'Analyze...',
})
// Or switch to Anthropic
const result2 = await createStructuredOutput({
model: 'anthropic/claude-opus-4.6',
schema: mySchema,
prompt: 'Analyze...',
})Try the interactive playground or dive into the documentation to start building your AI agent.