Expand description
The agent loop.
Ask the model, run whatever tools it asks for, feed the results back, repeat until it stops asking. Everything interesting — which provider, which tools, who approves side effects — is injected, so the same loop drives the REPL, a one-shot run, and a batch worker.
Structs§
- Agent
- Budget
- Per-run ceilings. Every
Nonefalls through to the agent’s own config, so a caller overrides only what it actually means to change. - Conversation
- A conversation, and what has entered it.
- RunContext
- What the loop consults that is properly per-run rather than per-agent: what tools may touch, who approves the ones that aren’t read-only, and what this particular run is allowed to spend.
- RunOutcome
- Taint
- What has entered this conversation so far.
- Tool
Call Trace - One tool call as it actually happened. The trace is what you grade a model on — final text alone can’t tell a lucky guess from correct tool use.
Enums§
- Agent
Event - Everything the loop wants to tell an observer. The CLI renders these; a batch runner ignores all but the last.
- Phase
- Which half of the work a run is doing.
- Stop
Cause - Why the loop stopped.
Completedis the model deciding it was done; everything else is the harness cutting it short.
Functions§
- turns_
phrase - “1 turn”, “3 turns”. These strings are read by people.