Skip to content
Merged
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
8 changes: 4 additions & 4 deletions docs/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Supplying a list of tools doesn't always mean the LLM will use a tool. You can f
When you are using OpenAI Responses tool search, named tool choices are more limited: you cannot target bare namespace names or deferred-only tools with `tool_choice`, and `tool_choice="tool_search"` does not target [`ToolSearchTool`][agents.tool.ToolSearchTool]. In those cases, prefer `auto` or `required`. See [Hosted tool search](tools.md#hosted-tool-search) for the Responses-specific constraints.

```python
from agents import Agent, Runner, function_tool, ModelSettings
from agents import Agent, function_tool, ModelSettings

@function_tool
def get_weather(city: str) -> str:
Expand All @@ -351,7 +351,7 @@ The `tool_use_behavior` parameter in the `Agent` configuration controls how tool
- `"stop_on_first_tool"`: The output of the first tool call is used as the final response, without further LLM processing.

```python
from agents import Agent, Runner, function_tool, ModelSettings
from agents import Agent, function_tool

@function_tool
def get_weather(city: str) -> str:
Expand All @@ -369,7 +369,7 @@ agent = Agent(
- `StopAtTools(stop_at_tool_names=[...])`: Stops if any specified tool is called, using its output as the final response.

```python
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool
from agents.agent import StopAtTools

@function_tool
Expand All @@ -393,7 +393,7 @@ agent = Agent(
- `ToolsToFinalOutputFunction`: A custom function that processes tool results and decides whether to stop or continue with the LLM.

```python
from agents import Agent, Runner, function_tool, FunctionToolResult, RunContextWrapper
from agents import Agent, function_tool, FunctionToolResult, RunContextWrapper
from agents.agent import ToolsToFinalOutputResult
from typing import List, Any

Expand Down
2 changes: 1 addition & 1 deletion docs/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ For this, you can use the [`ToolContext`][agents.tool_context.ToolContext] class
```python
from typing import Annotated
from pydantic import BaseModel, Field
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool
from agents.tool_context import ToolContext

class WeatherContext(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion docs/human_in_the_loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This page focuses on the manual approval flow via `interruptions`. If your app c
Set `needs_approval` to `True` to always require approval or provide an async function that decides per call. The callable receives the run context, parsed tool parameters, and the tool call ID.

```python
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool


@function_tool(needs_approval=True)
Expand Down
10 changes: 5 additions & 5 deletions docs/ja/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SDK は、OpenAI モデルに対してデフォルトで Responses API を使用
| `reset_tool_choice` | いいえ | ツール使用のループを回避するため、ツール呼び出し後に `tool_choice` をリセットします(デフォルト: `True`)。[ツール使用の強制](#forcing-tool-use)を参照してください。 |

```python
from agents import Agent, ModelSettings, function_tool
from agents import Agent, function_tool
Comment thread
seratch marked this conversation as resolved.

@function_tool
def get_weather(city: str) -> str:
Expand Down Expand Up @@ -332,7 +332,7 @@ robot_agent = pirate_agent.clone(
OpenAI Responses のツール検索を使用する場合、名前付きツール選択肢にはより多くの制限があります。`tool_choice` では、単独の名前空間名や遅延専用ツールを指定できず、`tool_choice="tool_search"` で [`ToolSearchTool`][agents.tool.ToolSearchTool] を指定することもできません。このような場合は、`auto` または `required` を使用してください。Responses 固有の制約については、[ホステッドツール検索](tools.md#hosted-tool-search)を参照してください。

```python
from agents import Agent, Runner, function_tool, ModelSettings
from agents import Agent, function_tool, ModelSettings

@function_tool
def get_weather(city: str) -> str:
Expand All @@ -355,7 +355,7 @@ agent = Agent(
- `"stop_on_first_tool"`: 最初のツール呼び出しの出力を、LLM による追加処理を行わずに最終応答として使用します。

```python
from agents import Agent, Runner, function_tool, ModelSettings
from agents import Agent, function_tool

@function_tool
def get_weather(city: str) -> str:
Expand All @@ -373,7 +373,7 @@ agent = Agent(
- `StopAtTools(stop_at_tool_names=[...])`: 指定したツールのいずれかが呼び出された場合、その出力を最終応答として使用して停止します。

```python
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool
from agents.agent import StopAtTools

@function_tool
Expand All @@ -397,7 +397,7 @@ agent = Agent(
- `ToolsToFinalOutputFunction`: ツールの実行結果を処理し、停止するか LLM で処理を続行するかを決定するカスタム関数です。

```python
from agents import Agent, Runner, function_tool, FunctionToolResult, RunContextWrapper
from agents import Agent, function_tool, FunctionToolResult, RunContextWrapper
from agents.agent import ToolsToFinalOutputResult
from typing import List, Any

Expand Down
2 changes: 1 addition & 1 deletion docs/ja/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ if __name__ == "__main__":
```python
from typing import Annotated
from pydantic import BaseModel, Field
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool
from agents.tool_context import ToolContext

class WeatherContext(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/human_in_the_loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ search:
常に承認を要求するには `needs_approval` を `True` に設定するか、呼び出しごとに判定する async 関数を指定します。この呼び出し可能オブジェクトは、実行コンテキスト、解析済みのツールパラメーター、ツール呼び出し ID を受け取ります。

```python
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool


@function_tool(needs_approval=True)
Expand Down
7 changes: 6 additions & 1 deletion docs/ja/models/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,10 @@ agent= Agent(name="Helping Agent", instructions="You are a Helping Agent", model
SDK は [`OpenAIResponsesModel`][agents.models.openai_responses.OpenAIResponsesModel] と [`OpenAIChatCompletionsModel`][agents.models.openai_chatcompletions.OpenAIChatCompletionsModel] の両方の形式をサポートしていますが、2 つの形式ではサポートされる機能とツールが異なるため、各ワークフローで単一のモデル形式を使用することを推奨します。ワークフローでモデル形式を組み合わせる必要がある場合は、使用するすべての機能が両方で利用できることを確認してください。

```python
from agents import Agent, Runner, AsyncOpenAI, OpenAIChatCompletionsModel
import asyncio

from agents import Agent, Runner, AsyncOpenAI, OpenAIChatCompletionsModel

spanish_agent = Agent(
name="Spanish agent",
instructions="You only speak Spanish.",
Expand All @@ -381,6 +382,10 @@ triage_agent = Agent(
async def main():
result = await Runner.run(triage_agent, input="Hola, ¿cómo estás?")
print(result.final_output)


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

1. OpenAI モデルの名前を直接設定します。
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/sessions/advanced_sqlite_session.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ session = AdvancedSQLiteSession(
# With persistent storage
session = AdvancedSQLiteSession(
session_id="user_123",
db_path="path/to/conversations.db",
db_path="conversations.db",
create_tables=True
)

Expand Down
9 changes: 7 additions & 2 deletions docs/ja/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def score_b(score: Annotated[int, Field(..., ge=0, le=100, description="Score fr

```python
import asyncio
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool


@function_tool(timeout=2.0)
Expand Down Expand Up @@ -549,9 +549,10 @@ def get_user_profile(user_id: str) -> str:
ワークフローによっては、制御をハンドオフする代わりに、中央のエージェントで特化型エージェントのネットワークをオーケストレーションしたい場合があります。これは、エージェントをツールとしてモデル化することで実現できます。

```python
from agents import Agent, Runner
import asyncio

from agents import Agent, Runner

spanish_agent = Agent(
name="Spanish agent",
instructions="You translate the user's message to Spanish",
Expand Down Expand Up @@ -583,6 +584,10 @@ orchestrator_agent = Agent(
async def main():
result = await Runner.run(orchestrator_agent, input="Say 'Hello, how are you?' in Spanish.")
print(result.final_output)


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

### ツールエージェントのカスタマイズ
Expand Down
2 changes: 0 additions & 2 deletions docs/ja/voice/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ graph LR
まず、いくつかのエージェントをセットアップします。この SDK でエージェントを構築した経験があれば、馴染みのある作業でしょう。ここでは、2 つのエージェント、1 つのハンドオフ、1 つのツールを用意します。

```python
import asyncio
import random

from agents import (
Expand Down Expand Up @@ -136,7 +135,6 @@ import sounddevice as sd
from agents import (
Agent,
function_tool,
set_tracing_disabled,
)
from agents.voice import (
AudioInput,
Expand Down
10 changes: 5 additions & 5 deletions docs/ko/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SDK는 OpenAI 모델에 기본적으로 Responses API를 사용하지만, 여기
| `reset_tool_choice` | 아니요 | 도구 사용 루프를 방지하기 위해 도구 호출 후 `tool_choice`를 재설정합니다(기본값: `True`). [도구 사용 강제](#forcing-tool-use)를 참조하세요. |

```python
from agents import Agent, ModelSettings, function_tool
from agents import Agent, function_tool

@function_tool
def get_weather(city: str) -> str:
Expand Down Expand Up @@ -332,7 +332,7 @@ robot_agent = pirate_agent.clone(
OpenAI Responses 도구 검색을 사용할 때는 이름이 지정된 도구 선택에 더 많은 제한이 있습니다. `tool_choice`로 단독 네임스페이스 이름이나 지연 전용 도구를 지정할 수 없으며, `tool_choice="tool_search"`는 [`ToolSearchTool`][agents.tool.ToolSearchTool]을 대상으로 하지 않습니다. 이러한 경우에는 `auto` 또는 `required`를 사용하는 것이 좋습니다. Responses 전용 제약 조건은 [호스티드 툴 검색](tools.md#hosted-tool-search)을 참조하세요.

```python
from agents import Agent, Runner, function_tool, ModelSettings
from agents import Agent, function_tool, ModelSettings

@function_tool
def get_weather(city: str) -> str:
Expand All @@ -355,7 +355,7 @@ agent = Agent(
- `"stop_on_first_tool"`: 추가적인 LLM 처리 없이 첫 번째 도구 호출의 출력을 최종 응답으로 사용합니다.

```python
from agents import Agent, Runner, function_tool, ModelSettings
from agents import Agent, function_tool

@function_tool
def get_weather(city: str) -> str:
Expand All @@ -373,7 +373,7 @@ agent = Agent(
- `StopAtTools(stop_at_tool_names=[...])`: 지정된 도구 중 하나가 호출되면 해당 출력을 최종 응답으로 사용하고 중지합니다.

```python
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool
from agents.agent import StopAtTools

@function_tool
Expand All @@ -397,7 +397,7 @@ agent = Agent(
- `ToolsToFinalOutputFunction`: 도구 결과를 처리하고 LLM을 중지할지 계속 실행할지 결정하는 사용자 지정 함수입니다.

```python
from agents import Agent, Runner, function_tool, FunctionToolResult, RunContextWrapper
from agents import Agent, function_tool, FunctionToolResult, RunContextWrapper
from agents.agent import ToolsToFinalOutputResult
from typing import List, Any

Expand Down
2 changes: 1 addition & 1 deletion docs/ko/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ if __name__ == "__main__":
```python
from typing import Annotated
from pydantic import BaseModel, Field
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool
from agents.tool_context import ToolContext

class WeatherContext(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion docs/ko/human_in_the_loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ search:
항상 승인을 요구하려면 `needs_approval`을 `True`로 설정하거나, 호출마다 결정하는 비동기 함수를 제공합니다. 호출 가능한 함수는 실행 컨텍스트, 파싱된 도구 매개변수, 도구 호출 ID를 받습니다.

```python
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool


@function_tool(needs_approval=True)
Expand Down
7 changes: 6 additions & 1 deletion docs/ko/models/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,10 @@ agent= Agent(name="Helping Agent", instructions="You are a Helping Agent", model
SDK는 [`OpenAIResponsesModel`][agents.models.openai_responses.OpenAIResponsesModel]과 [`OpenAIChatCompletionsModel`][agents.models.openai_chatcompletions.OpenAIChatCompletionsModel] 형식을 모두 지원하지만, 두 형식이 서로 다른 기능과 도구 집합을 지원하므로 각 워크플로에서는 하나의 모델 형식만 사용하는 것이 좋습니다. 워크플로에서 모델 형식을 혼합해야 한다면 사용하는 모든 기능을 양쪽 모두에서 사용할 수 있는지 확인하세요.

```python
from agents import Agent, Runner, AsyncOpenAI, OpenAIChatCompletionsModel
import asyncio

from agents import Agent, Runner, AsyncOpenAI, OpenAIChatCompletionsModel

spanish_agent = Agent(
name="Spanish agent",
instructions="You only speak Spanish.",
Expand All @@ -381,6 +382,10 @@ triage_agent = Agent(
async def main():
result = await Runner.run(triage_agent, input="Hola, ¿cómo estás?")
print(result.final_output)


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

1. OpenAI 모델의 이름을 직접 설정합니다.
Expand Down
2 changes: 1 addition & 1 deletion docs/ko/sessions/advanced_sqlite_session.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ session = AdvancedSQLiteSession(
# With persistent storage
session = AdvancedSQLiteSession(
session_id="user_123",
db_path="path/to/conversations.db",
db_path="conversations.db",
create_tables=True
)

Expand Down
9 changes: 7 additions & 2 deletions docs/ko/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def score_b(score: Annotated[int, Field(..., ge=0, le=100, description="Score fr

```python
import asyncio
from agents import Agent, Runner, function_tool
from agents import Agent, function_tool


@function_tool(timeout=2.0)
Expand Down Expand Up @@ -549,9 +549,10 @@ def get_user_profile(user_id: str) -> str:
일부 워크플로에서는 제어를 핸드오프하는 대신 중앙 에이전트가 전문 에이전트 네트워크를 오케스트레이션하도록 할 수 있습니다. 에이전트를 도구로 모델링하여 이를 구현할 수 있습니다.

```python
from agents import Agent, Runner
import asyncio

from agents import Agent, Runner

spanish_agent = Agent(
name="Spanish agent",
instructions="You translate the user's message to Spanish",
Expand Down Expand Up @@ -583,6 +584,10 @@ orchestrator_agent = Agent(
async def main():
result = await Runner.run(orchestrator_agent, input="Say 'Hello, how are you?' in Spanish.")
print(result.final_output)


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

### 도구 에이전트 사용자 지정
Expand Down
2 changes: 0 additions & 2 deletions docs/ko/voice/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ graph LR
먼저 몇 가지 에이전트를 설정하겠습니다. 이 SDK로 에이전트를 만들어 본 적이 있다면 익숙할 것입니다. 몇 개의 에이전트와 하나의 핸드오프, 하나의 도구를 사용합니다.

```python
import asyncio
import random

from agents import (
Expand Down Expand Up @@ -136,7 +135,6 @@ import sounddevice as sd
from agents import (
Agent,
function_tool,
set_tracing_disabled,
)
from agents.voice import (
AudioInput,
Expand Down
7 changes: 6 additions & 1 deletion docs/models/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,10 @@ Within a single workflow, you may want to use different models for each agent. F
While our SDK supports both the [`OpenAIResponsesModel`][agents.models.openai_responses.OpenAIResponsesModel] and the [`OpenAIChatCompletionsModel`][agents.models.openai_chatcompletions.OpenAIChatCompletionsModel] shapes, we recommend using a single model shape for each workflow because the two shapes support a different set of features and tools. If your workflow requires mixing and matching model shapes, make sure that all the features you're using are available on both.

```python
from agents import Agent, Runner, AsyncOpenAI, OpenAIChatCompletionsModel
import asyncio

from agents import Agent, Runner, AsyncOpenAI, OpenAIChatCompletionsModel

spanish_agent = Agent(
name="Spanish agent",
instructions="You only speak Spanish.",
Expand All @@ -377,6 +378,10 @@ triage_agent = Agent(
async def main():
result = await Runner.run(triage_agent, input="Hola, ¿cómo estás?")
print(result.final_output)


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

1. Sets the name of an OpenAI model directly.
Expand Down
2 changes: 1 addition & 1 deletion docs/sessions/advanced_sqlite_session.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ session = AdvancedSQLiteSession(
# With persistent storage
session = AdvancedSQLiteSession(
session_id="user_123",
db_path="path/to/conversations.db",
db_path="conversations.db",
create_tables=True
)

Expand Down
Loading