Ch 5 — The Agent Loop & Session Management
The authoritative execution path from message to action and back
Chapter 5
-
Click play or press Space to begin...
AThe Agent LoopFrom message intake to context assembly
1
input
Entry Points
CLI, Gateway RPC
assemble
2
memory
Context Assembly
Prompt building
BInference & Tool ExecutionThe agentic reasoning loop
3
neurology
Streaming
Token-by-token
tools
4
loop
Tool Loop
Execute & reason
5
lockSerialized runs: one agent run per session at a time
CEvents, Hooks & PersistenceExtensibility and transcript storage
6
webhook
Hooks
Plugin system
persist
7
save
Transcripts
JSONL on disk