How it works
You define a tree. The agent drives execution.
The animation below runs both halves at once: the YAML tree on one side, the MCP tool exchange on the other, and the cursor moving between them. A node enters the active state, the agent answers, the runtime advances, and the next node lights up.
The loop
Once you hand the agent a trace URI — the address the runtime writes execution state to — three MCP tool calls drive every execution:
next_step(trace_output)asks the runtime what to do. The response is one of four shapes:evaluate(a precondition to check),instruct(work to perform),done, orfailure.eval(trace_output, true|false)answers anevaluatestep. The runtime advances if the precondition holds; the action fails immediately if it does not.submit(trace_output, "success"|"failure"|"running")reports the outcome of aninstructstep.successadvances the cursor;failureaborts the action by the parent's branch rules;runningack-and-pauses without advancing.
As each node finishes, it settles into success (green) or failure (red). The cursor — the pink ring — sits on the node the agent is currently working on. The agent never sees anything else.
The contract
- You write the tree. Composite nodes —
sequence,selector,parallel— coordinate;actionnodes do the work. - The runtime walks it. It hands the agent the next step, gates each one on declared state, and persists the cursor between calls.
- The agent answers. It evaluates preconditions and performs instructions. It does not decide which step comes next.
That separation — control flow on the runtime side, work on the agent side — is what makes the same workflow deterministic, resumable, and replayable.
Next
- State — the
$VARblackboard and$CONSTworld model the agent reads and writes between steps. - Branches and actions — the four primitives in detail, with the rules each one enforces.
- Drive over MCP — every tool the loop above uses, with response shapes and the phase machine behind them.