Multi-Agent Orchestration Architecture: Replacing Fragile Call Chains with a Persistent Kanban
This article breaks down a multi-agent coordination architecture built around a locally persisted kanban board. Instead of relying on direct messaging between agents, the design converges all task state into a single source of truth and uses periodic scheduling with atomic claiming to hand work off. You will see why traditional master-slave invocation breaks down over long task chains, how the three-layer separation of control, state, and execution layers works, and the practical rules for state machines, task granularity, lease tuning, idempotency, and observability. It is a practical reference for teams building long-running, recoverable automation workflows.
Introduction: Why Multi-Agent Collaboration Turns Into a “Sham Operation”
When building automated task systems, developers often try to split work across multiple agents: one decomposes requirements, one retrieves reference material, and one writes and validates code. Once the task chain gets longer, however, this approach tends to degrade quickly—process crashes wipe out context, task states overwrite each other, and a single stuck step stalls the entire pipeline. The root cause is usually not model capability but the design of the coordination substrate.
This article discusses a multi-agent coordination architecture centered on a locally persisted kanban board. It does not depend on direct communication between agents. Instead, it converges task state into a single data source and completes handoffs through periodic scheduling and atomic claiming. The approach offers direct reference value for teams that want to build long-running, recoverable automation flows.
1. The Core Problem: Why Fragile Master-Slave Invocation Is Not Sustainable
The typical form of master-slave collaboration is this: a controller process invokes sub-agents in sequence, and the return value of each sub-agent determines the next step. It is intuitive enough in demos, but it has three structural flaws.
First, state lives in memory. Once the process exits, task progress, completed items, and pending items all evaporate, and recovery depends on manually rebuilding from logs.
Second, handoffs are synchronously blocking. If the upstream does not return, the downstream cannot start. This makes it impossible to use multi-core and multi-machine resources, or to let roles with different rhythms advance in parallel.
Third, there is no arbitration mechanism. When multiple executors modify the same artifact at the same time, there is no accepted “source of truth,” and conflicts can only be resolved by convention, which spirals out of control as scale grows.
So the direction for improvement is not to make the call chain more complex, but to replace “call relationships” with “shared state plus asynchronous consumption.”
2. Architecture Overview: Three Layers With Decoupled Responsibilities
The architecture is divided into three layers, and layers interact only through explicit contracts.
- Control layer: Facing users, it provides two entry points—a command line and a chat gateway—and is responsible for issuing instructions, querying progress, and intervening in abnormal tasks. It does not participate in business computation.
- State layer: The single source of truth of the system. A local embedded database file carries all tasks, locks, and artifact indexes, along with a low-frequency periodic scheduler.
- Execution layer: Composed of several mutually isolated profile processes. Each role has its own scratch area or code worktree, and they do not intrude on one another.
The key constraint is that execution-layer processes never communicate directly. All handoffs manifest as reads and writes to state-layer records. This constraint may seem strict, but it yields three engineering benefits: replayability, auditability, and horizontal scalability.
3. State Layer Design: A Single Source of Truth and Lock-Free Scheduling
The state layer is best built on an embedded relational database that supports write-ahead logging (WAL). The value of WAL is read-write concurrency: while the scheduler writes state, execution processes can still read task details without waiting on each other.
The data model can be abstracted into three core tables:
-- Task table: records lifecycle and state machineCREATE TABLE task (id INTEGER PRIMARY KEY,title TEXT NOT NULL,spec TEXT, -- acceptance criteria and constraintsstatus TEXT NOT NULL, -- queued / running / blocked / doneowner TEXT, -- current claimer identifierlease_until INTEGER, -- lease expiration timestampattempt INTEGER DEFAULT 0,updated_at INTEGER NOT NULL);-- Handoff and artifact table: replaces direct messages between agentsCREATE TABLE artifact (id INTEGER PRIMARY KEY,task_id INTEGER NOT NULL,kind TEXT, -- note / patch / reportpath TEXT, -- relative path in scratch area or worktreecreated INTEGER NOT NULL);
Keeping the scheduler “brainless” is a deliberate design. It runs once every 60 seconds and does only three things: recompute the set of executable tasks based on dependencies and the state machine; claim a task with a single atomic update statement and write a lease; and launch the corresponding execution process. The pseudocode is as follows:
while True:recompute_status() # refresh status based on dependencies and blocking flagsrow = db.execute("""UPDATE task SET status='running', owner=?, lease_until=?WHERE id = (SELECT id FROM taskWHERE status='queued' AND (blocked_by IS NULL OR blocked_by=0)ORDER BY priority DESC, id LIMIT 1)RETURNING id, spec;""", (worker_id, now() + 120)).fetchone()if row:spawn_profile(row.id, row.spec) # launch the isolated execution processsleep(60)
Atomicity is guaranteed by a single UPDATE … RETURNING: among multiple concurrent scheduler instances, only one can successfully rewrite the same row, and the rest read an empty result, which naturally avoids duplicate execution.
The lease mechanism solves the “process half-death” problem. Executors must renew before the lease expires; if a process crashes without renewing, the scheduler rolls its status back to queued in the next round and increments attempt, so the task is automatically rescheduled. This is simpler than relying on a heartbeat thread and does not misjudge due to thread blocking.
4. Execution Layer Design: Isolated Profiles and Artifact-Based Handoffs
Each role runs in an independent profile with its own working directory. Research roles accumulate investigation notes in the scratch area, engineering roles modify files in an independent code worktree, and long-term assistant roles maintain preference and memory files across tasks. Isolation brings two direct benefits: artifact paths do not conflict, and rollback granularity is clear.
Handoffs are not done through message passing but by writing artifact records and updating task status. After the downstream is awakened, it reads the artifact path and continues working, with the whole process leaving a trace:
Example of task T-102 status transitionsqueued --(claimed by scheduler)--> running(researcher)running --write artifact(note) + set blocked--> blockedblocked --dependencies satisfied, recomputed to queued--> queuedqueued --(claimed by scheduler)--> running(engineer)running --write artifact(patch) + validation passed--> done
If cloud capabilities need to be introduced, general categories can be chosen: object storage for large artifacts, a message queue for cross-machine wakeup, a container platform for isolated execution environments, and logging services plus monitoring and alerting to observe lease timeout rates and task backlogs. These are all industry-standard capabilities and do not create a dependency on any specific product.
5. Engineering Practice Essentials
- Keep the state machine explicit and convergent. It is recommended to retain only the four states queued, running, blocked, and done, and encode complex branches into dependency fields rather than expanding the state enum endlessly.
- Keep task granularity verifiable. Every task should carry machine-decidable acceptance criteria; otherwise, the semantics of done degrade into subjective judgment.
- Match the scheduling period with the lease. Too short a period causes idle spinning, while too long a period slows failure recovery; the lease is usually a multiple of the period, leaving headroom for renewal.
- Prioritize idempotency. Execution logic should allow reruns, and writing artifacts should use deterministically named temporary files followed by an atomic rename, so that half-finished products are not read by the downstream.
- Build in observability. At a minimum, record the number of claim failures, lease timeouts, retries, and blocking durations, to locate the real bottleneck role.
Conclusion
The stability of a multi-agent system depends on whether state has a single authoritative source, whether handoffs are replayable, and whether failures can converge automatically. Building a kanban on a local embedded database, driving execution with low-frequency atomic scheduling, and carrying heterogeneous roles with isolated profiles—this combination restores “coordination” from fragile process calls to a manageable data flow. For developers who want to keep full control in a local environment and reject bloated control panels, this is a pragmatic and easy-to-implement path.
