Demonstrates how to create and use custom tools with AI Kit agents.
- Custom tool creation
- Agent orchestration
- Multi-step reasoning
- Tool execution tracking
-
Install dependencies:
npm install
-
Set environment variables:
export ANTHROPIC_API_KEY=your-key-here -
Run the example:
npm run start
Tools are defined with a schema that describes:
- Name and description (for the LLM to understand)
- Parameters (JSON Schema format)
- Execute function (implementation)
The agent:
- Receives user input
- Determines if tools are needed
- Calls appropriate tools
- Synthesizes results into an answer
Each agent run produces steps showing:
- Agent reasoning ("thoughts")
- Tool calls made
- Tool results
- Final answer
This example includes two tools:
- Weather Tool - Returns weather data for a location
- Calculator Tool - Performs mathematical calculations
Try adding your own tools:
- Database queries
- API calls
- File operations
- Web scraping
- Data processing