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

# Examples

> Copy focused Go patterns for tools, approvals, streaming, and bounded runs.

## Approval-gated deployment

```go theme={null}
deploy := phaseoagent.Tool{
  ID: "deploy",
  Description: "Deploy the selected release",
  RequireApproval: true,
  Execute: func(input any, runtime phaseoagent.RuntimeContext) (any, error) {
    return deploymentService.Deploy(runtime.Context, input)
  },
}
```

Run the agent and persist the returned record when its status is `waiting_for_human`. Continue it with a decision keyed by the pending tool-call ID.

## Stream into a terminal

```go theme={null}
stream := agent.Stream(ctx, phaseoagent.RunOptions{Input: prompt, Client: client})
for delta := range stream.Text() { fmt.Print(delta) }
result, err := stream.Result()
```

## Bound autonomous research

Combine `StepCountIs`, `MaxTokensUsed`, `MaxCost`, and `MaxDuration` so a long-running agent cannot exceed the product budget even when it keeps finding useful work.

See [tools](./agent-sdk-tools), [state and approval](./agent-sdk-state-and-approval), and [stop conditions](./agent-sdk-stop-conditions) for complete contracts.
