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

Use output validation when downstream PHP code requires a predictable shape. Model retries cover transient request failures; keep retries for side-effecting tools inside the tool itself and make them idempotent.

## Configure retries

```php theme={null}
$agent = AgentSdk::createAgent(new AgentDefinition(
    id: "research-agent",
    model: "openai/gpt-5.4-nano",
    modelRetry: new ModelRetryConfig(
        maxRetries: 3,
        baseDelayMs: 500,
        maxDelayMs: 4000
    )
));
```

The run result contains its status, steps, messages, normalized usage, stop reason, and final output. Inspect these fields instead of treating the final text as the complete execution record.

```php theme={null}
$result = $agent->run(input: $prompt, client: $client);

echo $result->output;
echo $result->run->status;
echo $result->usage["total_tokens"];
echo $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.
