@@ -2492,7 +2492,7 @@ async def model_logic(messages: list[ModelMessage], info: AgentInfo) -> ModelRes
24922492 @agent .tool_plain
24932493 async def slow_tool () -> str :
24942494 await asyncio .sleep (1.0 ) # 1 second, but timeout is 0.1s
2495- return 'done'
2495+ return 'done' # pragma: no cover
24962496
24972497 result = await agent .run ('call slow_tool' )
24982498
@@ -2527,14 +2527,8 @@ async def model_logic(messages: list[ModelMessage], info: AgentInfo) -> ModelRes
25272527 return ModelResponse (
25282528 parts = [ToolCallPart (tool_name = 'slow_but_allowed_tool' , args = {}, tool_call_id = 'call-1' )]
25292529 )
2530- # Second call: we should see the successful tool return (not a retry)
2531- # Check if last message has a successful tool return
2532- last_request = messages [- 1 ]
2533- if hasattr (last_request , 'parts' ):
2534- for part in getattr (last_request , 'parts' , []):
2535- if isinstance (part , ToolReturnPart ):
2536- return ModelResponse (parts = [TextPart (content = f'Tool returned: { part .content } ' )])
2537- return ModelResponse (parts = [TextPart (content = 'done' )])
2530+ # Second call: tool completed successfully, return final response
2531+ return ModelResponse (parts = [TextPart (content = 'Tool completed successfully' )])
25382532
25392533 agent = Agent (FunctionModel (model_logic ), tool_timeout = 0.05 ) # 50ms global timeout
25402534
@@ -2617,7 +2611,7 @@ async def model_logic(messages: list[ModelMessage], info: AgentInfo) -> ModelRes
26172611 @agent .tool_plain
26182612 async def my_slow_tool () -> str :
26192613 await asyncio .sleep (1.0 )
2620- return 'done'
2614+ return 'done' # pragma: no cover
26212615
26222616 result = await agent .run ('call my_slow_tool' )
26232617
@@ -2641,7 +2635,7 @@ def test_tool_timeout_definition():
26412635
26422636 @agent .tool_plain (timeout = 30.0 )
26432637 def tool_with_timeout () -> str :
2644- return 'done'
2638+ return 'done' # pragma: no cover
26452639
26462640 # Get tool definition through the toolset
26472641 tool = agent ._function_toolset .tools ['tool_with_timeout' ]
@@ -2655,7 +2649,7 @@ def test_tool_timeout_default_none():
26552649
26562650 @agent .tool_plain
26572651 def tool_without_timeout () -> str :
2658- return 'done'
2652+ return 'done' # pragma: no cover
26592653
26602654 tool = agent ._function_toolset .tools ['tool_without_timeout' ]
26612655 assert tool .timeout is None
0 commit comments