Repository navigation
Closed as not planned
Labels
bugSomething isn't workingfeature:realtimeneeds-more-infoWaiting for a reply/more info from the authorstale
Description
Describe the bug
I am seeing a Tool not found exception after the agent handoff intermittently.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/arklex/env/agents/openai_realtime_agent.py", line 413, in receive_events
async for event in self.session:
File "/usr/local/lib/python3.10/site-packages/agents/realtime/session.py", line 162, in __aiter__
raise self._stored_exception
File "/usr/local/lib/python3.10/site-packages/agents/realtime/openai_realtime.py", line 244, in _listen_for_messages
await self._handle_ws_event(parsed)
File "/usr/local/lib/python3.10/site-packages/agents/realtime/openai_realtime.py", line 584, in _handle_ws_event
await self._handle_output_item(parsed.item)
File "/usr/local/lib/python3.10/site-packages/agents/realtime/openai_realtime.py", line 442, in _handle_output_item
await self._emit_event(
File "/usr/local/lib/python3.10/site-packages/agents/realtime/openai_realtime.py", line 235, in _emit_event
await listener.on_event(event)
File "/usr/local/lib/python3.10/site-packages/agents/realtime/session.py", line 204, in on_event
await self._handle_tool_call(event)
File "/usr/local/lib/python3.10/site-packages/agents/realtime/session.py", line 451, in _handle_tool_call
raise ModelBehaviorError(f"Tool {event.name} not found")
agents.exceptions.ModelBehaviorError: Tool getProductCategories not found
The events fire before the exception -
Error in receive_events: Tool getProductCategories not found
agent_start: SalesAgent
audio_interrupted
agent_end: SalesAgent
raw_model_event audio_delta
agent_start: SalesAgent
agent_end: SalesAgent
handoff: AuthAgent -> SalesAgent
Wondering if anyone has seen this behavior before.
Debug information
- Agents SDK version: 0.2.10
- Python version: Python 3.10
Repro steps
This issue is hard to reproduce as its happening intermittently.
- Have two agents with their own set of tools
- Get to the agent handover
- Request a tool call
- The exception should be thrown
Expected behavior
Tool call to succeed without throwing an exception
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingfeature:realtimeneeds-more-infoWaiting for a reply/more info from the authorstale
Activity
shehan360 commentedon Sep 5, 2025
Just realized that my tool was named
GetProductCategoriesnotgetProductCategories. So this issue is due to the model generating a wrong tool call name.Wondering if there is a good way to gracefully retry in such case
seratch commentedon Sep 8, 2025
This usually does not occur. If you could share a bit more details such as minimal working code that reproduces the error, it'd be helpful for us to check further.
github-actions commentedon Sep 16, 2025
This issue is stale because it has been open for 7 days with no activity.
github-actions commentedon Sep 19, 2025
This issue was closed because it has been inactive for 3 days since being marked as stale.
aligokalppeker commentedon Dec 16, 2025
This issue should be reopened @seratch, this approach creates a big issue with complex agents.
The model may not be able to run with full accuracy and can sometimes make up tools. In this case, the current Agent SDK raises an exception and brings down the whole session, making the bot unable to recover from the state and continue execution.
The tool execution error should not be raised but propagated upward with a messaging/logging so it can operate.