@@ -4,104 +4,139 @@ search:
44---
55# コード例
66
7- [ repo] ( https://github.com/openai/openai-agents-python/tree/main/examples ) の examples セクションで、 SDK のさまざまなサンプル実装を確認できます。examples は 、異なるパターンと機能を示す複数のカテゴリーに整理されています。
7+ [ repo] ( https://github.com/openai/openai-agents-python/tree/main/examples ) の examples セクションで、 SDK のさまざまなサンプル実装を確認できます。これらのコード例は 、異なるパターンと機能を示す複数のカテゴリーに整理されています。
88
99## カテゴリー
1010
1111- ** [ agent_patterns] ( https://github.com/openai/openai-agents-python/tree/main/examples/agent_patterns ) :**
12- このカテゴリーのコード例では、一般的なエージェント設計パターンを示しています。例:
12+ このカテゴリーのコード例では、次のような一般的なエージェント設計パターンを示します。
1313
1414 - 決定論的ワークフロー
1515 - Agents as tools
16- - エージェントの並列実行
16+ - ストリーミングイベントを伴う Agents as tools (` examples/agent_patterns/agents_as_tools_streaming.py ` )
17+ - 構造化入力パラメーターを伴う Agents as tools (` examples/agent_patterns/agents_as_tools_structured.py ` )
18+ - 並列エージェント実行
1719 - 条件付きツール使用
18- - 入力/出力ガードレール
19- - 審判としての LLM
20+ - 異なる挙動でツール使用を強制する (` examples/agent_patterns/forcing_tool_use.py ` )
21+ - 入力 / 出力ガードレール
22+ - 審査者としての LLM
2023 - ルーティング
2124 - ストリーミングガードレール
25+ - ツール承認と状態シリアライズを伴う Human-in-the-loop (` examples/agent_patterns/human_in_the_loop.py ` )
26+ - ストリーミングを伴う Human-in-the-loop (` examples/agent_patterns/human_in_the_loop_stream.py ` )
2227 - 承認フロー向けのカスタム拒否メッセージ (` examples/agent_patterns/human_in_the_loop_custom_rejection.py ` )
2328
2429- ** [ basic] ( https://github.com/openai/openai-agents-python/tree/main/examples/basic ) :**
25- これらのコード例では、 SDK の基礎的な機能を紹介しています。例:
30+ これらのコード例では、次のような SDK の基本機能を紹介します。
2631
27- - Hello world のコード例 (デフォルトモデル、 GPT-5 、 open-weight モデル)
32+ - Hello world のコード例 (デフォルトモデル、 GPT-5、 open-weight モデル)
2833 - エージェントライフサイクル管理
34+ - Run hooks と agent hooks のライフサイクル例 (` examples/basic/lifecycle_example.py ` )
2935 - 動的システムプロンプト
36+ - 基本的なツール使用 (` examples/basic/tools.py ` )
37+ - ツール入力 / 出力ガードレール (` examples/basic/tool_guardrails.py ` )
38+ - 画像ツール出力 (` examples/basic/image_tool_output.py ` )
3039 - ストリーミング出力 (テキスト、項目、関数呼び出し引数)
31- - ターン間で共有セッションヘルパーを使う Responses websocket トランスポート (` examples/basic/stream_ws.py ` )
40+ - 複数ターンで共有セッションヘルパーを使用する Responses websocket transport (` examples/basic/stream_ws.py ` )
3241 - プロンプトテンプレート
33- - ファイル処理 (ローカル/リモート、画像/ PDF)
34- - 使用状況トラッキング
35- - Runner 管理のリトライ設定 (` examples/basic/retry.py ` )
36- - サードパーティアダプターを介した Runner 管理のリトライ (` examples/basic/retry_litellm.py ` )
42+ - ファイル処理 (ローカルとリモート、画像と PDF)
43+ - 使用状況追跡
44+ - Runner 管理の再試行設定 (` examples/basic/retry.py ` )
45+ - サードパーティアダプター経由の Runner 管理再試行 (` examples/basic/retry_litellm.py ` )
3746 - 非 strict な出力型
38- - 前回レスポンス ID の使用
47+ - 以前の response ID の使用
3948
4049- ** [ customer_service] ( https://github.com/openai/openai-agents-python/tree/main/examples/customer_service ) :**
4150 航空会社向けのカスタマーサービスシステムのコード例です。
4251
4352- ** [ financial_research_agent] ( https://github.com/openai/openai-agents-python/tree/main/examples/financial_research_agent ) :**
44- 金融データ分析のためのエージェントとツールを使った構造化リサーチワークフローを示す、金融リサーチエージェントです 。
53+ 金融データ分析のためのエージェントとツールを用いた、構造化された調査ワークフローを示す金融リサーチエージェントです 。
4554
4655- ** [ handoffs] ( https://github.com/openai/openai-agents-python/tree/main/examples/handoffs ) :**
47- メッセージフィルタリングを伴うエージェントハンドオフの実践的なコード例をご覧ください。
56+ メッセージフィルタリングを含む、エージェントのハンドオフの実践的なコード例です。
57+
58+ - メッセージフィルター例 (` examples/handoffs/message_filter.py ` )
59+ - ストリーミングを伴うメッセージフィルター (` examples/handoffs/message_filter_streaming.py ` )
4860
4961- ** [ hosted_mcp] ( https://github.com/openai/openai-agents-python/tree/main/examples/hosted_mcp ) :**
50- hosted MCP (Model Context Protocol) コネクターと承認の使い方を示すコード例です。
62+ OpenAI Responses API で hosted MCP (Model Context Protocol) を使用する方法を示すコード例です。以下を含みます。
63+
64+ - 承認なしのシンプルな hosted MCP (` examples/hosted_mcp/simple.py ` )
65+ - Google Calendar などの MCP コネクター (` examples/hosted_mcp/connectors.py ` )
66+ - 割り込みベース承認を伴う Human-in-the-loop (` examples/hosted_mcp/human_in_the_loop.py ` )
67+ - MCP ツール呼び出しの on-approval コールバック (` examples/hosted_mcp/on_approval.py ` )
5168
5269- ** [ mcp] ( https://github.com/openai/openai-agents-python/tree/main/examples/mcp ) :**
53- MCP (Model Context Protocol) を使ってエージェントを構築する方法を学べます。内容:
70+ 以下を含め、 MCP (Model Context Protocol) でエージェントを構築する方法を学べます。
5471
55- - ファイルシステムのコード例
72+ - Filesystem のコード例
5673 - Git のコード例
57- - MCP プロンプトサーバーのコード例
74+ - MCP prompt server のコード例
5875 - SSE (Server-Sent Events) のコード例
59- - ストリーミング可能な HTTP のコード例
76+ - SSE リモートサーバー接続 (` examples/mcp/sse_remote_example ` )
77+ - Streamable HTTP のコード例
78+ - Streamable HTTP リモート接続 (` examples/mcp/streamable_http_remote_example ` )
79+ - Streamable HTTP 向けカスタム HTTP client factory (` examples/mcp/streamablehttp_custom_client_example ` )
80+ - ` MCPUtil.get_all_function_tools ` による全 MCP ツールの事前取得 (` examples/mcp/get_all_mcp_tools_example ` )
81+ - FastAPI を使用した MCPServerManager (` examples/mcp/manager_example ` )
82+ - MCP ツールフィルタリング (` examples/mcp/tool_filter_example ` )
6083
6184- ** [ memory] ( https://github.com/openai/openai-agents-python/tree/main/examples/memory ) :**
62- エージェント向けのさまざまなメモリ実装のコード例です。内容:
85+ エージェント向けのさまざまなメモリ実装のコード例です。以下を含みます。
6386
6487 - SQLite セッションストレージ
6588 - 高度な SQLite セッションストレージ
6689 - Redis セッションストレージ
6790 - SQLAlchemy セッションストレージ
68- - Dapr ステートストアセッションストレージ
91+ - Dapr state store セッションストレージ
6992 - 暗号化セッションストレージ
7093 - OpenAI Conversations セッションストレージ
7194 - Responses compaction セッションストレージ
72- - ` ModelSettings(store=False) ` を使ったステートレスな Responses compaction (` examples/memory/compaction_session_stateless_example.py ` )
95+ - ` ModelSettings(store=False) ` を使用したステートレスな Responses compaction (` examples/memory/compaction_session_stateless_example.py ` )
96+ - ファイルベースのセッションストレージ (` examples/memory/file_session.py ` )
97+ - Human-in-the-loop を伴うファイルベースセッション (` examples/memory/file_hitl_example.py ` )
98+ - Human-in-the-loop を伴う SQLite インメモリセッション (` examples/memory/memory_session_hitl_example.py ` )
99+ - Human-in-the-loop を伴う OpenAI Conversations セッション (` examples/memory/openai_session_hitl_example.py ` )
100+ - セッションをまたぐ HITL 承認 / 拒否シナリオ (` examples/memory/hitl_session_scenario.py ` )
73101
74102- ** [ model_providers] ( https://github.com/openai/openai-agents-python/tree/main/examples/model_providers ) :**
75- カスタムプロバイダーやサードパーティアダプターを含め、 SDK で非 OpenAI モデルを使う方法を確認できます 。
103+ カスタムプロバイダーやサードパーティアダプターを含め、 SDK で非 OpenAI モデルを使用する方法を確認できます 。
76104
77105- ** [ realtime] ( https://github.com/openai/openai-agents-python/tree/main/examples/realtime ) :**
78- SDK を使ってリアルタイム体験を構築する方法を示すコード例です。内容:
106+ SDK を使用してリアルタイム体験を構築する方法を示すコード例です。以下を含みます。
79107
80- - 構造化テキストおよび画像メッセージを使った Web アプリケーションパターン
108+ - 構造化されたテキストおよび画像メッセージによる Web アプリケーションパターン
81109 - コマンドライン音声ループと再生処理
82110 - WebSocket 経由の Twilio Media Streams 統合
83111 - Realtime Calls API attach フローを使用した Twilio SIP 統合
84112
85113- ** [ reasoning_content] ( https://github.com/openai/openai-agents-python/tree/main/examples/reasoning_content ) :**
86- reasoning content と structured outputs の扱い方を示すコード例です。
114+ reasoning content の扱い方を示すコード例です。以下を含みます。
115+
116+ - Runner API、ストリーミング、非ストリーミングでの reasoning content (` examples/reasoning_content/runner_example.py ` )
117+ - OpenRouter 経由で OSS モデルを使用した reasoning content (` examples/reasoning_content/gpt_oss_stream.py ` )
118+ - 基本的な reasoning content のコード例 (` examples/reasoning_content/main.py ` )
87119
88120- ** [ research_bot] ( https://github.com/openai/openai-agents-python/tree/main/examples/research_bot ) :**
89- 複雑なマルチエージェントのディープリサーチワークフローを示す 、シンプルなディープリサーチクローンです。
121+ 複雑なマルチエージェント調査ワークフローを示す 、シンプルなディープリサーチクローンです。
90122
91123- ** [ tools] ( https://github.com/openai/openai-agents-python/tree/main/examples/tools ) :**
92- OpenAI がホストするツールと、次のような実験的な Codex ツール機能の実装方法を学べます。
124+ 以下のような OpenAI がホストするツールと実験的な Codex ツール機能の実装方法を学べます。
93125
94126 - Web 検索 とフィルター付き Web 検索
95127 - ファイル検索
96- - Code Interpreter
97- - インラインスキル付き hosted container shell (` examples/tools/container_shell_inline_skill.py ` )
98- - スキル参照付き hosted container shell (` examples/tools/container_shell_skill_reference.py ` )
99- - ローカルスキル付きローカル shell (` examples/tools/local_shell_skill.py ` )
100- - 名前空間と遅延ツールを使ったツール検索 (` examples/tools/tool_search.py ` )
128+ - Code interpreter
129+ - ファイル編集と承認を伴う apply patch ツール (` examples/tools/apply_patch.py ` )
130+ - 承認コールバックを伴う shell ツール実行 (` examples/tools/shell.py ` )
131+ - Human-in-the-loop 割り込みベース承認を伴う shell ツール (` examples/tools/shell_human_in_the_loop.py ` )
132+ - インラインスキルを伴う hosted container shell (` examples/tools/container_shell_inline_skill.py ` )
133+ - スキル参照を伴う hosted container shell (` examples/tools/container_shell_skill_reference.py ` )
134+ - ローカルスキルを伴う local shell (` examples/tools/local_shell_skill.py ` )
135+ - 名前空間と遅延ツールを伴うツール検索 (` examples/tools/tool_search.py ` )
101136 - コンピュータ操作
102137 - 画像生成
103138 - 実験的な Codex ツールワークフロー (` examples/tools/codex.py ` )
104139 - 実験的な Codex 同一スレッドワークフロー (` examples/tools/codex_same_thread.py ` )
105140
106141- ** [ voice] ( https://github.com/openai/openai-agents-python/tree/main/examples/voice ) :**
107- ストリーミング音声のコード例を含む、 TTS / STT モデルを使用した音声エージェントのコード例をご覧ください 。
142+ ストリーミング音声のコード例を含む、 TTS および STT モデルを使用した音声エージェントのコード例を確認できます 。
0 commit comments