Everyone shows the AI agent working. Nobody shows the week it fell apart.
I built a support agent for a client. The demo was perfect. Every answer landed, the tone was friendly, the client was impressed. Then it went to production. Real users, real network failures, real money per token.
Three things broke. Here are all three, with the fixes I actually shipped.
Break 1: No retry logic
The LLM API timed out once during a chat. The agent just stopped halfway through the conversation. No error message, no fallback, no recovery. The user stared at a half finished answer and left.
In a demo, a timeout is a footnote. In production, timeouts are a guarantee. Every external API you depend on will fail at some point. Your agent has to assume that.
The fix: retries with exponential backoff, plus a fallback model.
async function callLLMWithRetry ( messages , { maxRetries = 3 , fallbackModel = null } = {}) { let lastError ; for ( let attempt = 0 ; attempt <= maxRetries ; attempt ++ ) { try { return await client .…