Smaller rooms: why we fenced our supplier code for AI agents

By , About 4 minutes Part 1 of 2 Engineering

At Flyett we build a travel platform with a small team and a lot of AI coding agents. On a busy day, nine of them work in the same repository. That changes what good architecture is for.

The problem

Our API grew to 1.4 million lines of TypeScript across 153 modules. Supplier integrations, the code that talks to airline, hotel and holiday suppliers, lived inside it, next to booking, pricing and payments.

58.6%of commits that changed a supplier adapter also changed core or web code
1 in 5commits touched three or more product areas

Some of that was real feature work. Much of it was an agent doing what agents do: fix the supplier bug, then tidy a shared helper, then adjust a pricing type so everything compiles. Each step looks reasonable. Together they make a diff nobody asked for, in code that moves money.

Measured over 1,879 code commits, 14 March to 13 November 2026. “Changed” means a file was edited, not that something broke.

None of this pattern is new

Zapier, Airbyte and Segment run every integration as its own package on a shared SDK. Duffel puts one model over many airlines. Shopify built packwerk to fence a monolith. Plenty of people now argue that modular monoliths suit agents.

Two things are different for us. Our fastest contributors are agents, not teams. And our integrations are deep: a Zapier action is one API call, while a booking is search, re-price, hold, book, ticket, change, cancel and refund, with money at every step.

What we did

  1. A small provider SDK. The core defines the contract: search, price, hold, book, cancel, and a shared set of errors. Each supplier is its own package that implements it, and depends only on the SDK and shared helpers, never on the API.
  2. Tests that live with the package. Each package carries its own specs, including replays of real supplier replies with personal data scrubbed. An agent proves its change in seconds instead of type-checking 1.4 million lines. 141 spec files moved with the code.
  3. Fences in CI, not in the prompt. Every change starts from a ticket. The merge check maps changed files to areas and blocks anything that reaches outside the assigned areas or the declared scope. An instruction file can ask an agent to stay in its lane. Only CI can make it.
  4. Split by direction of money. Buying from a supplier and selling to a customer are separate packages. A change to what we sell for can't quietly change what we pay.

What it cost

The split broke local dev twice in its first week, because packages weren’t built before the API started. Build order now matters. Agents work in separate git worktrees that share dependencies, which needed tooling fixes. More packages also means more configuration to keep consistent.

The lesson so far

Agents don’t need less freedom. They need smaller rooms.

A package with a clear contract and fast tests is a room an agent can hold in its head and leave tidy.

The classic reasons for modules were teams and deployments. Ours is review attention. When every change maps to a ticket, an area and a declared scope, I review intent, not a 40-file diff.

Part 2

The split landed this week, so these are before numbers only. In about six weeks I’ll publish the after numbers: how many supplier changes stay inside one package, how many merges the check blocked, and what happened to test time. If it didn’t help, I’ll say so.

Further reading