Skip to main content
Tool Config controls how tools run — their timeout, retry behavior, output limits, and whether large results get stored as artifacts.
The user asks the agent to use tools; ToolConfig controls timeouts, retries, parallel execution, and artifact storage for those calls.

Quick Start

1

Simple Usage

Use ToolConfig() defaults to get retry protection and safe output limits:
2

With Custom Settings

Configure timeout, retries, and parallel execution:
3

With Artifact Storage


How It Works


Configuration Options

ToolConfig SDK Reference

Full parameter reference for ToolConfig
Precedence ladder:
Legacy keyword arguments for tools now raise TypeError. Always use ToolConfig for tool configuration. See the migration guide if upgrading from an older version.

Common Patterns

Pattern 1 — Timeout for slow external APIs

Parallel tool execution:
Tail-only output for log tools:

Best Practices

Any tool that calls an external API or runs a subprocess should have a timeout. Without one, a hung tool call blocks your agent indefinitely. Start with 30–60 seconds and adjust based on your tool’s expected latency.
Use parallel=True when your agent commonly calls multiple tools at once and those tools don’t depend on each other’s outputs. This can cut wall-clock time significantly.
If your tools return large datasets (SQL queries, file reads, API responses), set enable_artifacts=True. This prevents large outputs from filling the LLM context window, which wastes tokens and can cause errors.
Leave redact_secrets=True (the default) to prevent API keys, passwords, and tokens from being stored in artifact files or shown in tool outputs.

Artifact Storage

How artifacts are stored and retrieved

Async Tool Safety

Safe concurrent tool execution

Toolsets

Group and manage tools as sets

Tool Retry Policy

Configure retry behavior for failing tools