Architecture · LikeC4
Gas City
Orchestration-builder SDK: a controller loop that reconciles desired config to running agents and drives formula bead-graphs to completion
The whole picture
System landscape
The system in context, then opened up into its containers.
Inside each box
Containers & components
Each part decomposed into the components that implement it. Every box links to its source in the interactive explorer.
Controller runtime — components
controllerContainerThe per-city reconciliation loop: config watch → reconcile sessions → pool scaling → wisp GC → order dispatch → graph dispatch. Implemented as functions in cmd/gc/, not a standalone package
Dispatch & graph execution — components
dispatchContainerSling kicks off a run (compile formula → materialize bead graph → route → nudge); the control dispatcher then drives the v2 graph to completion via control beads
Formulas & molecules — components
formulaContainerFormula = a written-down method (TOML). Compile → flat graph (v2) or molecule (v1 single-agent sequence). A formula is the method; the beads are the work
Bead store — interface & backends
beadsContainerThe work spine: everything is a bead (task, mail, session, convoy, molecule), differing only by type, behind one Store interface. The loop closes through this shared state, so work survives a crash on either side
Session & runtime providers — components
runtimeContainerStart/stop/prompt/observe sessions regardless of engine. The SDK manages session lifecycle; the prompt defines behavior — these concerns never cross
Config & packs — components
configContainercity.toml schema + progressive activation (Levels 0–8 by section presence) + multi-layer override resolution. Pack config IS the feature flag; the City is the local (root) pack
Orders & GitHub monitor — components
ordersContainerAn Order automates WHEN a formula runs: a trigger (cooldown/cron/condition/event/manual) paired with the formula to fire. Health Patrol is one kind of order
HTTP + SSE API — components
apiContainerEvery endpoint registered through Huma against annotated Go types → generated OpenAPI 3.1. The CLI and API are two typed projections over one canonical domain; long-running mutations return 202 + a request.result event
How it runs
Walkthrough flows
Dynamic views — the narrative spine of the system, step by step.
Walkthrough — one controller reconciliation tick
controllerTickEach tick (default 30s, or on config-dirty edge): reload config if changed, rebuild the desired agent set (pool scale_checks run in parallel), converge sessions, GC wisps, and dispatch due orders.
Walkthrough — sling a formula → graph drives to completion
slingFormulaSling kicks off the run; the control dispatcher then drives the v2 graph outside any session — gating, fanning out, retrying, and draining via control beads.
Walkthrough — an agent claims and works a bead
workBeadThe loop closes through shared bead-store state: the controller spawns sessions but reads progress from the store and event bus, which is why work survives a crash on either side.
Walkthrough — an order fires a formula
orderFiresAn Order automates WHEN a formula runs. Event-triggered orders read the event stream to decide; the same notifications humans watch can drive the fleet — no specific agent role required.
Explore it live
The figures above are static exports. The interactive explorer lets you pan, zoom, follow relationships, and jump from any box to the source.