An agent should be able to stop and come back
A loop in memory is not a product. Dex Horthy’s factors 5, 6, and 12 are about making an agent something you can save, sleep, and resume. Same license as the rest of this series: a reading of 12-factor agents (CC BY-SA 4.0).
One thread, not two state machines
A lot of orchestration splits “execution state” from “business state.” Current step, waiting, retries on one side. Messages and tool results on the other. You can do that. You often do not need to.
If the thread is a list of events, you can infer waiting vs running from the last event. Session secrets still live outside the window. Almost everything else can be the log. Then you get serialization, replay, forking, and a UI for free, because the UI is just a rendering of the same events.
This is the same move as Twelve-Factor App processes: disposable, restartable, no hidden memory. The agent version is a thread id and an append-only event list.
Pause has to work between “I want this tool” and “I ran it”
Factor 6 is the API you wish every framework shipped. Launch, query, pause, resume, stop. Webhooks should be able to continue a thread without knowing the orchestrator’s internals.
The sharp edge, which Horthy flags and which I have hit: many orchestrators will pause a run, but not between tool selection and tool execution. That gap is the whole game for anything that sends money, mail, or a deploy. If you cannot freeze the JSON intent, show it to a human, and resume later, you either keep the process alive with sleep or you never give the agent the dangerous tool.
Reducer is a joke that is also the model
Factor 12 is marked “mostly for fun.” The picture is foldl: thread plus event equals new thread. The model is a stateless function over the current window. I would not build a religion out of it. I would use it as a check. If you cannot explain resume as “load events, project a window, ask for the next step,” the design still has hidden state.
What I actually keep
- Thread id is the unit of work. Events are the source of truth.
- Waiting is an event, not a thread stuck in RAM.
- Resume is load, project, step. Not “find the live process.”
Prev: the context window is an application interface. Next: human approval belongs before the side effect.