# X_AGENT_MAX_TURNS

## Means

an agent hit its turn ceiling without answering

## Typical cause

an `agent()` loop with no exit condition — a tool that answers the same thing every turn, or a prompt that never tells the model to finish. Never a partial answer: the loop's whole contract is that it either satisfies `output` or says it did not, and a half-finished transcript returned as a result is a model's working notes presented as a decision. Raising the ceiling on a non-converging loop spends more money on the same non-answer, which is why the fix names the prompt before the number

## Fix

tell the template when to stop and answer through the respond tool, then bump its version — raise `maxTurns` only once the run demonstrably converges

[MCP and AI](/error-codes#mcp-and-ai)
