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

# 示例

> 参考 PHP 示例，了解工具、审批、流式传输和受限运行。

## 需审批的部署

```php theme={null}
$deploy = new Tool(
    id: "deploy",
    description: "Deploy the selected release",
    requireApproval: true,
    execute: fn (array $input, $runtime) => $deployments->deploy($input)
);
```

运行进入 `waiting_for_human` 后保存返回的运行状态，再使用与待处理调用 ID 关联的决策继续运行。

## 流式传输文本

```php theme={null}
$stream = $agent->stream(input: $prompt, client: $client);
foreach ($stream->textStream() as $delta) { echo $delta; }
$result = $stream->getResult();
```

## 限制自主运行

组合设置步骤、令牌、成本和时长限制，确保 Agent 即使不断找到有用任务，也不会超出应用预算。

完整约定请参阅[工具](./agent-sdk-tools.mdx)、[状态与审批](./agent-sdk-state-and-approval.mdx)和[停止条件](./agent-sdk-stop-conditions.mdx)。


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