Open
Conversation
Co-authored-by: Kyle-Verhoog <kyle@verhoog.ca>
Codeowners resolved as |
This comment has been minimized.
This comment has been minimized.
dubloom
reviewed
Feb 20, 2026
Comment on lines
+74
to
+77
| if hasattr(agents.run.AgentRunner, "_run_single_turn"): | ||
| wrap(agents.run.AgentRunner, "_run_single_turn", patched_run_single_turn(agents)) | ||
| if hasattr(agents.run.AgentRunner, "_run_single_turn_streamed"): | ||
| wrap(agents.run.AgentRunner, "_run_single_turn_streamed", patched_run_single_turn_streamed(agents)) |
Contributor
There was a problem hiding this comment.
Take a look at the whole workflow (with Bits).
That is super cool ! However, I'd say this looks a bit uncommon to me. As we can see in the code just above, when we have to do version specific patching, we tend to check the version instead of the "can we patch if yes we do"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR by Bits
View session in Datadog
Comment @DataDog to request changes
Feedback (especially what can be better) welcome in #code-gen-aka-bits-dev-feedback!
Description
Fixes MLOS-469. The
openai-agentsSDK v0.8.0 removedAgentRunner._run_single_turnandAgentRunner._run_single_turn_streamed, causing anAttributeErrorwhenddtracetries to patch these methods.This change adds
hasattrchecks before wrapping/unwrapping these methods so the integration gracefully handles their absence in newer SDK versions.Testing
Existing patch tests continue to pass. The fix is defensive — when the methods don't exist, we simply skip wrapping them.
Risks
None — the change is additive and only skips patching when the target methods are absent.
Additional Notes
The
_run_single_turn/_run_single_turn_streamedpatches are used fortag_agent_manifest. On openai-agents >= 0.8.0 this tagging will be skipped until a follow-up adds support for the new SDK API.