Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 77 additions & 66 deletions docs/ja/agents.md

Large diffs are not rendered by default.

86 changes: 43 additions & 43 deletions docs/ja/config.md

Large diffs are not rendered by default.

98 changes: 55 additions & 43 deletions docs/ja/context.md

Large diffs are not rendered by default.

95 changes: 54 additions & 41 deletions docs/ja/guardrails.md

Large diffs are not rendered by default.

75 changes: 40 additions & 35 deletions docs/ja/handoffs.md

Large diffs are not rendered by default.

126 changes: 70 additions & 56 deletions docs/ja/human_in_the_loop.md

Large diffs are not rendered by default.

155 changes: 85 additions & 70 deletions docs/ja/mcp.md

Large diffs are not rendered by default.

383 changes: 218 additions & 165 deletions docs/ja/models/index.md

Large diffs are not rendered by default.

62 changes: 32 additions & 30 deletions docs/ja/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ search:

## プロジェクトと仮想環境の作成 {#create-a-project-and-virtual-environment}

これは一度だけ行えば十分です。
この作業は一度だけ行います。

```bash
mkdir my_project
Expand All @@ -16,7 +16,7 @@ python -m venv .venv

### 仮想環境の有効化 {#activate-the-virtual-environment}

新しいターミナルセッションを開始するたびに行ってください。
新しいターミナルセッションを開始するたびに、この作業を行います。

macOS または Linux の場合:

Expand All @@ -38,7 +38,7 @@ pip install openai-agents # or `uv add openai-agents`, etc

### OpenAI API キーの設定 {#set-an-openai-api-key}

まだ持っていない場合は、[こちらの手順](https://platform.openai.com/docs/quickstart#create-and-export-an-api-key)に従って OpenAI API キーを作成してください。
キーをお持ちでない場合は、[こちらの手順](https://platform.openai.com/docs/quickstart#create-and-export-an-api-key)に従って OpenAI API キーを作成してください。

以下のコマンドは、現在のターミナルセッションにキーを設定します。

Expand All @@ -62,7 +62,7 @@ set "OPENAI_API_KEY=sk-..."

## 最初のエージェントの作成 {#create-your-first-agent}

エージェントは、instructions、名前、および特定のモデルなどの任意の設定で定義します。
エージェントは、instructions、名前、および特定のモデルなどのオプション設定で定義します。

```python
from agents import Agent
Expand All @@ -86,31 +86,33 @@ agent = Agent(
instructions="You answer history questions clearly and concisely.",
)


async def main():
result = await Runner.run(agent, "When did the Roman Empire fall?")
print(result.final_output)


if __name__ == "__main__":
asyncio.run(main())
```

2 回目のターンでは、`result.to_input_list()` を `Runner.run(...)` に戻して渡すか、[セッション](sessions/index.md)をアタッチするか、`conversation_id` / `previous_response_id` で OpenAI によりサーバー側で管理される状態を再利用できます。[エージェントの実行](running_agents.md)ガイドでは、これらのアプローチを比較しています。
2 回目のターンでは、`result.to_input_list()` を `Runner.run(...)` に再度渡すか、[セッション](sessions/index.md)を関連付けるか、`conversation_id` / `previous_response_id` を使用して OpenAI のサーバー管理状態を再利用できます。[エージェントの実行](running_agents.md)ガイドでは、これらのアプローチを比較しています。

次の目安を使ってください:
次の目安を参考にしてください:

| 実現したいこと... | まず使うもの... |
| 目的 | 最初に使用するもの |
| --- | --- |
| 完全な手動制御とプロバイダー非依存の履歴 | `result.to_input_list()` |
| SDK に履歴の読み込みと保存を任せる | [`session=...`](sessions/index.md) |
| OpenAI 管理のサーバー側継続 | `previous_response_id` または `conversation_id` |
| 完全な手動制御とプロバイダーに依存しない履歴 | `result.to_input_list()` |
| SDK による履歴の読み込みと保存 | [`session=...`](sessions/index.md) |
| OpenAI が管理するサーバー側での継続 | `previous_response_id` または `conversation_id` |

トレードオフと正確な挙動については、[エージェントの実行](running_agents.md#choose-a-memory-strategy)を参照してください。
トレードオフと正確な動作については、[エージェントの実行](running_agents.md#choose-a-memory-strategy)を参照してください。

タスクが主にプロンプト、ツール、会話状態で完結する場合は、シンプルな `Agent` と `Runner` を使います。エージェントが分離されたワークスペース内の実ファイルを検査または変更する必要がある場合は、[Sandbox エージェントのクイックスタート](sandbox_agents.md)に進んでください。
タスクの中心がプロンプト、ツール、会話状態である場合は、通常の `Agent` と `Runner` を使用します。エージェントが隔離されたワークスペース内の実ファイルを調査または変更する必要がある場合は、[サンドボックスエージェントのクイックスタート](sandbox_agents.md)に進んでください。

## エージェントへのツールの付与 {#give-your-agent-tools}
## エージェントへのツールの追加 {#give-your-agent-tools}

エージェントにツールを与えることで、情報を調べたりアクションを実行したりできます。
エージェントにツールを追加し、情報の検索やアクションの実行を可能にできます。

```python
import asyncio
Expand Down Expand Up @@ -143,16 +145,16 @@ if __name__ == "__main__":
asyncio.run(main())
```

## さらにいくつかのエージェントの追加 {#add-a-few-more-agents}
## エージェントの追加 {#add-a-few-more-agents}

マルチエージェントパターンを選ぶ前に、最終回答の主導権を誰が持つべきかを決めてください。
マルチエージェントパターンを選択する前に、最終的な回答を誰が担当するかを決めます:

- **ハンドオフ**: スペシャリストが、そのターンの該当部分について会話を引き継ぎます。
- **ハンドオフ**: そのターンの該当部分について、スペシャリストが会話を引き継ぎます。
- **Agents as tools**: オーケストレーターが制御を維持し、スペシャリストをツールとして呼び出します。

このクイックスタートでは、最初の例として最も短いため、 **ハンドオフ** で続けます。マネージャースタイルのパターンについては、[エージェントオーケストレーション](multi_agent.md)と[ツール: agents as tools](tools.md#agents-as-tools)を参照してください。
このクイックスタートでは、最初の例として最も簡潔なため、引き続き **ハンドオフ** を使用します。マネージャー形式のパターンについては、[エージェントオーケストレーション](multi_agent.md)および[ツール: Agents as tools](tools.md#agents-as-tools)を参照してください。

追加のエージェントも同じ方法で定義できます。`handoff_description` は、いつ委譲すべきかについて、ルーティングエージェントに追加のコンテキストを提供します。
追加のエージェントも同じ方法で定義できます。`handoff_description` は、どのタイミングで処理を委任するかについて、ルーティングエージェントに追加のコンテキストを提供します。

```python
from agents import Agent
Expand All @@ -172,7 +174,7 @@ math_tutor_agent = Agent(

## ハンドオフの定義 {#define-your-handoffs}

エージェントには、タスクを解決する際に選択できるハンドオフ先の選択肢の一覧を定義できます。
エージェントには、タスクの解決中に選択できる送信先ハンドオフの選択肢一覧を定義できます。

```python
triage_agent = Agent(
Expand All @@ -184,7 +186,7 @@ triage_agent = Agent(

## エージェントオーケストレーションの実行 {#run-the-agent-orchestration}

ランナーは、個々のエージェントの実行、すべてのハンドオフ、すべてのツール呼び出しを処理します。
Runner は、個々のエージェント、すべてのハンドオフ、およびすべてのツール呼び出しの実行を処理します。

```python
import asyncio
Expand All @@ -204,23 +206,23 @@ if __name__ == "__main__":
asyncio.run(main())
```

## 参考コード例 {#reference-examples}
## 参照コード例 {#reference-examples}

このリポジトリには、同じ主要パターンに対応する完全なスクリプトが含まれています:
リポジトリには、同じ主要パターンを示す完全なスクリプトが含まれています:

- [`examples/basic/hello_world.py`](https://github.com/openai/openai-agents-python/tree/main/examples/basic/hello_world.py) は最初の実行の例です。
- [`examples/basic/tools.py`](https://github.com/openai/openai-agents-python/tree/main/examples/basic/tools.py) は関数ツールの例です。
- [`examples/agent_patterns/routing.py`](https://github.com/openai/openai-agents-python/tree/main/examples/agent_patterns/routing.py) はマルチエージェントルーティングの例です。
- 最初の実行については、[`examples/basic/hello_world.py`](https://github.com/openai/openai-agents-python/tree/main/examples/basic/hello_world.py)を参照してください。
- 関数ツールについては、[`examples/basic/tools.py`](https://github.com/openai/openai-agents-python/tree/main/examples/basic/tools.py)を参照してください。
- マルチエージェントルーティングについては、[`examples/agent_patterns/routing.py`](https://github.com/openai/openai-agents-python/tree/main/examples/agent_patterns/routing.py)を参照してください。

## トレースの表示 {#view-your-traces}

エージェントの実行中に何が起きたかを確認するには、[OpenAI ダッシュボードのトレースビューアー](https://platform.openai.com/traces)に移動して、エージェント実行のトレースを表示してください。
エージェントの実行中に何が起きたかを確認するには、[OpenAI Dashboard の Trace viewer](https://platform.openai.com/traces)に移動して、エージェント実行のトレースを表示します。

## 次のステップ {#next-steps}

より複雑なエージェント型フローの構築方法を学びましょう:
より複雑なエージェントフローを構築する方法を学びます:

- [エージェント](agents.md)の設定方法について学びます。
- [エージェント](agents.md)の設定方法を学びます。
- [エージェントの実行](running_agents.md)と[セッション](sessions/index.md)について学びます。
- 作業を実際のワークスペース内で行う必要がある場合は、[Sandbox エージェント](sandbox_agents.md)について学びます。
- 実際のワークスペース内で作業を行う必要がある場合は、[サンドボックスエージェント](sandbox_agents.md)について学びます。
- [ツール](tools.md)、[ガードレール](guardrails.md)、[モデル](models/index.md)について学びます。
Loading
Loading