fix(openai-agents): Resolve agent from `bindings` for openai-agents >= 0.14 by ericapisani · Pull Request #6102 · getsentry/sentry-python
…= 0.14
openai-agents 0.14 refactored its run loop to pass an `AgentBindings`
dataclass (with `public_agent` and `execution_agent` fields) instead of
a raw `agent` kwarg to `run_single_turn` / `run_single_turn_streamed`,
and renamed the `agent` kwarg to `public_agent` on `execute_handoffs` /
`execute_final_output`. As a result, the integration's `kwargs.get("agent")`
returned `None`, no `invoke_agent` span was created, and every
`test_agent_invocation_span*` case failed.
Resolve the agent from `bindings.public_agent` (or the `public_agent`
kwarg) with a fallback to the pre-0.14 `agent` kwarg so older pinned
versions remain supported. `public_agent` is the user-facing identity
the library itself uses for hooks and stream events, which keeps span
names stable across sandbox-prepared execution agents.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
marked this pull request as ready for review
ericapisani
deleted the
py-2382-update-openai-agents-patches
branch
This was referenced
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