No barriers
Execution wakes on asyncio.wait(FIRST_COMPLETED) — the planner runs
after each durable completion while siblings are still active. No wave-wide
synchronization, no waiting for the slowest branch before reacting.
LoopKernel is an agentic AI runtime built as a dynamically patched task graph.
The planner wakes on the first durable completion — while sibling tasks are still
running — and mutates the graph with one auditable GraphPatch at a time.
// the one-sentence version
A dynamically patched task graph whose materialized SQLite state is paired with a durable outcome-and-patch journal — replanned one completion at a time. No supersteps. No shared-state barriers. Every decision journaled.
// architecture
Execution wakes on asyncio.wait(FIRST_COMPLETED) — the planner runs
after each durable completion while siblings are still active. No wave-wide
synchronization, no waiting for the slowest branch before reacting.
Per-run topology isn't compiled up front — it emerges. For each event the planner
returns a GraphPatch: add · connect ·
cancel · wait · resume · finish.
The store rejects duplicate IDs, invalid transitions, and cycles.
Results stay attached to the task that produced them. Tasks marked
evidence_scope: "ancestors" see only their transitive graph ancestors —
so a cancelled speculation can never leak into the final answer.
SQLite materializes runs, nodes, and edges alongside ordered events and idempotent patch records. On resume, terminal events without a patch are replayed and planned exactly once. Finished work stays finished.
// capabilities
Behaviors most graph frameworks leave to workflow authors are built into the runtime and tested there.
speculation
Run three researchers; when two stable winners land, the loser is durably cancelled — while still running — and its late result is discarded.
hitl
A pending node enters WAITING; the executor exits cleanly. A trusted
external event applies a resume patch — no node restarts, no re-run side
effects.
control flow
A deterministic planner drives routing. An opt-in LLM planner may propose patches — strictly parsed, allowlisted roles only, deterministic fallback on invalid output.
memory
Typed, bounded evidence with source attribution. User facts keep their
SourceRef; external pages are never represented as user statements.
authority
Every task's skill must resolve in the worker registry. The graph can grow dynamically, but the authority surface stays closed.
credentials
All model access flows through a separate gateway. The runtime never owns provider credentials — a tested boundary, not a convention.
// the loop
The planner receives (snapshot, event) and emits the
next graph mutation. Each patch is idempotent and journaled against its triggering
event — replay-safe by construction.
# event → planner → patch (illustrative trace)
event task_completed plan_0
patch add spec_1 spec_2 spec_3
connect plan_0 → spec_*
event task_completed spec_2 # siblings still running
patch wait
event task_completed spec_1 # quorum 2/2
patch add distill
connect spec_1 spec_2 → distill
cancel spec_3 # in flight
event task_completed distill
patch finish
Illustrative trace of LoopKernel's patch semantics — public API docs are on the way.
// positioning
The two runtimes solve the same broad problem and make substantially different architectural choices. The honest version, side by side:
| Dimension | LangGraph | LoopKernel |
|---|---|---|
| Execution | Pregel supersteps — updates visible at the next barrier | Replans on first completion, siblings still active |
| Topology | Compiled StateGraph with runtime routing | Emergent — planner patches the graph per event |
| History | Checkpointed shared-state snapshots | Materialized state + outcome/patch journal |