RFC 0003: The agent loop — sequential bounded traversal

Status: Accepted, implemented. Author: Andrii Tsok Depends on: RFC 0001 §8–§9.

1. Problem

Every LLM-agent runtime has to answer one question first: who owns the loop? Two architectures dominate:

  1. Model-owned (ReAct-style). The LLM emits a thought and an action; the runtime executes the action and feeds the observation back; repeat until the model decides to stop. Maximum flexibility — the model can pursue tasks nobody enumerated in advance.
  2. Runtime-owned (workflow-style). Control flow is fixed before execution; the model fills designated reasoning steps. Maximum predictability — every possible action is enumerable before the process starts.

This RFC records why agentd is permanently in camp 2, what exactly the loop does, and which relaxations we will and will not entertain.

2. Decision

The engine is a sequential interpreter over a predeclared DAG:

resolve start ─► [deadline check ─► dispatch node ─► record output
      ▲                                   │
      └────────── follow matching edge ◄──┘ ]   × at most MAX_STEPS

3. Why not a model-owned loop

We prototyped the obvious alternative — a plan_act module where the model proposed the next action each iteration — and discarded it. The observed failure modes match what the literature reports:

4. What we accept in exchange

A frozen graph is brittle under unanticipated branching: if reality produces a case the author didn't model, the run takes a declared fallback (fail, dead-end completion) instead of inventing recovery. We consider this the correct trade for the runtime's target domain — repeatable, policy-bound automation — and say so in user-facing docs rather than pretending otherwise.

5. Bounded relaxations

Both preserve the invariants and are explicitly declared-by-the-author, never model-initiated:

A model-owned inner loop ("agentic sub-node") is the only relaxation that would weaken §2's guarantees; if it ever lands it will be a separate RFC with its own budget, tool subset, and step cap, and the outer DAG remains the authority over everything it may touch.

6. Consequences