Building AI Agents
Common Failure Modes and How Frameworks Mitigate Them · 1/2

Looping, hallucinated calls, and losing the plot

Agents fail in fairly predictable ways. Looping happens when an agent gets stuck repeating the same failed action over and over, like retrying the exact same broken code fix five times because it isn't correctly registering that the previous attempt failed. Hallucinated tool calls happen when a model requests a function that doesn't exist, or passes parameters that don't match what a real tool expects, essentially inventing a capability it doesn't actually have because it 'sounds' plausible given the pattern of other tool calls it has seen.

Losing the plot happens on long, multi-step tasks when earlier context, like the original goal or key constraints discovered along the way, falls out of the model's effective attention as the conversation grows longer, causing the agent to drift into solving a slightly different problem than the one it started with, or to forget a requirement it confirmed several steps earlier.