ErrorClassifier Multi-Dimensional Error Classification & Moderation Validation
Decrypting agent/error_classifier.py transient network error vs. security block decisions
📊 Figure 2-5-1: Error Classifier Decision Logic & Main Loop Retry State Machine
🛡️ 1. Multi-Dimensional Error Classification Decision
LLM requests in production frequently encounter network glitches or authorization errors. agent/error_classifier.py defines a multi-dimensional error dictionary:
transient_error: Errors like 503 gateway timeouts or Broken Pipe. These automatically refund the budget and perform Jitter Retry.terminal_error: Errors like 400 bad request or 401 key expiration. These immediately abort the loop to prevent wasteful token consumption.
📊 Figure 2-5-2: Error Blocking, Exception Feature Mapping & Concurrent Transaction Writeback Delay Sequence
🔒 2. Moderation Content Filtering Interception
When the API returns content_filter or a moderation refusal, the system calls _content_policy_blocked_result(), providing the user with friendly rephrasing guidance and blocking subsequent invalid tool calls.