Terminal Tool Failure
RULE-TERMINAL-TOOL-FAILURE: Identifies tool crashes that directly precipitate unhandled process termination.
A tool failure occurs as the immediate precursor event prior to process termination.
A failed tool_result event temporally immediately preceding process_error or abnormal exit code.
Wrap tool execution in defensive try-except blocks to prevent tool exceptions from bubbling up and killing the agent runner process.
Rule Specification
When an agent crashes, developers often spend hours examining complex prompt histories when the true culprit was a simple uncaught exception in a tool helper function. RULE-TERMINAL-TOOL-FAILURE connects the dots between a tool failure and process death.
Temporal Proximity & Correlation
The deterministic engine calculates the temporal delta (Δt) between the last failed tool event and the process termination event. If Δt < 500ms and no other successful operations occurred in between, the tool failure is classified as the proximate fatal trigger.
Remediation Guide
- Defensive Exception Handling: Never let third-party SDK errors (e.g. requests.exceptions.ConnectionError) bubble unhandled into the agent event loop.
- Graceful Tool Degradation: Return a structured error dictionary to the agent's LLM context instead of throwing fatal exceptions.