Skip to content

OpenAI Agents integration emits PydanticDeprecatedSince20 on tool calls - _set_output_data calls dict() #7827

Description

@fbartho

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 DeprecationWarnings (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.

for output in result.output:
if output.type == "function_call":
output_messages["tool"].append(output.dict())
elif output.type == "message":
for output_message in output.content:
try:
output_messages["response"].append(output_message.text)
except AttributeError:
# Unknown output message type, just return the json
output_messages["response"].append(output_message.dict())

Every supported openai-agents version requires Pydantic v2, so model_dump() is a drop-in replacement.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions