Documentation Index
Fetch the complete documentation index at: https://docs.ag-kit.dev/llms.txt
Use this file to discover all available pages before exploring further.
A single agent system involves one autonomous entity that perceives its environment and takes actions to achieve specific goals. It makes decisions independently, without coordination or interaction with other agents.
Installation
npm install @ag-kit/agents @ag-kit/tools zod
Quick Start
Create your first agent:
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);
Tools extend agent capabilities beyond text generation.
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.'
});
Next Steps