Convert tool execution exceptions into repairable tool errors instead of crashing monologue #75

Open
opened 2026-09-04 15:37:54 +00:00 by mara · 0 comments
Collaborator

Summary

Defense-in-depth follow-up to #69.

In agent.py:1203 and agent.py:1483 the call response = await tool.execute(**tool_args) is wrapped only in try/finally — any exception (KeyError, ValueError, third-party bugs) bubbles to handle_exception() which re-raises and kills the monologue loop.

Suggested fix

Wrap with except Exception as e: returning Response(message=f"Tool {tool_name} failed: {e}", break_loop=False) so the model can repair its arguments on the next iteration. This single change converts every tool-arg crash class into a recoverable error.

## Summary Defense-in-depth follow-up to #69. In `agent.py:1203` and `agent.py:1483` the call `response = await tool.execute(**tool_args)` is wrapped only in `try/finally` — any exception (KeyError, ValueError, third-party bugs) bubbles to `handle_exception()` which re-raises and kills the monologue loop. ## Suggested fix Wrap with `except Exception as e:` returning `Response(message=f"Tool {tool_name} failed: {e}", break_loop=False)` so the model can repair its arguments on the next iteration. This single change converts every tool-arg crash class into a recoverable error.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/a0-symbolics#75
No description provided.