Skip to main content

Overview

Custom tools extend agent capabilities beyond the built-in tools. Any async Rust function can become a tool that the LLM can call.

The Tool Trait

All tools implement the Tool trait:

Complete Example

Registration

ToolResult Types

Using AgentInternals

The internals parameter provides access to agent context:

Tools with State

Tools That Spawn Subagents

See Subagents for how to create tools that delegate work to specialized agents.

Testing Custom Tools

Next Steps

Built-in Tools

Reference for existing tools

Subagents

Spawning subagents from tools