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

# 使用例

> ツール、承認、ストリーミング、上限付き実行のRubyパターンを活用できます。

## 承認付きデプロイ

```ruby theme={null}
deploy = PhaseoAgentSdk.define_tool(
  id: "deploy",
  description: "Deploy the selected release",
  require_approval: true,
  execute: ->(input, runtime) { deployments.deploy(input) }
)
```

実行が`waiting_for_human`に入ったら返された実行状態を保存し、保留中の呼び出しIDに紐づく判断を指定して再開します。

## テキストをストリーミングする

```ruby theme={null}
stream = agent.stream(input: prompt, client: client)
stream.text_stream.each { |delta| print delta }
result = stream.result
```

## 自律処理に上限を設ける

ステップ数、トークン数、コスト、実行時間に上限を組み合わせると、有用な作業が続いてもエージェントがアプリの予算を超えません。

契約の詳細は、[ツール](./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.