What are Tools?
Tools are functions that agents can call to:- Query databases
- Make API requests
- Read/write files
- Perform calculations
- Access external services
Creating Tools
Basic Tool
Tool with Context
Access agent context inside tools:Dynamic Tools
Create tools at runtime:Using Tools with Agents
- Analyzes the user message
- Decides which tool to call
- Calls the tool with appropriate parameters
- Formats the result into a natural language response
Tool Schemas
Parameter Descriptions
Help the agent understand parameters:Complex Types
Use nested schemas for structured data:Tool Selection
Control when agents use tools:Auto (Default)
Required
None
Specific Tool
Error Handling
Try-Catch in Tools
Validation in Tools
Pre-built Tools
DeepAgents provides ready-to-use tools in@deepagents/toolbox:
Available Tools
ddgSearch
DuckDuckGo web search
hackernewsSearch
HackerNews article search
weather
Weather information
filesystem
File read/write operations
webSearch
General web search
scratchpad
Temporary note storage
Tool Composition
Wrapping Tools
Add logging or metrics:Combining Tools
Create composite tools:Best Practices
Clear Descriptions
Write detailed tool and parameter descriptions
Validation
Validate inputs before executing
Error Messages
Return helpful error messages, not exceptions
Idempotency
Make tools safe to retry
Timeouts
Set reasonable execution timeouts
Rate Limiting
Implement rate limiting for external APIs
Next Steps
Handoffs
Learn about agent delegation
Context
Manage state between tools
Toolbox Package
Explore pre-built tools