The loop
agent/loop.py
for step in range(max_steps)
context
.fit()
budget
provider
.complete()
the model proposes
_record()
append + checkpoint
tool_calls?
the exit condition
policy
.check()
before, not after
run(call)
the side effect
role="tool"
results go back
next step
break →
StopReason.END_TURN
{{ line }}
{{ caption }}
messages: {{ msgCount }}