Understanding Tools
Give your agents the ability to interact with the outside world through automatic schema generation, parameter validation, and concurrent execution.
Basic Usage
Add tools to agents as functions or Tool
objects:
Tool Configuration
Use Tool
for custom descriptions and parameter control:
When a tool has many parameters, use schema_params_mode="required"
to reduce tokens and avoid overwhelming the LLM with unnecessary options:
You can also include or exclude specific parameters to fine-tune what the LLM sees:
Set default values that are automatically applied when the tool is called:
You can also use functions or environment variables as default parameters:
Agent as a Tool
You can use an Agent as a tool within another Agent, enabling hierarchical agent compositions where specialized agents handle specific tasks.
Since Agent
instances can be treated as Tool
objects, they inherit the same parameter control configurations available to regular tools.
Summary
- Automatic Introspection: Function signatures become tool schemas automatically
- Enhanced Validation: Pydantic-based parameter validation
- Execution Flexibility: Support for all Python callable types
- Better Configuration: Fine-grained parameter control
- Performance: Concurrent execution and optimized patterns
- Robustness: Improved error handling and tracing
For more advanced patterns, see the Integrations and explore the built-in tools in the Timbal library!