# OpenAI tool-call loop: the model keeps calling tools and never answers
## The symptom
The model calls tools turn after turn, cost climbs, and no final answer arrives. Or it calls the same tool with nearly identical arguments repeatedly. Logs show dozens of turns for a task that should take three.
## Confirm the cause
Log every turn: turn number, tool name, an arguments hash, and whether the tool result changed anything. The signatures:
- **Same tool, same args, repeated:** the tool result is not giving the model what it needs, or the model ignores the result. The loop is in your tool design or instructions.
- **New tool every turn, never converging:** the task is under-specified. The model explores because nothing says when to stop.
- **Many parallel calls per turn:** `parallel_tool_calls` defaults to allowing multiple calls per turn. Fine for fan-out, terrible when each call spawns more calls.
## The fix
1. **`tool_choice`.** `auto` (default) lets the model call zero, one, or many functions. `required` forces at least one call. A specific function forces exactly that one. When the model should answer instead of act, set `tool_choice: "none"` for that turn.
2. **`parallel_tool_calls: false`.** Ensures zero or one tool call per turn. Use it when parallel calls multiply the loop.
3. **A hard turn cap in your code.** The API will not stop the loop for you. Cap turns (ten is sane), and at the cap return the best answer so far or escalate to a human. This is the guardrail that saves the bill.
4. **Conclusive tool results.** A tool that returns "not found" forever invites infinite retries. Make failure results explicit about the next step, and name the stopping condition in your instructions.
## Verify the fix
Replay the looping task and confirm it terminates within the cap. Track turns per task as a metric and alert when p99 approaches the cap; rising turn counts warn before the next runaway bill.