At the centre of every agent harness is a loop.
The Cycle
- Send the model the task, instructions, available tools and history.
- The model responds with either a final answer or one or more tool calls.
- The harness executes the tool calls.
- Results are appended to the history.
- Go back to step 1.
Stopping Conditions
- The model returns a final answer with no tool calls.
- A maximum number of steps or tokens is reached.
- A time or cost budget runs out.
- The user interrupts.
- An unrecoverable error occurs.
Always set limits; a confused agent can otherwise loop indefinitely.
Parallel Tool Calls
Models may request several independent tool calls at once. Running them concurrently speeds things up.
Errors Are Observations
When a tool fails, return the error message to the model rather than crashing. Models can often recover — fixing a path, retrying with different arguments, or trying another approach.
Keep It Simple
A basic loop with good tools and clear instructions handles a surprising range of tasks. Add planners, sub-agents and complex state only when evaluation shows they help.