Skip to content

Commit cb3066f

Browse files
test(openai-agents): New tool field and library error log
1 parent ed843cf commit cb3066f

File tree

2 files changed

+14
-28
lines changed

2 files changed

+14
-28
lines changed

tests/integrations/openai_agents/test_openai_agents.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,11 @@ def simple_test_tool(message: str) -> str:
11181118
available_tools[0].update(
11191119
{"tool_input_guardrails": None, "tool_output_guardrails": None}
11201120
)
1121+
if parse_version(OPENAI_AGENTS_VERSION) >= (
1122+
0,
1123+
8,
1124+
):
1125+
available_tools[0]["needs_approval"] = False
11211126

11221127
available_tools = safe_serialize(available_tools)
11231128

@@ -1496,6 +1501,7 @@ async def test_error_handling(sentry_init, capture_events, test_agent):
14961501
)
14971502

14981503
(
1504+
error_log,
14991505
error_event,
15001506
transaction,
15011507
) = events
@@ -1545,6 +1551,7 @@ async def test_error_captures_input_data(sentry_init, capture_events, test_agent
15451551
)
15461552

15471553
(
1554+
error_log,
15481555
error_event,
15491556
transaction,
15501557
) = events
@@ -1588,7 +1595,7 @@ async def test_span_status_error(sentry_init, capture_events, test_agent):
15881595
test_agent, "Test input", run_config=test_run_config
15891596
)
15901597

1591-
(error, transaction) = events
1598+
(error_log, error, transaction) = events
15921599
assert error["level"] == "error"
15931600
assert transaction["spans"][0]["status"] == "internal_error"
15941601
assert transaction["spans"][0]["tags"]["status"] == "internal_error"
@@ -2692,27 +2699,6 @@ def test_openai_agents_message_truncation(sentry_init, capture_events):
26922699
assert "small message 5" in str(parsed_messages[0])
26932700

26942701

2695-
def test_streaming_patches_applied(sentry_init):
2696-
"""
2697-
Test that the streaming patches are applied correctly.
2698-
"""
2699-
sentry_init(
2700-
integrations=[OpenAIAgentsIntegration()],
2701-
traces_sample_rate=1.0,
2702-
)
2703-
2704-
# Verify that run_streamed is patched (will have __wrapped__ attribute if patched)
2705-
import agents
2706-
2707-
# Check that the method exists and has been modified
2708-
assert hasattr(agents.run.DEFAULT_AGENT_RUNNER, "run_streamed")
2709-
assert hasattr(agents.run.AgentRunner, "_run_single_turn_streamed")
2710-
2711-
# Verify the patches were applied by checking for our wrapper
2712-
run_streamed_func = agents.run.DEFAULT_AGENT_RUNNER.run_streamed
2713-
assert run_streamed_func is not None
2714-
2715-
27162702
@pytest.mark.asyncio
27172703
async def test_streaming_span_update_captures_response_data(
27182704
sentry_init, test_agent, mock_usage

tox.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ envlist =
7070

7171
# ~~~ Agents ~~~
7272
{py3.10,py3.11,py3.12}-openai_agents-v0.0.19
73-
{py3.10,py3.12,py3.13}-openai_agents-v0.2.11
74-
{py3.10,py3.12,py3.13}-openai_agents-v0.4.2
75-
{py3.10,py3.13,py3.14,py3.14t}-openai_agents-v0.7.0
73+
{py3.10,py3.12,py3.13}-openai_agents-v0.3.3
74+
{py3.10,py3.13,py3.14,py3.14t}-openai_agents-v0.6.9
75+
{py3.10,py3.13,py3.14,py3.14t}-openai_agents-v0.8.1
7676

7777
{py3.10,py3.12,py3.13}-pydantic_ai-v1.0.18
7878
{py3.10,py3.12,py3.13}-pydantic_ai-v1.18.0
@@ -398,9 +398,9 @@ deps =
398398

399399
# ~~~ Agents ~~~
400400
openai_agents-v0.0.19: openai-agents==0.0.19
401-
openai_agents-v0.2.11: openai-agents==0.2.11
402-
openai_agents-v0.4.2: openai-agents==0.4.2
403-
openai_agents-v0.7.0: openai-agents==0.7.0
401+
openai_agents-v0.3.3: openai-agents==0.3.3
402+
openai_agents-v0.6.9: openai-agents==0.6.9
403+
openai_agents-v0.8.1: openai-agents==0.8.1
404404
openai_agents: pytest-asyncio
405405

406406
pydantic_ai-v1.0.18: pydantic-ai==1.0.18

0 commit comments

Comments
 (0)