You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Configuring the SDK
1
+
# Configuration
2
2
3
3
This page covers SDK-wide defaults that you usually set once during application startup, such as the default OpenAI key or client, the default OpenAI API shape, tracing export defaults, and logging behavior.
Copy file name to clipboardExpand all lines: docs/quickstart.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,16 @@ if __name__ == "__main__":
68
68
69
69
For a second turn, you can either pass `result.to_input_list()` back into `Runner.run(...)`, attach a [session](sessions/index.md), or reuse OpenAI server-managed state with `conversation_id` / `previous_response_id`. The [running agents](running_agents.md) guide compares these approaches.
70
70
71
+
Use this rule of thumb:
72
+
73
+
| If you want... | Start with... |
74
+
| --- | --- |
75
+
| Full manual control and provider-agnostic history |`result.to_input_list()`|
76
+
| The SDK to load and save history for you |[`session=...`](sessions/index.md)|
77
+
| OpenAI-managed server-side continuation |`previous_response_id` or `conversation_id`|
78
+
79
+
For the tradeoffs and exact behaviors, see [Running agents](running_agents.md#choose-a-memory-strategy).
80
+
71
81
## Give your agent tools
72
82
73
83
You can give an agent tools to look up information or perform actions.
@@ -104,6 +114,13 @@ if __name__ == "__main__":
104
114
105
115
## Add a few more agents
106
116
117
+
Before you choose a multi-agent pattern, decide who should own the final answer:
118
+
119
+
-**Handoffs**: a specialist takes over the conversation for that part of the turn.
120
+
-**Agents as tools**: an orchestrator stays in control and calls specialists as tools.
121
+
122
+
This quickstart continues with **handoffs** because it is the shortest first example. For the manager-style pattern, see [Agent orchestration](multi_agent.md) and [Tools: agents as tools](tools.md#agents-as-tools).
123
+
107
124
Additional agents can be defined in the same way. `handoff_description` gives the routing agent extra context about when to delegate.
Copy file name to clipboardExpand all lines: docs/results.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ Most applications only need a few result properties or helpers:
18
18
|`new_items`| Rich run items with agent, tool, and handoff metadata for logs, UIs, or audits. |
19
19
|`last_agent`| The agent that should usually handle the next turn. |
20
20
|`last_response_id`| Continuation with `previous_response_id` on the next OpenAI Responses turn. |
21
+
|`agent_tool_invocation`| Metadata about the outer tool call when this result came from `Agent.as_tool()`. |
21
22
|`interruptions`| Pending tool approvals you must resolve before resuming. |
22
23
|`to_state()`| A serializable snapshot for pause/resume or durable job workflows. |
23
24
@@ -63,6 +64,16 @@ The [`new_items`][agents.result.RunResultBase.new_items] property contains the n
63
64
64
65
Call [`result.to_state()`][agents.result.RunResult.to_state] when you need a serializable snapshot of the run. This is the bridge between a finished or paused run and a later resume, especially for approval flows or durable worker systems.
65
66
67
+
## Agent-as-tool metadata
68
+
69
+
When a result comes from a nested [`Agent.as_tool()`][agents.agent.Agent.as_tool] run, [`agent_tool_invocation`][agents.result.RunResultBase.agent_tool_invocation] exposes immutable metadata about the outer tool call:
70
+
71
+
-`tool_name`
72
+
-`tool_call_id`
73
+
-`tool_arguments`
74
+
75
+
For ordinary top-level runs, `agent_tool_invocation` is `None`.
76
+
66
77
## Other information
67
78
68
79
### Guardrail results
@@ -110,4 +121,5 @@ approval workflows, see the [human-in-the-loop guide](human_in_the_loop.md).
110
121
111
122
-[`final_output_as(...)`][agents.result.RunResultBase.final_output_as] casts final output to a specific type (optionally with runtime type checking).
112
123
-[`last_response_id`][agents.result.RunResultBase.last_response_id] returns the latest model response ID. Pass this back as `previous_response_id` when you want to continue an OpenAI Responses API chain on the next turn.
124
+
-[`agent_tool_invocation`][agents.result.RunResultBase.agent_tool_invocation] returns metadata about the outer tool call when the result comes from `Agent.as_tool()`.
113
125
-[`release_agents(...)`][agents.result.RunResultBase.release_agents] drops strong references to agents when you want to reduce memory pressure after inspecting results.
Inside a custom extractor, the nested [`RunResult`][agents.result.RunResult] also exposes
581
+
[`agent_tool_invocation`][agents.result.RunResultBase.agent_tool_invocation], which is useful when
582
+
you need the outer tool name, call ID, or raw arguments while post-processing the nested result.
583
+
See the [Results guide](results.md#agent-as-tool-metadata).
584
+
580
585
### Streaming nested agent runs
581
586
582
587
Pass an `on_stream` callback to `as_tool` to listen to streaming events emitted by the nested agent while still returning its final output once the stream completes.
0 commit comments