Atlas · agents
The agent loop
Call the model, carry out what it asks for, add the result, and repeat until it answers in words.
See it working: Plate I
In plain words
An agent is a language model in a loop. Each time around, the model reads everything so far and either answers you or asks to use a tool. If it asks, the tool runs and the result is added to what the model will read next time.
How it works
The loop belongs to the harness, not the model. The harness sends the context, reads the reply, runs any requested tool, appends the output, and calls the model again. Claude Code describes its work as gathering context, acting and verifying, repeated as many times as the task needs.
Going deeper
There is no fixed number of turns. A simple question may end after one model call; a bug fix may take dozens. Every turn re-sends the growing context, which is why long sessions cost more and why harnesses compact old history.
Sources
- How Claude Code works Anthropic
**gather context**, **take action**, and **verify results**
- Function calling OpenAI
Execute code on the application side with input from the tool call
Quotes were checked against the live pages on 2026-11-08.