All posts
Engineering

Inside the AI Manager — sub-agents, not suggestions

Yisha Hadad · Founder, Brainerce
··2 min read
Inside the AI Manager — sub-agents, not suggestions

When a merchant types "Set 20% off all sunglasses for 48 hours" into the dashboard, three things have to happen, in this order:

  1. The sentence has to be parsed into an intent — what kind of operation is this?
  2. The intent has to be turned into a concrete plan — which products, which discount, which dates, which API calls?
  3. The plan has to actually run, transactionally, with proof that it ran.

Most "AI commerce" stops at step 1. We don't.

Two-stage planning

Internally, every user message goes through two LLM calls:

  • Decomposer (small, fast) — classifies the request into a task family: catalog edit, marketing campaign, customer outreach, analytics question.
  • Router (small, fast) — picks the right sub-agent for that family, and hands over a structured payload.

We use small models here on purpose. Decomposing is a classification problem, not a reasoning problem — Haiku-class models do it perfectly and the latency is sub-second.

19 sub-agents

Each sub-agent owns a slice of the platform and knows exactly which tools it can call. The campaign sub-agent can list products, apply coupons, and schedule flash sales — but it can't refund an order. The order sub-agent can refund and re-ship, but can't change a product's price. Permissions are baked into the agent prompts and enforced at the tool layer.

This isolation matters for two reasons:

  • Safety. A campaign-related hallucination cannot accidentally delete a customer.
  • Quality. Each sub-agent gets ~5 worked examples that are exactly on its slice. The result is much higher tool-call accuracy than a giant generalist prompt.

Zero-trace runtime

The interesting bit: every operation runs through a mutation ledger and a side-effect interceptor. During development we can replay 1,000 scenarios against a live store without sending a real email, charging a real card, or mutating real inventory.

Production runs unwind the ledger and actually commit. Test runs roll it back. Same code path, different observer.

This is how we can ship AI features confidently against a database that has real customer data in it.

What's next

We're working on a Growth Analyst sub-agent that surfaces high-ROI actions (bundle this with that, raise this price by 8%, retire this SKU) and executes them in one click. The first preview is rolling out to a small group this month.

If you want in, drop us a note.