Quick Start
Which Tools to Use?
How It Works
| Phase | What happens |
|---|---|
| 1. Discover | Agent receives tool definitions alongside the user request |
| 2. Decide | LLM chooses whether to call a tool |
| 3. Execute | Agent runs the tool and captures the result |
| 4. Synthesize | LLM uses the tool result to form the final answer |
Common Patterns
Pattern 1 — Web research agent
Pattern 2 — Custom API tool
Pattern 3 — Tool search for large toolsets
Best Practices
Write clear docstrings for custom tools
Write clear docstrings for custom tools
The LLM reads your tool’s docstring to decide when and how to use it. Write clear, specific descriptions: “Fetch the current stock price for a given ticker symbol (e.g., ‘AAPL’, ‘GOOGL’). Returns price in USD.”
Return strings from tools
Return strings from tools
Tools should return strings (or JSON-serializable data that gets converted to strings). Complex objects confuse the LLM — format results as readable text.
Use tool_search for large toolsets
Use tool_search for large toolsets
When you have more than 10–15 tools, enable
tool_search=True to let the agent dynamically find the right tools instead of sending all tool definitions with every request.Set timeouts for external tools
Set timeouts for external tools
Wrap external API calls with timeouts using
ToolConfig(timeout=30). Without timeouts, a slow API can block the entire agent run.Related
Tool Config — timeouts, retries, and artifact storage
Tool Search — dynamic tool discovery for large toolsets

