The agent alternates between two fixes forever: each one undoes the other, and both look reasonable in…
The agent alternates between two fixes forever: each one undoes the other, and both look reasonable in isolation.
- ASet temperature to 0 so the choice stops wavering
- BKeep what has ALREADY been tried in the loop’s state, and forbid repeating it
- CRaise the iteration cap so it can work through the cycle
- DRun two agents and let them vote on the fix
Answer: B
Keep what has ALREADY been tried in the loop’s state, and forbid repeating it
Why
Oscillation is a memory problem, not a creativity problem: each step is locally correct because it cannot see that it has been taken before. Temperature 0 makes the loop deterministic - and therefore an infinite loop with certainty.
- Agent loopsYour ReAct agent calls the same search with the same query five times in a row and never finishes.
- Agent loopsYour agent is stuck in a loop - it keeps making the same tool call over and over.
- Agent loopsYour agent keeps taking near-identical steps - each tool call “succeeds”, but nothing moves toward the goal.
- Agent loopsYou cap the agent at 10 iterations to stop runaways.
More on Way of the Agent
- Course programThe first three modules are free: start in the browser or the app, no card needed.
- Library: guides, skills and promptsReady prompt templates, grouped into collections.
- AI ChroniclesSourced stories from the history of AI.
- ConceptsPlain-language explainers of agent engineering.
- Learn AI agentsApps and courses for learning AI agents, compared honestly.
Real situations from building agents - with the answer and why.
Solve a new one every day on the Path