> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Rust Agent SDK

> Build synchronous, tool-using agents with phaseo-agent.

Use the published [`phaseo-agent`](https://crates.io/crates/phaseo-agent) crate when a Rust application needs a bounded model loop, local tools, approvals, or resumable human review.

The Rust Agent SDK builds on the `phaseo` client and runs model turns through the Phaseo Responses API.

## Supported capabilities

| Capability                       | Rust support                                                                          |
| -------------------------------- | ------------------------------------------------------------------------------------- |
| Local executable tools           | Yes, executed synchronously in model-call order                                       |
| External tool outputs            | Yes, through `Tool::external(...)` and `ContinueOptions`                              |
| Tool approval                    | Yes, by exact tool-call ID                                                            |
| Human review                     | Yes, with serializable paused run state                                               |
| Model retries                    | Yes, with fixed backoff                                                               |
| Lifecycle events                 | Yes, through callback-based run methods                                               |
| Usage aggregation                | Input, output, cached, and total tokens; cost when populated by a custom model client |
| Run limits                       | Maximum model steps                                                                   |
| Gateway adapter                  | Responses API through `GatewayAgentClient`                                            |
| Streaming                        | Not yet supported                                                                     |
| Async execution and cancellation | Not yet supported                                                                     |
| Concurrent local tools           | Not yet supported                                                                     |
| Runtime schema validation        | JSON Schema is sent to the model; local inputs and outputs are `serde_json::Value`    |
| Devtools capture                 | Not yet supported                                                                     |

<Note>
  Rust is a supported synchronous runtime, not a feature-for-feature port of the TypeScript streaming runtime. The pages in this section document only APIs shipped in `phaseo-agent 0.1`.
</Note>

## Runtime model

Each run:

1. sends the current messages and tool definitions to a `ModelClient`
2. executes available local tools
3. pauses for approvals, external outputs, or human review when required
4. appends results and continues until completion or the step limit

The SDK does not store runs in a Phaseo-hosted service. Persist `RunResult` in your application when a run must survive a process restart.

The `0.1` Gateway adapter does not currently map Gateway `cost_nanos` or `cost_cents` into `UsageSummary.cost`. Use the Gateway response or generation record for spend reporting rather than the Agent SDK cost field.

<Columns cols={2}>
  <Card title="Install the Agent SDK" icon="package" href="./agent-sdk-installation">
    Add both Rust crates and configure your API key.
  </Card>

  <Card title="Build your first agent" icon="play" href="./agent-sdk">
    Run a local tool loop through Phaseo Gateway.
  </Card>

  <Card title="Tools and approvals" icon="wrench" href="./agent-sdk-tools">
    Add local, external, and approval-gated tools.
  </Card>

  <Card title="Agent API reference" icon="book-open" href="./agent-sdk-api-reference">
    Review the exact Rust structs, traits, and methods.
  </Card>
</Columns>
