3434 # https://github.com/openai/openai-agents-python/commit/3ce7c24d349b77bb750062b7e0e856d9ff48a5d5#diff-7470b3a5c5cbe2fcbb2703dc24f326f45a5819d853be2b1f395d122d278cd911
3535 from agents .run_internal import run_loop , turn_preparation , turn_resolution
3636except ImportError :
37- run_loop = None
38- turn_preparation = None
39- turn_resolution = None
37+ run_loop = None # type: ignore[assignment]
38+ turn_preparation = None # type: ignore[assignment]
39+ turn_resolution = None # type: ignore[assignment]
4040
4141from typing import TYPE_CHECKING
4242
@@ -50,13 +50,13 @@ def _patch_runner(use_run_hooks: "bool") -> None:
5050 # Create the root span for one full agent run (including eventual handoffs)
5151 # Note agents.run.DEFAULT_AGENT_RUNNER.run_sync is a wrapper around
5252 # agents.run.DEFAULT_AGENT_RUNNER.run. It does not need to be wrapped separately.
53- agents .run .DEFAULT_AGENT_RUNNER .run = _create_run_wrapper (
53+ agents .run .DEFAULT_AGENT_RUNNER .run = _create_run_wrapper ( # type: ignore[method-assign]
5454 agents .run .DEFAULT_AGENT_RUNNER .run ,
5555 use_run_hooks = use_run_hooks ,
5656 )
5757
5858 # Patch streaming runner
59- agents .run .DEFAULT_AGENT_RUNNER .run_streamed = _create_run_streamed_wrapper (
59+ agents .run .DEFAULT_AGENT_RUNNER .run_streamed = _create_run_streamed_wrapper ( # type: ignore[method-assign]
6060 agents .run .DEFAULT_AGENT_RUNNER .run_streamed ,
6161 use_run_hooks = use_run_hooks ,
6262 )
@@ -177,9 +177,9 @@ async def new_wrapped_final_output(
177177 return
178178
179179 if not use_run_hooks :
180- original_get_all_tools = AgentRunner ._get_all_tools
180+ original_get_all_tools = AgentRunner ._get_all_tools # type: ignore[attr-defined]
181181
182- @wraps (AgentRunner ._get_all_tools .__func__ )
182+ @wraps (AgentRunner ._get_all_tools .__func__ ) # type: ignore[attr-defined]
183183 async def old_wrapped_get_all_tools (
184184 cls : "agents.Runner" ,
185185 agent : "agents.Agent" ,
@@ -189,44 +189,44 @@ async def old_wrapped_get_all_tools(
189189 original_get_all_tools , agent , context_wrapper
190190 )
191191
192- agents .run .AgentRunner ._get_all_tools = classmethod (
193- old_wrapped_get_all_tools
192+ agents .run .AgentRunner ._get_all_tools = classmethod ( # type: ignore[attr-defined]
193+ old_wrapped_get_all_tools # type: ignore[arg-type]
194194 )
195195
196- original_get_model = AgentRunner ._get_model
196+ original_get_model = AgentRunner ._get_model # type: ignore[attr-defined]
197197
198- @wraps (AgentRunner ._get_model .__func__ )
198+ @wraps (AgentRunner ._get_model .__func__ ) # type: ignore[attr-defined]
199199 def old_wrapped_get_model (
200200 cls : "agents.Runner" , agent : "agents.Agent" , run_config : "agents.RunConfig"
201201 ) -> "agents.Model" :
202202 return _get_model (original_get_model , agent , run_config )
203203
204- agents .run .AgentRunner ._get_model = classmethod (old_wrapped_get_model )
204+ agents .run .AgentRunner ._get_model = classmethod (old_wrapped_get_model ) # type: ignore[arg-type,attr-defined]
205205
206- original_run_single_turn = AgentRunner ._run_single_turn
206+ original_run_single_turn = AgentRunner ._run_single_turn # type: ignore[attr-defined]
207207
208- @wraps (AgentRunner ._run_single_turn .__func__ )
208+ @wraps (AgentRunner ._run_single_turn .__func__ ) # type: ignore[attr-defined]
209209 async def old_wrapped_run_single_turn (
210210 cls : "agents.Runner" , * args : "Any" , ** kwargs : "Any"
211211 ) -> "SingleStepResult" :
212212 return await _run_single_turn (original_run_single_turn , * args , ** kwargs )
213213
214- agents .run .AgentRunner ._run_single_turn = classmethod (
215- old_wrapped_run_single_turn
214+ agents .run .AgentRunner ._run_single_turn = classmethod ( # type: ignore[attr-defined]
215+ old_wrapped_run_single_turn # type: ignore[arg-type]
216216 )
217217
218- original_run_single_turn_streamed = AgentRunner ._run_single_turn_streamed
218+ original_run_single_turn_streamed = AgentRunner ._run_single_turn_streamed # type: ignore[attr-defined]
219219
220- @wraps (AgentRunner ._run_single_turn_streamed .__func__ )
220+ @wraps (AgentRunner ._run_single_turn_streamed .__func__ ) # type: ignore[attr-defined]
221221 async def old_wrapped_run_single_turn_streamed (
222222 cls : "agents.Runner" , * args : "Any" , ** kwargs : "Any"
223223 ) -> "SingleStepResult" :
224224 return await _run_single_turn_streamed (
225225 original_run_single_turn_streamed , * args , ** kwargs
226226 )
227227
228- agents .run .AgentRunner ._run_single_turn_streamed = classmethod (
229- old_wrapped_run_single_turn_streamed
228+ agents .run .AgentRunner ._run_single_turn_streamed = classmethod ( # type: ignore[attr-defined]
229+ old_wrapped_run_single_turn_streamed # type: ignore[arg-type]
230230 )
231231
232232 original_execute_handoffs = agents ._run_impl .RunImpl .execute_handoffs
@@ -238,7 +238,7 @@ async def old_wrapped_execute_handoffs(
238238 return await _execute_handoffs (original_execute_handoffs , * args , ** kwargs )
239239
240240 agents ._run_impl .RunImpl .execute_handoffs = classmethod (
241- old_wrapped_execute_handoffs
241+ old_wrapped_execute_handoffs # type: ignore[arg-type]
242242 )
243243
244244 original_execute_final_output = agents ._run_impl .RunImpl .execute_final_output
@@ -252,5 +252,5 @@ async def old_wrapped_final_output(
252252 )
253253
254254 agents ._run_impl .RunImpl .execute_final_output = classmethod (
255- old_wrapped_final_output
255+ old_wrapped_final_output # type: ignore[arg-type]
256256 )
0 commit comments