Skip to main content

Local tools

Use Tool::new(...) when the Rust process can execute the operation:
The parameters value is sent to the model as JSON Schema. Tool input and output are serde_json::Value; validate untrusted arguments inside the executor when stronger runtime guarantees are required.

Approval-gated tools

Add require_approval() to pause before execution:
When the model calls this tool, the run returns with run.status == "waiting_for_human" and run.pause.kind == "tool_approval". Resume by exact call ID:
The Rust 0.1 API does not expose a separate rejection type. Leave an unapproved call paused or apply your application’s rejection policy before resuming.

External tools

Use Tool::external(...) when another process performs the operation:
The pause kind is external_output when every pending call needs an external result. Supply each result by call ID:
If one model turn mixes automatic and pending tools, the runtime executes the automatic tools before it returns the pause.

Tool errors

An AgentError returned by a local executor becomes a structured tool error message and is sent back to the model. An unknown tool name or a missing approval/output fails continuation with AgentError.
Last modified on July 26, 2026