@@ -233,7 +233,7 @@ async def run_agent(
233233
234234 async with mcp_server_context (mcp_server_params , mcp_timeout_seconds ) as servers :
235235 tools = [
236- tool .to_oai_function_tool () if hasattr (tool , 'to_oai_function_tool' ) else tool
236+ tool .to_oai_function_tool () if hasattr (tool , 'to_oai_function_tool' ) else tool # type: ignore[attr-defined]
237237 for tool in tools
238238 ] if tools else []
239239 handoffs = [Agent (** handoff .model_dump ()) for handoff in handoffs ] if handoffs else [] # type: ignore[misc]
@@ -251,7 +251,7 @@ async def run_agent(
251251 }
252252 if model_settings is not None :
253253 agent_kwargs ["model_settings" ] = (
254- model_settings .to_oai_model_settings () if hasattr (model_settings , 'to_oai_model_settings' )
254+ model_settings .to_oai_model_settings () if hasattr (model_settings , 'to_oai_model_settings' ) # type: ignore[attr-defined]
255255 else model_settings
256256 )
257257 if input_guardrails is not None :
@@ -371,7 +371,7 @@ async def run_agent_auto_send(
371371
372372 async with mcp_server_context (mcp_server_params , mcp_timeout_seconds ) as servers :
373373 tools = [
374- tool .to_oai_function_tool () if hasattr (tool , 'to_oai_function_tool' ) else tool
374+ tool .to_oai_function_tool () if hasattr (tool , 'to_oai_function_tool' ) else tool # type: ignore[attr-defined]
375375 for tool in tools
376376 ] if tools else []
377377 handoffs = [Agent (** handoff .model_dump ()) for handoff in handoffs ] if handoffs else [] # type: ignore[misc]
@@ -388,7 +388,7 @@ async def run_agent_auto_send(
388388 }
389389 if model_settings is not None :
390390 agent_kwargs ["model_settings" ] = (
391- model_settings .to_oai_model_settings () if hasattr (model_settings , 'to_oai_model_settings' )
391+ model_settings .to_oai_model_settings () if hasattr (model_settings , 'to_oai_model_settings' ) # type: ignore[attr-defined]
392392 else model_settings
393393 )
394394 if input_guardrails is not None :
@@ -430,7 +430,7 @@ async def run_agent_auto_send(
430430 if item .type == "message_output_item" :
431431 text_content = TextContent (
432432 author = "agent" ,
433- content = item .raw_item .content [0 ].text ,
433+ content = item .raw_item .content [0 ].text , # type: ignore[union-attr]
434434 )
435435 # Create message for the final result using streaming context
436436 async with self .streaming_service .streaming_task_message_context (
@@ -550,6 +550,8 @@ async def run_agent_streamed(
550550 Returns:
551551 RunResultStreaming: The result of the agent run with streaming.
552552 """
553+ if self .tracer is None :
554+ raise RuntimeError ("Tracer not initialized - ensure tracer is provided to OpenAIService" )
553555 trace = self .tracer .trace (trace_id )
554556 redacted_params = redact_mcp_server_params (mcp_server_params )
555557
@@ -575,7 +577,7 @@ async def run_agent_streamed(
575577
576578 async with mcp_server_context (mcp_server_params , mcp_timeout_seconds ) as servers :
577579 tools = [
578- tool .to_oai_function_tool () if hasattr (tool , 'to_oai_function_tool' ) else tool
580+ tool .to_oai_function_tool () if hasattr (tool , 'to_oai_function_tool' ) else tool # type: ignore[attr-defined]
579581 for tool in tools
580582 ] if tools else []
581583 handoffs = [Agent (** handoff .model_dump ()) for handoff in handoffs ] if handoffs else [] # type: ignore[misc]
@@ -592,7 +594,7 @@ async def run_agent_streamed(
592594 }
593595 if model_settings is not None :
594596 agent_kwargs ["model_settings" ] = (
595- model_settings .to_oai_model_settings () if hasattr (model_settings , 'to_oai_model_settings' )
597+ model_settings .to_oai_model_settings () if hasattr (model_settings , 'to_oai_model_settings' ) # type: ignore[attr-defined]
596598 else model_settings
597599 )
598600 if input_guardrails is not None :
@@ -691,6 +693,8 @@ async def run_agent_streamed_auto_send(
691693
692694 tool_call_map : dict [str , Any ] = {}
693695
696+ if self .tracer is None :
697+ raise RuntimeError ("Tracer not initialized - ensure tracer is provided to OpenAIService" )
694698 trace = self .tracer .trace (trace_id )
695699 redacted_params = redact_mcp_server_params (mcp_server_params )
696700
@@ -717,7 +721,7 @@ async def run_agent_streamed_auto_send(
717721
718722 async with mcp_server_context (mcp_server_params , mcp_timeout_seconds ) as servers :
719723 tools = [
720- tool .to_oai_function_tool () if hasattr (tool , 'to_oai_function_tool' ) else tool
724+ tool .to_oai_function_tool () if hasattr (tool , 'to_oai_function_tool' ) else tool # type: ignore[attr-defined]
721725 for tool in tools
722726 ] if tools else []
723727 handoffs = [Agent (** handoff .model_dump ()) for handoff in handoffs ] if handoffs else [] # type: ignore[misc]
@@ -734,7 +738,7 @@ async def run_agent_streamed_auto_send(
734738 }
735739 if model_settings is not None :
736740 agent_kwargs ["model_settings" ] = (
737- model_settings .to_oai_model_settings () if hasattr (model_settings , 'to_oai_model_settings' )
741+ model_settings .to_oai_model_settings () if hasattr (model_settings , 'to_oai_model_settings' ) # type: ignore[attr-defined]
738742 else model_settings
739743 )
740744 if input_guardrails is not None :
0 commit comments