|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | | -from typing import Any |
| 3 | +from typing import Any, cast |
4 | 4 |
|
5 | 5 | import pytest |
6 | 6 | from openai.types.responses import ( |
7 | 7 | ResponseComputerToolCall, |
8 | 8 | ResponseFileSearchToolCall, |
| 9 | + ResponseFunctionToolCall, |
9 | 10 | ResponseFunctionWebSearch, |
10 | 11 | ) |
11 | 12 | from openai.types.responses.response_computer_tool_call import ActionClick |
|
30 | 31 | handoff, |
31 | 32 | ) |
32 | 33 | from agents._run_impl import RunImpl, ToolRunHandoff |
33 | | -from agents.lifecycle import RunHooksBase |
| 34 | +from agents import RunHooks |
34 | 35 | from agents.run import AgentRunner |
35 | 36 |
|
36 | 37 | from .test_responses import ( |
@@ -215,11 +216,11 @@ async def test_handoff_can_disable_run_level_history_nesting(monkeypatch: pytest |
215 | 216 | source_agent = Agent(name="source") |
216 | 217 | target_agent = Agent(name="target") |
217 | 218 | override_handoff = handoff(target_agent, nest_handoff_history=False) |
218 | | - tool_call = get_handoff_tool_call(target_agent) |
| 219 | + tool_call = cast(ResponseFunctionToolCall, get_handoff_tool_call(target_agent)) |
219 | 220 | run_handoffs = [ToolRunHandoff(handoff=override_handoff, tool_call=tool_call)] |
220 | 221 | run_config = RunConfig(nest_handoff_history=True) |
221 | 222 | context_wrapper = RunContextWrapper(context=None) |
222 | | - hooks = RunHooksBase() |
| 223 | + hooks = RunHooks() |
223 | 224 | original_input = [get_text_input_item("hello")] |
224 | 225 | pre_step_items: list[RunItem] = [] |
225 | 226 | new_step_items: list[RunItem] = [] |
@@ -258,11 +259,11 @@ async def test_handoff_can_enable_history_nesting(monkeypatch: pytest.MonkeyPatc |
258 | 259 | source_agent = Agent(name="source") |
259 | 260 | target_agent = Agent(name="target") |
260 | 261 | override_handoff = handoff(target_agent, nest_handoff_history=True) |
261 | | - tool_call = get_handoff_tool_call(target_agent) |
| 262 | + tool_call = cast(ResponseFunctionToolCall, get_handoff_tool_call(target_agent)) |
262 | 263 | run_handoffs = [ToolRunHandoff(handoff=override_handoff, tool_call=tool_call)] |
263 | 264 | run_config = RunConfig(nest_handoff_history=False) |
264 | 265 | context_wrapper = RunContextWrapper(context=None) |
265 | | - hooks = RunHooksBase() |
| 266 | + hooks = RunHooks() |
266 | 267 | original_input = [get_text_input_item("hello")] |
267 | 268 | pre_step_items: list[RunItem] = [] |
268 | 269 | new_step_items: list[RunItem] = [] |
|
0 commit comments