AI Agent Error Categorization 2026

🤖 Agents 2026-07-17 · Updated 2026-11-09 3 min read

Timeouts, rate limits, bad arguments, third-party outages, malformed output. Adding a try-except per case rots the code. Six categories, one strategy each, and the code gets shorter.

📜 Table of Contents

📖 Keep reading

Six Error Categories for Agents and How to Handle Each

Agent failures are broader than service failures: network timeouts, invalid JSON from the model, and plans that were never sensible. One try-except per error rots the code within months.

The six categories

Type Symptoms Strategy Retry
Transient timeout, 429, connection reset exponential backoff with jitter yes, capped
Input missing or malformed arguments clear message to the user no
Tool upstream 5xx, changed response shape fallback or degrade limited
Auth expired key, missing scope alert and stop no
Format invalid JSON, missing fields regenerate with the error once
Logic bad plan, tool loops degrade or hand off no

A large "unknown" bucket means the categories are wrong, not that the errors are exotic.

Classify by exception type

import httpx

def classify(e):
    if isinstance(e, (httpx.TimeoutException, httpx.ConnectError)):
        return "transient"
    if isinstance(e, httpx.HTTPStatusError):
        code = e.response.status_code
        if code == 429: return "transient"
        if code in (401, 403): return "auth"
        if code >= 500: return "tool"
    if isinstance(e, ValueError): return "format"
    if isinstance(e, KeyError): return "input"
    return "unknown"

Match on types, never on message text.

Handling

Error budget and alerts

Track rates per category. Rising tool errors usually mean upstream changes; rising format errors mean model or prompt changes; rising logic errors usually follow a shift in traffic mix. Alert on sliding-window ratios, and add "N consecutive failures opens the breaker" per category.

Record errors in traces

Field Use
category trend by type
tool which integration degraded
attempts whether retries help
recovered recovery rate
trace_id join to the full run

FAQ

How many categories? Six to eight. More splits each bucket too thin to show trends; use sub-tags instead.

Retry counts? Three for transient, one for format, zero for the rest. Retries cost money.

Tell the user everything? No. Silent on recovered transients, explicit about degraded features, generic on auth failures with details in alerts.

Detecting logic errors? Alert on total steps, consecutive calls to one tool, and repeated identical inputs. Stop the run instead of letting it spin.

Exception types differ by HTTP client; adjust the mapping to the library you use.

Related

Related Articles
2026-07-16
AI Agent Git Workflow 2026
2026-07-17
AI Agent Git Flow 2026
2026-07-16
No Code AI Agent Platforms 2026
2026-08-11
Fine-Tune a Model on Hugging Face 2026: The TRL + PEFT Workflow for SFT and DPO
2026-07-17
AI Agent Async Processing 2026
2026-07-17
AI Agent OpenAPI Spec 2026

Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.

💬 Comments (0)

No comments yet. Be the first!

Login to comment