Installation
Quick Start
Create your first agent:Adding Tools
Tools extend agent capabilities beyond text generation.Next Steps
- Multi-Agent Systems - Build collaborative systems
- Tools - Advanced tool development
- Memory & State - State management
Build simple, single-step Agents
npm install @ag-kit/agents @ag-kit/tools zod
import { Agent, OpenAIProvider } from '@ag-kit/agents';
const agent = new Agent({
name: 'my-assistant',
description: 'A helpful AI assistant',
model: new OpenAIProvider({
apiKey: process.env.OPENAI_API_KEY!,
defaultModel: 'gpt-4o-mini'
}),
instructions: 'You are a helpful assistant.'
});
const result = await agent.run('Hello!');
console.log(result.output);
import { tool } from '@ag-kit/tools';
import { z } from 'zod';
const weatherTool = tool(
async (input: unknown) => {
const { location } = input as { location: string };
return { location, temperature: 72, condition: 'sunny' };
},
{
name: 'get_weather',
description: 'Get weather for a location',
schema: z.object({
location: z.string().describe('City name')
})
}
);
const agent = new Agent({
tools: [weatherTool],
instructions: 'Use get_weather tool when asked about weather.'
});
Was this page helpful?