@@ -254,7 +254,7 @@ async def test_agent_invocation_span_no_pii(
254254 assert ai_client_span ["attributes" ]["gen_ai.request.model" ] == "gpt-4"
255255 assert ai_client_span ["attributes" ]["gen_ai.request.temperature" ] == 0.7
256256 assert ai_client_span ["attributes" ]["gen_ai.request.top_p" ] == 1.0
257- elif span_streaming or stream_gen_ai_spans :
257+ elif stream_gen_ai_spans :
258258 with patch .object (
259259 agent .model ._client ._client ,
260260 "send" ,
@@ -661,7 +661,7 @@ async def test_agent_invocation_span(
661661 assert ai_client_span ["attributes" ]["gen_ai.request.temperature" ] == 0.7
662662 assert ai_client_span ["attributes" ]["gen_ai.request.top_p" ] == 1.0
663663
664- elif span_streaming or stream_gen_ai_spans :
664+ elif stream_gen_ai_spans :
665665 with patch .object (
666666 agent .model ._client ._client ,
667667 "send" ,
@@ -970,7 +970,7 @@ def test_agent_invocation_span_sync_no_pii(
970970 assert (
971971 SPANDATA .GEN_AI_SYSTEM_INSTRUCTIONS not in invoke_agent_span ["attributes" ]
972972 )
973- elif span_streaming or stream_gen_ai_spans :
973+ elif stream_gen_ai_spans :
974974 with patch .object (
975975 agent .model ._client ._client ,
976976 "send" ,
@@ -1364,7 +1364,7 @@ def test_agent_invocation_span_sync(
13641364 json .loads (ai_client_span ["attributes" ][SPANDATA .GEN_AI_REQUEST_MESSAGES ])
13651365 == expected_request_messages
13661366 )
1367- elif span_streaming or stream_gen_ai_spans :
1367+ elif stream_gen_ai_spans :
13681368 with patch .object (
13691369 agent .model ._client ._client ,
13701370 "send" ,
@@ -2143,7 +2143,7 @@ def simple_test_tool(message: str) -> str:
21432143 assert ai_client_span2 ["attributes" ]["gen_ai.usage.output_tokens" ] == 10
21442144 assert ai_client_span2 ["attributes" ]["gen_ai.usage.total_tokens" ] == 25
21452145
2146- elif span_streaming or stream_gen_ai_spans :
2146+ elif stream_gen_ai_spans :
21472147 with patch .object (
21482148 agent_with_tool .model ._client ._client ,
21492149 "send" ,
@@ -2905,7 +2905,7 @@ def simple_test_tool(message: str) -> str:
29052905
29062906 # Error due to unrecognized tool in model response.
29072907 assert agent_span ["status" ] == "error"
2908- elif span_streaming or stream_gen_ai_spans :
2908+ elif stream_gen_ai_spans :
29092909 with patch .dict (os .environ , {"OPENAI_API_KEY" : "test-key" }), patch (
29102910 "agents.models.openai_responses.OpenAIResponsesModel.get_response"
29112911 ) as mock_get_response :
@@ -3078,7 +3078,7 @@ async def test_error_handling(
30783078 assert ai_client_span ["name" ] == "chat gpt-4"
30793079 assert ai_client_span ["attributes" ]["sentry.origin" ] == "auto.ai.openai_agents"
30803080 assert ai_client_span ["status" ] == "error"
3081- elif span_streaming or stream_gen_ai_spans :
3081+ elif stream_gen_ai_spans :
30823082 with patch .dict (os .environ , {"OPENAI_API_KEY" : "test-key" }), patch (
30833083 "agents.models.openai_responses.OpenAIResponsesModel.get_response"
30843084 ) as mock_get_response :
@@ -3339,7 +3339,7 @@ async def test_span_status_error(
33393339
33403340 assert spans [2 ]["is_segment" ] is True
33413341 assert spans [2 ]["status" ] == "error"
3342- elif span_streaming or stream_gen_ai_spans :
3342+ elif stream_gen_ai_spans :
33433343 with patch .dict (os .environ , {"OPENAI_API_KEY" : "test-key" }), patch (
33443344 "agents.models.openai_responses.OpenAIResponsesModel.get_response"
33453345 ) as mock_get_response :
@@ -3455,7 +3455,7 @@ async def run():
34553455 assert spans [2 ]["name" ] == "test_agent workflow"
34563456 assert spans [5 ]["name" ] == "test_agent workflow"
34573457 assert spans [8 ]["name" ] == "test_agent workflow"
3458- elif span_streaming or stream_gen_ai_spans :
3458+ elif stream_gen_ai_spans :
34593459 with patch .object (
34603460 agent .model ._client ._client ,
34613461 "send" ,
@@ -4268,7 +4268,7 @@ def calculator(a: int, b: int) -> int:
42684268 assert (
42694269 invoke_agent_span ["attributes" ]["gen_ai.usage.output_tokens.reasoning" ] == 3
42704270 )
4271- elif span_streaming or stream_gen_ai_spans :
4271+ elif stream_gen_ai_spans :
42724272 with patch .object (
42734273 agent_with_tool .model ._client ._client ,
42744274 "send" ,
@@ -4636,7 +4636,7 @@ def calculator(a: int, b: int) -> int:
46364636 second_ai_client_span ["attributes" ]["gen_ai.response.model" ]
46374637 == "gpt-4.1-2025-04-14"
46384638 )
4639- elif span_streaming or stream_gen_ai_spans :
4639+ elif stream_gen_ai_spans :
46404640 with patch .object (
46414641 agent_with_tool .model ._client ._client ,
46424642 "send" ,
@@ -5038,7 +5038,7 @@ async def test_conversation_id_on_all_spans(
50385038
50395039 # Verify ai_client span has conversation_id
50405040 assert ai_client_span ["attributes" ]["gen_ai.conversation.id" ] == "conv_test_123"
5041- elif span_streaming or stream_gen_ai_spans :
5041+ elif stream_gen_ai_spans :
50425042 with patch .object (
50435043 agent .model ._client ._client ,
50445044 "send" ,
@@ -5277,7 +5277,7 @@ def simple_tool(message: str) -> str:
52775277 workflow_span ["attributes" ]["gen_ai.conversation.id" ]
52785278 == "conv_tool_test_456"
52795279 )
5280- elif span_streaming or stream_gen_ai_spans :
5280+ elif stream_gen_ai_spans :
52815281 with patch .object (
52825282 agent_with_tool .model ._client ._client ,
52835283 "send" ,
@@ -5432,7 +5432,7 @@ async def test_no_conversation_id_when_not_provided(
54325432 assert "gen_ai.conversation.id" not in workflow_span .get ("attributes" , {})
54335433 assert "gen_ai.conversation.id" not in invoke_agent_span .get ("attributes" , {})
54345434 assert "gen_ai.conversation.id" not in ai_client_span .get ("attributes" , {})
5435- elif span_streaming or stream_gen_ai_spans :
5435+ elif stream_gen_ai_spans :
54365436 with patch .object (
54375437 agent .model ._client ._client ,
54385438 "send" ,
0 commit comments