Skip to content

Commit 79d5b26

Browse files
committed
docs: document auto_previous_response_id and model_refusal error handler
Two pieces of doc drift accumulated: - PR #2117 added the `auto_previous_response_id` parameter to `Runner.run`, `Runner.run_sync`, and `Runner.run_streamed` signatures but did not document it in the `Args:` blocks. - PR #3057 added `model_refusal` as a supported key in `RunErrorHandlers`, but four docstrings still claim "Currently supports max_turns" only (three in `run.py`, one in `run_config.py:RunOptions.error_handlers`). Add the missing `auto_previous_response_id` entry to each `Args:` block and update the `error_handlers` description to list both handler kinds.
1 parent eed9100 commit 79d5b26

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/agents/run.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,14 @@ async def run(
239239
Pass ``None`` to disable the turn limit.
240240
hooks: An object that receives callbacks on various lifecycle events.
241241
run_config: Global settings for the entire agent run.
242-
error_handlers: Error handlers keyed by error kind. Currently supports max_turns.
242+
error_handlers: Error handlers keyed by error kind. Currently supports
243+
max_turns and model_refusal.
243244
previous_response_id: The ID of the previous response. If using OpenAI
244245
models via the Responses API, this allows you to skip passing in input
245246
from the previous turn.
247+
auto_previous_response_id: If True, enable Responses API response chaining
248+
automatically for the first turn even when no
249+
``previous_response_id`` is supplied yet.
246250
conversation_id: The conversation ID
247251
(https://platform.openai.com/docs/guides/conversation-state?api-mode=responses).
248252
If provided, the conversation will be used to read and write items.
@@ -325,10 +329,14 @@ def run_sync(
325329
Pass ``None`` to disable the turn limit.
326330
hooks: An object that receives callbacks on various lifecycle events.
327331
run_config: Global settings for the entire agent run.
328-
error_handlers: Error handlers keyed by error kind. Currently supports max_turns.
332+
error_handlers: Error handlers keyed by error kind. Currently supports
333+
max_turns and model_refusal.
329334
previous_response_id: The ID of the previous response, if using OpenAI
330335
models via the Responses API, this allows you to skip passing in input
331336
from the previous turn.
337+
auto_previous_response_id: If True, enable Responses API response chaining
338+
automatically for the first turn even when no
339+
``previous_response_id`` is supplied yet.
332340
conversation_id: The ID of the stored conversation, if any.
333341
session: A session for automatic conversation history management.
334342
@@ -402,10 +410,14 @@ def run_streamed(
402410
Pass ``None`` to disable the turn limit.
403411
hooks: An object that receives callbacks on various lifecycle events.
404412
run_config: Global settings for the entire agent run.
405-
error_handlers: Error handlers keyed by error kind. Currently supports max_turns.
413+
error_handlers: Error handlers keyed by error kind. Currently supports
414+
max_turns and model_refusal.
406415
previous_response_id: The ID of the previous response, if using OpenAI
407416
models via the Responses API, this allows you to skip passing in input
408417
from the previous turn.
418+
auto_previous_response_id: If True, enable Responses API response chaining
419+
automatically for the first turn even when no
420+
``previous_response_id`` is supplied yet.
409421
conversation_id: The ID of the stored conversation, if any.
410422
session: A session for automatic conversation history management.
411423

src/agents/run_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ class RunOptions(TypedDict, Generic[TContext]):
305305
"""The session for the run."""
306306

307307
error_handlers: NotRequired[RunErrorHandlers[TContext] | None]
308-
"""Error handlers keyed by error kind. Currently supports max_turns."""
308+
"""Error handlers keyed by error kind. Currently supports max_turns and model_refusal."""
309309

310310

311311
__all__ = [

0 commit comments

Comments
 (0)