-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat: add max_turns run error handlers #2347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: issue-636-hitl-2
Are you sure you want to change the base?
Conversation
73c6d41 to
8b5b294
Compare
|
@codex review this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b5b29450e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
5958b26 to
38dcdc7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5958b26a03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4bf84b825e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This pull request adds max_turns run error handler support for non-streamed and streamed runs, including structured-output validation and handler result coercion in src/agents/run.py and src/agents/run_internal/run_loop.py. It introduces new handler types/utilities in src/agents/run_error_handlers.py and src/agents/run_internal/error_handlers.py (untracked files), wires the option into RunOptions, and extends max-turns tests in tests/test_max_turns.py. Behavior change: invalid structured outputs returned by handlers now raise UserError, and handler output can be included in history via include_in_history.
The returned value can be either:
{"final_output": f"Summary: {len(data.run_data.history)} items processed.", "include_in_history": True}f"Summary: {len(data.run_data.history)} items processed."The final output data type must be compatible with the structured output data structure when it's enabled.
Some notes: