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

# 使い方

> Python Agent SDKで、ツールループ、人によるレビュー、再試行、再開可能なエージェントを実行します。

## 実行環境を準備する

独立パッケージはまだPyPIでは公開されていません。[ソースからのインストール手順](./agent-sdk-installation.mdx)に従ってください。

## クイックスタート

```python theme={null}
from phaseo_agent import create_agent, create_gateway_agent_client

agent = create_agent({
    "id": "quickstart-agent",
    "model": "openai/gpt-5.4-nano",
    "instructions": "Answer concisely and helpfully.",
})

result = agent.run(
    input="Give me one fun fact about cURL.",
    client=create_gateway_agent_client(),
)

print(result.output)
```

## 提供される機能

* `create_agent(...)`
* `define_tool(...)`
* `create_gateway_agent_client(...)`
* 再試行、並行ツール、タイムアウト、ライフサイクルイベント
* `continue_run(...)`による人のレビュー待ち
* シリアライズ可能な状態とPhaseo Devtoolsでの記録

## 高度な実行環境

Pythonでは、呼び出し可能オブジェクトによるスキーマと承認、HITLおよび手動ツール、進捗表示、回復可能なエラー、再生可能なストリーム、停止ヘルパー、動的ターン、永続化された次ターンの上書き、正規化された使用量とコスト、アプリケーション管理の状態アクセスをサポートします。

## ストリーミングとキャンセル

`agent.stream(...)`と`agent.continue_stream(...)`は、ゲートウェイのResponses SSEストリームを使用します。`text_stream()`、`reasoning_stream()`、`item_stream()`、`tool_stream()`、`full_stream()`を処理し、`cancel()`を呼び出してアクティブなリクエストを閉じます。完了したステップには、リクエストID、プロバイダーメタデータ、終了理由、警告、使用量、コストが保持されます。

## 関連ページ

* [Agent SDKの概要](../agent-sdk/overview.mdx)
* [TypeScript向けAgent SDK](../typescript/agent-sdk.mdx)


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