### How do you use Sentry? Sentry Saas (sentry.io) ### Version 2.71.0 ### Steps to Reproduce 1. `sentry_sdk.init(integrations=[OpenAIAgentsIntegration()], send_default_pii=True, traces_sample_rate=1.0)` with `openai-agents` installed. 2. Enable `DeprecationWarning`s (`python -W error::DeprecationWarning`, or any dependency that does so process-wide). 3. Run an agent whose model response contains a function call. ### Expected Result No warning from `sentry_sdk`. ### Actual Result ``` PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. sentry_sdk/integrations/openai_agents/utils.py:229 ``` The same warning comes from line 236 when a message contains non-text content such as a refusal. https://github.com/getsentry/sentry-python/blob/8afefe81d014cc6bffffca28c18e1219f545d49f/sentry_sdk/integrations/openai_agents/utils.py#L227-L236 Every supported `openai-agents` version requires Pydantic v2, so `model_dump()` is a drop-in replacement.
Activity
linear-code commentedon Oct 2, 2026
PY-2918
fbartho commentedon Oct 2, 2026
I found this while updating some dependencies at work.
I'll open a PR shortly since it's "just" a straight-forward migration.UPDATE: nevermind, reading CONTRIBUTING more closely, I need to wait until a maintainer responds. Let me know if you want a PR.
fbartho commentedon Oct 2, 2026
The same
dict()pattern is insentry_sdk/integrations/openai.py, in the Responses API output path:sentry-python/sentry_sdk/integrations/openai.py
Lines 733 to 771 in 8afefe8
Would you like those four calls fixed in the same pull request, or kept to
openai_agentshere and handled separately?alexander-alderman-webb commentedon Oct 2, 2026
Yes @fbartho, feel free to replace
dict()withmodel_dump()in one PR.fix: use model_dump() instead of deprecated dict() in OpenAI output p…
fix: use model_dump() instead of deprecated dict() in OpenAI output p…
alexander-alderman-webb commentedon Oct 5, 2026
We can't blindly call
model_dump()foropenai-pythonbecause it allows old Pydantic versions in it'spyproject.tomlhttps://github.com/openai/openai-python/blob/becc1d20eed83c1b8d85e15dc131a372d9dc7813/pyproject.toml#L13