Skip to main content
Use this guide to build a small tool-using agent and inspect its completed run.

Define a tool

The closure runs locally. Its RuntimeContext includes the run ID, agent ID, step index, application context, and original tool call.

Create the agent

Run through Phaseo Gateway

Complete example

Run state

RunResult contains:
  • run: status, IDs, effective model, step limit, context, and pause state
  • steps: each model turn, request ID, provider, model, finish reason, tool calls, and usage
  • messages: the complete model and tool message history
  • output: the final output value
  • usage: aggregate token values and any cost supplied by the model client

Current execution model

Rust Agent SDK runs are synchronous. Local tools execute one at a time. Use an application worker thread or task boundary when a run should not block a request handler.

Next

Last modified on July 26, 2026