Expand description
Tool trait and utilities for defining agent tools.
Tools are the primary way agents interact with the world. Each tool represents a specific capability that an agent can invoke.
§OpenAI API Alignment
This module aligns with OpenAI’s Function Calling API:
ToolDefinitionserializes to{"type": "function", "function": {...}}format- Supports
strictmode for Structured Outputs - Compatible with both Chat Completions and Responses APIs
Structs§
- Always
Deny Handler - Confirmation handler that always denies execution.
- Auto
Approve Handler - Default confirmation handler that auto-approves all requests.
- Tool
Call Result - Result of a tool call execution.
- Tool
Confirmation Request - Request for human confirmation before tool execution.
- Tool
Definition - Definition of a tool for LLM function calling.
Enums§
- Tool
Confirmation Response - Response to a tool confirmation request.
- Tool
Error - Error type for tool execution failures.
- Tool
Execution Policy - Execution policy for a tool.
Traits§
- Confirmation
Handler - Handler for tool execution confirmation requests.
- DynTool
- Object-safe version of the Tool trait for dynamic dispatch.
- Tool
- The core trait for all tools that agents can use.
Type Aliases§
- Boxed
Confirmation Handler - A boxed confirmation handler for dynamic dispatch.
- Boxed
Tool - A boxed dynamic tool that can be used in collections.
- Shared
Confirmation Handler - A shared confirmation handler for use across cloneable contexts.
- Tool
Result - A type alias for
Result<T, ToolError>.