Tool Calling
Tool calling (also known as function calling) allows AI models to interact with external systems, access real-time data, and perform actions. Models can decide when to use tools and how to call them based on the conversation context.Defining Tools
Create tools that models can use:Using Tools
Pass tools to the model and let it decide when to use them:Tool Choice Strategies
Control when and how the model uses tools:Structured Tool Output
Define complex return types for tools:Tool Interrupts (Human-in-the-Loop)
Pause execution for human approval before taking sensitive actions:Handling Interrupts
Handle tool interrupts and resume execution:Modifying Tool Input on Resume
Adjust tool parameters when resuming after an interrupt:Multi-Step Tool Workflows
Models can use multiple tools in sequence to accomplish complex tasks:Best Practices
Write Clear Tool Descriptions
Help the model understand when and how to use tools:Go
Use Structured Input and Output
Define clear schemas for tool parameters:Go
Handle Errors Gracefully
Return meaningful error messages:Go
Use Tool Interrupts for Sensitive Actions
Always require human approval for:- Financial transactions
- Data deletion
- Sending emails or messages
- Making purchases
- Modifying important settings
Complete Example
Here’s a complete payment agent with tool interrupts:Next Steps
- Learn about RAG for knowledge retrieval
- Explore Chat Interfaces for conversational AI
- Check out Evaluation for testing tool usage