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