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

# Outputs and retries

> Validate final output, retry model calls, and inspect completed Ruby runs.

Use output validation when downstream Ruby code requires a predictable result shape. Model retries cover transient request failures; retries for side-effecting tools should remain explicit and idempotent.

## Configure retries

```ruby theme={null}
agent = PhaseoAgentSdk.create_agent(
  id: "research-agent",
  model: "openai/gpt-5.4-nano",
  model_retry: PhaseoAgentSdk::ModelRetryConfig.new(
    max_retries: 3,
    base_delay_ms: 500,
    max_delay_ms: 4_000
  )
)
```

The result contains the run record, steps, messages, normalized usage, stop reason, and final output.

```ruby theme={null}
result = agent.run(input: prompt, client: client)

puts result.output
puts result.run.status
puts result.usage[:total_tokens]
puts result.usage[:cost]
```

Use [stop conditions](./agent-sdk-stop-conditions) to enforce budgets and [errors and troubleshooting](./agent-sdk-observability) to choose recoverable failure behavior.
