How to Build a Multi-Agent Orchestrator from Scratch

I've been tearing apart the architectures of multi-agent orchestration tools like T3 Code and Orca lately.
Running models from different providers side by side feels great as a user. Once you put Claude Code and Codex at the same table, though, the hard parts have almost nothing to do with prompting. They are concrete systems engineering problems.
So I worked backward from a simple question:
If I were to build a multi-agent orchestration tool from scratch, what modules would I need from bottom to top, and what are the real engineering trade-offs in each layer?
Skip the boilerplate code. Here is the architecture from first principles, built around goals and trade-offs.
Orchestration Tools vs. Agent Harnesses
Before talking about architecture, we need to separate two concepts that get conflated constantly: Agent Harnesses & Orchestration Tools.
Official tools like Claude Code and Codex are native agent harnesses. They provide the execution environment (tool chains, prompt formatting, and agentic loops) around a model.
To get the most out of a model, its native harness is usually your best bet, because the model was post-trained specifically against that exact loop and tool format.
But wait, harnesses like OpenCode and DeepSeek Harness can also plug into multiple model providers to have different models share the same workspace. That still happens inside a single harness, where every model shares the same set of tools.
Tools like T3 Code and Orca sit a layer above. They are orchestration tools. They don't try to replace Claude Code or Codex underneath. They wrap those isolated, mutually unaware harnesses and turn them into a team. Running multiple models inside one harness is relatively straightforward. An orchestration tool exists to solve cross-harness collaboration.
The moment you put harnesses from different providers at the same table, four tightly linked engineering problems show up in order:
Step One: Letting the Model Know It Lives Inside an Orchestrator
The first job of an orchestrator is not scheduling. It is teaching the underlying model two things:
Today, there are two main ways to do this: MCP and CLI + Skill.
Each approach comes with clear trade-offs:
| Dimension | MCP (e.g., T3 Code) | CLI + Skill (e.g., Orca) |
|---|---|---|
| Call Reliability | High | Medium |
| Workflow Composition | Weak | Strong |
| Integration Cost | Medium | Very low |
| Context Overhead | Higher | Low |
The Core Problem: How Do Agents Talk to Each Other?
Once a model can invoke the orchestrator, the real architectural problem begins:
When Agent A wants Agent B to do a task or answer a question, how does that message actually deliver?
Agents never talk directly. The orchestrator is always the middleman. How you design that middle layer splits into two very different communication models: RPC Execution Trees (request/response delegation bound to a coordinator) and Persistent Mailbox Queues (an Actor model design with long-lived, addressable agents).
1. The T3 Code Style: RPC Execution Tree
The RPC model feels just like async function calling.
A coordinator agent calls a delegation tool, spawns a sub-worker, receives a thread handle, and moves on to other work while asynchronously waiting for the worker to finish and return its output.
The upside is simplicity. The orchestrator barely needs to manage intermediate runtime state.
The cracks show up as soon as collaboration gets non-trivial. Say a backend worker is halfway through writing code and doesn't know an API field in the spec. Because a pure RPC model is built around request/response return values, the sub-agent has to stop and surface the question back to the coordinator as a partial result. Even if the orchestrator supports resuming the same thread handle afterward, every back-and-forth still has to bounce through the coordinator as a fresh round-trip.
That creates two immediate bottlenecks:
2. The Orca Style: Persistent Mailbox Queue
The Mailbox model borrows from the Actor Model that every active agent is a real, persistent entity with its own inbox address.
Take that same blocked worker as example. Instead of tearing down and starting over, it sends a message addressed to the right teammate and suspends in place. The orchestration tool intercepts the message and checks the recipient's state. If the recipient is busy running tools, the message waits in the queue until that turn wraps up. Once the reply arrives, the orchestration tool wakes the suspended worker right where it left off.
This breaks free from ephemeral, call-and-dispose execution. You get true bidirectional async messaging and direct peer-to-peer communication between workers without bothering the coordinator. The trade-off is engineering weight: the orchestration tool now owns routing, queuing, suspension, and wake-up lifecycle management.
Interestingly, even third-party orchestrators, frontier native harnesses are converging on the Mailbox pattern in their multi-turn collaboration. The main difference is where the mailbox lives:
State Persistence & Fault Tolerance
Beneath interfaces and messaging sits state management and crash recovery.
Strip away the buzzwords and the baseline is simple: all of these tools persist runtime state in an external database or JSON files cooperating with locks. What differs is which stage of the failure lifecycle each pattern protects against. It's reliable dispatch before execution vs. stale-write isolation after execution.
Before dispatch, T3 Code focuses on reliable delivery. It is built as a multi-client synced control plane, so state consistency across clients comes first. The orchestrator has to both update database state and spawn local or remote agent processes. If the app crashes right after marking a task running in the DB before the process actually starts, you get a zombie task on restart.
T3 Code solves this with the Transactional Outbox pattern. State updates and pending dispatch commands are committed inside the same database transaction, and a background loop scans and executes them, keeping every connected client strictly in sync even after disconnects or crashes.
After dispatch, Orca focuses on parallel multi-terminal worktree scheduling to isolate stale workers. Suppose a task goes to Worker A, Worker A hangs, and the coordinator times it out and reassigns the task to Worker B. Minutes later, Worker A wakes up from the dead and overwrites Worker B's fresh output.
To close that hole, Orca splits the logical Task from each concrete Dispatch attempt. Every reassignment mints a new Dispatch ID. When a stale worker reports back with an expired ID, the orchestrator drops it on the floor.
These two patterns aren't competing alternatives, and a production orchestrator often needs both. Outbox retries can themselves produce duplicate dispatches, so fencing with a Dispatch ID is the natural second line of defense.
Context Handoff When Switching Models
One last design worth studying is T3 Code's Context Handoff.
If you use orchestration tools daily, you know this workflow
In a single thread, you use Codex for turns 1–3 to build the implementation 👉on turns 4–5 you switch to Claude Code to design a refactor👉on turn 6 you switch back to Codex to apply the changes.
The naive approach on turn 6 is to open a fresh Codex session and replay turns 1–5 from scratch. That hurts in two ways:
T3 Code solves this by splitting a conversation into two layers:
When you switch back to Codex on turn 6, the orchestration tool checks the table, sees Codex's native session is already synced through turn 3, and realizes it is only missing turns 4 and 5. So it reuses the original Codex native session and appends only the two missing turns as a delta. If you switch back to Claude Code on turn 7, the exact same thing happens.
Note: keep prompt cache TTL in mind (typically a few minutes to an hour depending on the provider).
Putting It All Together
Stack these four layers and you have the full skeleton of a multi-agent orchestration tool:
In the next article, we will explore other aspects of orchestration tools:
After the next article, you'll have everything you need to build a simple orchestrator from scratch. Follow along if you don't want to miss Part 2.
The next chapter of this technical series will be released tomorrow, talking about how to bring a orchestrator into real productivity.
Stay tuned, guys.






