Tool-calling loop
A tool-calling loop is the execution cycle that turns a language model into an agent. The model emits a structured call — a tool name with arguments — the runtime executes it against a real system, and the observation is appended to the model's context for the next decision, until the model produces a final answer.
Every hosted 'agent' product is this loop with different tools, prompts, and stopping rules. Its failure math is unforgiving: with per-step success probability p, an n-step task completes at roughly pⁿ, which is why guardrails, retries, and evaluation exist.
- USER GOAL
Goal: “Which of our 3 suppliers delivered fastest last month, on average?”
Every observation is appended — the loop pays for its own history on every subsequent model call.
Task success ≈ p^n: at 95% per step, a 1-step run completes 95% of the time — and a 12-step run only 54%.