/agent or /coder runs inside it: each specialized agent (FileAgent, CoderAgent, Planner, Refiner, β¦) executes its own Reason β Act β Observe loop until it solves the task or hits the turn cap.
ReAct is always on. The other six patterns compose around it without replacing it.
How it works
1
Reason
The LLM receives the agentβs system prompt + the task + history of observations and produces a response that may contain reasoning text, a
<tool_call>, an <agent_call>, or the final answer.2
Act
If there was a tool/agent call, chatcli executes it (shell, file read, API call, sub-agent dispatch, β¦) and captures the output.
3
Observe
The tool output goes back into history as a system message β the next LLM turn already sees the result.
4
Repeat
Until the LLM emits a response without tool calls (natural end) or it hits
CHATCLI_AGENT_WORKER_MAX_TURNS (default 30).Code architecture
Configuration
Interaction with the rest of the pipeline
InsidePipeline.Run, the flow is:
Observability
Each loop turn emits structured events viazap.Logger:
AgentEvent{Type: Started|Completed|Failed} via channel (see DispatchWithProgress), consumed by the UI to render the timeline.
See also
Multi-Agent Orchestration
How the parallel fan-out dispatcher coordinates multiple ReAct workers at once.
#7 Reasoning Backbone
How the effort hint gets auto-attached to ctx before each turn.