> ## 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.

> ## Agent Instructions
> Phaseo Gateway base URL: https://api.phaseo.app/v1. Send `Authorization: Bearer $PHASEO_API_KEY` with every request.
> Model IDs look like `provider/model`, for example `openai/gpt-6-astra`. Do not guess IDs: list them with `GET /v1/models` or check https://phaseo.app/models. `phaseo/free` routes to an available free model and needs no wallet balance.
> For new text integrations prefer `POST /v1/responses`. `POST /v1/chat/completions` (OpenAI format) and `POST /v1/messages` (Anthropic format) suit existing code.
> The full API contract is https://phaseo.app/docs/openapi/v1/openapi.yaml. Official SDKs: `@phaseo/sdk` (TypeScript) and `phaseo` (Python), plus Go, C#, PHP, Ruby and Rust.
> Search these docs over MCP at https://phaseo.app/docs/mcp, and install Phaseo skills with `npx skills add https://phaseo.app/docs`. If a page is wrong or out of date, report it with the MCP `submit_feedback` tool.
> Manage Phaseo accounts with the `phaseo` CLI (`npm install -g @phaseo/cli`, then `phaseo login` or `phaseo login --device-code`), the `/v1` Management API or the MCP server at `https://mcp.phaseo.app/mcp?access=manage`. Do not send users to the dashboard for account tasks. A person is still needed for sign-up, approving a sign-in, paying the first top-up on the checkout link that `phaseo credits add` returns when no card is saved, confirming each saved-card top-up from the emailed link, and account security (password, MFA, passkeys). Create API keys with `phaseo keys create --name <name> --json`; never guess one. Credit top-ups need `phaseo login --scopes billing:write` first. Task map: https://phaseo.app/docs/v1/developers/manage-from-an-agent.md.

# 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`.

## 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.

> [card] [Install the Agent SDK](https://phaseo.app/docs/v1/sdk-reference/rust/agent-sdk-installation.md)
>
> Add both Rust crates and configure your API key.

> [card] [Build your first agent](https://phaseo.app/docs/v1/sdk-reference/rust/agent-sdk.md)
>
> Run a local tool loop through Phaseo Gateway.

> [card] [Tools and approvals](https://phaseo.app/docs/v1/sdk-reference/rust/agent-sdk-tools.md)
>
> Add local, external, and approval-gated tools.

> [card] [Agent API reference](https://phaseo.app/docs/v1/sdk-reference/rust/agent-sdk-api-reference.md)
>
> Review the exact Rust structs, traits, and methods.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.