← Back to Aigentz
The Brain · 06 of 09

The Decision Tree

Five places a run can fork, and who decides each one.

There are five places a run can fork. Only one of them is the model's call. The colour on each fork says who decides: runtime for code, model for the model, human for a person.

Fork 1 · Breaker (runtime)Fork 2 · Decide (model)Fork 3 · Gate (human)Fork 4 · Return (runtime)Fork 5 · Validate (runtime)budgetunder?stop · over budgetnoyes → modelstop_reasonwhich?tool_useend_turnmax_tokensrefusaltruncated · continue or stopstop, log itgated leg?humanallow → runedit args → rundeny → error textnot gated → runall legsreturned?back to contextyes, pass n+1errors ride the same wireschemaok?commit · doneyesno → bounce, retry < Nfail · retries out
Five forks. The model owns exactly one of them, fork 2, and even there the runtime reads the answer and does the routing.
Fork 1 · Breaker

Runtime. Passes, tokens, dollars, seconds. Checked before every model call. Over the ceiling ends the run with a reason logged, no model call spent.

Fork 2 · Decide

Model. Four stop reasons in practice: tool_use (loop again), end_turn (exit), max_tokens (reply cut off: you choose to continue or stop), refusal (stop, log).

Fork 3 · Gate

Human, only on legs you mark as gated (writes, money, sends). Allow, edit the arguments, or deny. A denial goes back to the model as an error message, so the model can plan around it.

Fork 4 · Return

Runtime. Wait for every parallel leg. Bundle results and errors as tool_result blocks. Append to context. Go around again.

Fork 5 · Validate

Runtime. Parse the final answer against the schema. Good: commit. Bad: bounce it back with the parse error in context, up to N retries, then fail the run.