I Broke Up the Monolith: One Router, Many Workers

The thing that can publish a blog post should not be the same thing that can move money. So I broke my AI back office into a couple dozen small workers — a router in front, least privilege by wiring, and a second model from a different lab checking the first.

I Broke Up the Monolith: One Router, Many Workers

I built the AI that runs my back office as one big program. It read the knowledge base, checked the bank feed, updated the CRM, filed tasks, wrote the drafts, sent the mail. One worker, one set of keys, one brain that knew how to do everything. It worked, and that was exactly the problem.

A monolith is a single blast radius. One bug, one leaked key, one confused model, and the thing that can publish a blog post is the same thing that can move money. So I broke it apart. One careful program became a couple dozen small, single-purpose ones, with a router in front that decides who does the work — that is why I rebuilt it. This is the write-up of how it actually works, minus the parts that would bore you and the parts I would rather not hand to an attacker.

The tool chooser

Every request hits a router first. Before any real work happens, a small, fast model reads the message and does one narrow job: it names the specific tools the request actually needs — not the answer, just the shopping list. "What did I spend on fuel last month" becomes banking. "Add a note to that contact and remind me Friday" becomes CRM plus tasks. It is deliberately the cheapest model in the building, because classification is a different job than reasoning and paying reasoning prices for it is a waste.

The router looks each tool up in a registry, finds the worker that owns it, and dispatches. When a request needs more than one, it breaks the request into those pieces, runs them, and reassembles the results into a single answer. The important part is what the router does not do: it does not carry the keys, it does not do the work, and it does not get the last word. It is a switchboard, not a mind.

The hands: what it actually talks to

Each capability lives behind its own worker, and each worker owns exactly one integration. Banking runs through Plaid, read-only — it can see transactions, it cannot ever move a dollar. Payments and products run through Stripe. The CRM and the messaging run through GoHighLevel. Publishing runs through Ghost. Mail runs through Microsoft 365. The structured data, the tool registry, and the long-term memory live in Supabase. Live web lookups go through Perplexity. And the grounding corpus — the verified, searchable memory the whole system reasons against — is its own service, so no single worker holds the knowledge; they all ask for it.

Limiting the third parties

Here is the security win that comes for free with breaking things up: each worker holds only the keys it needs, and nothing else. The worker that publishes a post has no idea the bank feed exists. The worker that reads transactions has no write scope at all. Least privilege stops being a policy you enforce and becomes a fact of the wiring.

On top of that, the third-party access itself is scoped as tightly as each vendor allows. Financial access is read-only. CRM keys are scoped per account rather than one master key for everything. And no key is ever written into a worker's code — every secret is pulled at run time from a vault, behind an internal gate, and the gate fails closed: if a worker cannot prove it is allowed to ask, it gets nothing and stops, rather than falling open and guessing. The front door — the human asking — is checked with a signed token. The back doors between workers are checked with an internal secret. A request cannot walk in and drive a worker directly.

Where all of this lives

There is no server. The whole thing runs at the edge on Cloudflare Workers — each worker its own small deployment, on its own address, spun up on demand and gone when it is idle. The inference runs at the edge too, on Cloudflare's Workers AI, which matters more than it sounds: the models sit next to the code and the data instead of a round trip away, so most of the system never phones a far-off API at all. The corpus is vector search at the edge; the fast caches are edge key-value. Nothing to patch at 3 a.m., nothing to wake up.

How they check each other

Every worker that produces something consequential follows the same contract: generate, check, and gate. A model drafts the answer. Deterministic code runs the checks that do not need a model at all — is this a real code, does this number reconcile, does this field validate. Then a second model, from a different lab entirely, is handed the draft and the evidence and asked one question: does this hold up? If the reviewer disputes it, or the confidence is thin, the answer does not ship — it is flagged for a human. The rule underneath all of it is the one I keep coming back to: the author never grades its own work.

What models, and why so many

There is no single model doing everything, on purpose. The work is routed by task. A small Llama handles classification and extraction. Planning and long-form writing lean on larger Llama and Qwen models. Generation for the careful domains uses Z.ai's GLM; the independent verifier for those is almost always OpenAI's gpt-oss, and where the check is math-heavy it falls to a DeepSeek reasoning model. Reconciliation — the highest-stakes merges — is where the frontier models earn their keep, Claude among them. Live web grounding is Perplexity's Sonar. Every one of those runs behind a fallback, so if a model is empty or down, the next one in the chain answers.

The spread is not showing off. It is the whole point. When the model that writes an answer and the model that checks it come from two different labs, a shared blind spot has to survive two different training runs, two different companies, and a deterministic gate in between. One vendor being confidently wrong is no longer enough to ship a mistake.

Why bother

The monolith took an afternoon and I did not trust it. The mesh is more moving parts, more wiring, more discipline — and I sleep better, because every piece can only do its one job, has to show its work, and has to get a second opinion from someone who does not share its incentives. Break the task into small pieces; keep each piece on a short leash; let a second, independent judge check the first; and keep a human on the calls that carry weight. It is the same idea I build everything on, pointed this time at my own house.