◐ Shell
clean mode source ↗

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>

@ericapisani marked this pull request as ready for review

April 20, 2026 13:08

sentrivana

@ericapisani ericapisani deleted the py-2382-update-openai-agents-patches branch

April 21, 2026 11:49

This was referenced

May 4, 2026