What it takes to build a software factory: part 4 - when agents build the agent platform

What it takes to build a software factory: part 4 - when agents build the agent platform

Since June, we've merged about 3,700 pull requests into Easel. Almost all of them were written by agents. Most were opened under my name or a colleague's, because the agent was running on our laptops. Nearly 500 were opened by Easel itself.

I don't think that's remarkable any more. I'd argue that agents can write good-quality, correct code almost all the time. Where they go wrong is in their assumptions about everything around the code: what the system actually needs, what it allows, and what it will do when the change lands.

So how do you deal with that? The usual answer is tests and a staging environment, and we have both. But those approaches were built for the pace of people. A person makes a few changes a day and can wait a couple of hours to find out whether one worked. An agent can try dozens of ideas in that time. If each answer takes an hour or two, it's hugely inefficient, and the agent tends to stop testing its assumptions and start guessing.

An agent is only as good as its feedback loop, which means most of the work of building safely with agents isn't in the agent at all. It's in the loop: how quickly, and how accurately, the agent can find out whether it was right.

How we build

Day to day, a local agent writes the change and opens a pull request. It then has to get through AI review, a required set of CI checks, and a deploy to staging before it can reach production. Nothing revolutionary here.

Almost every article about agentic engineering says the same thing: code review is the new bottleneck. Agents write code faster than people can read it, so the review queue grows. We hit the same problem, and over time our answer was to move most of the checking from people to the system.

There were about three of us in the core team, but between October and mid-November we merged more than a thousand pull requests. Every PR from outside that group was reviewed by one of us. For a long time I also reviewed most of my teammates' PRs, until it became obvious that I was the bottleneck, and that reading the code wasn't where I added value.

We realised we weren't really reviewing the code. We were checking whether a change fitted where we were going: our direction, our architecture and the plans we'd agreed. Those are the things a person is best placed to judge. Whether the code was correct was a job for automated checks.

So the system checks the things we stopped checking ourselves. Does the change work? Required CI checks work out which parts of the platform each change touches and run the tests that apply, or all of them if they can't tell. Does it work for real? Every merge is deployed to staging as one complete release, and smoke tests exercise the platform before anything reaches production.

The smoke tests had one interesting wrinkle. Most of them need an agent to do something before we can check the result, and agents don't always do exactly what they're told. A test that depends on an agent behaving the same way every time is likely to be flaky. The answer came from the same thinking as part 2: don't rely on the agent. Give it as little to decide as possible, and check the result somewhere it can't change.

It's a common theme in agentic engineering that every finding from AI review should eventually become a deterministic check, and our experience agrees. AI review is good at spotting a problem the first time, but it might not spot it the second time. Where a problem kept coming up, we did two things: we told our agents the rule, and we added a check that enforces it. For example, our agents know where each kind of file belongs in the repository, and a check in CI fails any change that puts one somewhere else. The instructions mean agents usually get it right. The check means it doesn't matter when they don't.

With those guardrails in place, we merged a large share of our own PRs without a second human reviewer. It wasn't a traditional four-eyes process, and I'm not going to pretend otherwise. However, the approach is supported by results. Over the past couple of months, checks in the staging pipeline have stopped dozens of releases before they broke production. Since June, we've had two or three incidents that users noticed, and at least two of those came from infrastructure, such as a database upgrade, rather than a code change that any reviewer could have caught.

None of this is a blanket reason to skip reviews. It's a judgement about one internal platform, built by a small team, with the necessary guardrails in place.

The checks tell us whether a change is correct once it's written but it doesn't help an agent work out what the system needs in the first place. This is where agents actually go wrong. For that, we needed something faster.

The feedback loop

We found out how much faster when we tightened the network.

In part 2 of this series, I described how every agent's network access goes through a gateway that checks it against the run's policy. That's where we ended up, but getting there meant moving well over a hundred presets with real production usage, each having its own mix of tools, credentials and destinations, onto a restricted network, without breaking anything.

That's very difficult to simulate. Whether an agent can reach what it needs depends on real DNS, real gateway routes and real credentials, as well as all the small things a preset does that nobody has written down. The only way to know is to try it in a real environment.

We started the obvious way. Make a small change, open a PR, merge it, wait for staging, and see whether the smoke tests still passed. Each answer took over an hour. When the answer was 'no', we fixed it and went round again. Over a week or so we lost days of elapsed time, and staging broke a lot, sometimes blocking other changes that were also being deployed.

A better approach was to stop using the deploy pipeline to experiment. We built tools into Easel itself that let an agent compose a real sandbox in staging, with any combination of network policy, credentials and destinations, including variations no preset had ever used. The agent could launch a bespoke sandbox, test it from inside, and look at what the gateway allowed or refused, before throwing it away. These tools are now part of the same MCP interface our users' agents use, but enabled only in staging. We also gave our local coding agents scoped access to the staging part of our Kubernetes cluster, so they could check their theories against what was actually running. None of this gave the sandboxes anything new: they still had no direct route out.

Each answer now took less than five minutes instead of an hour or more. Our agents could stop making careful guesses, and start running experiments, often several at once.

We still started the production rollout cautiously: a few small, read-only presets at a time. Multiple PRs over two days got us to 27.

On Saturday, I changed approach. I left my agent working through the presets we still had to migrate, and went off to enjoy my weekend, checking in a couple of times to merge what it had found. By the end of the day, we'd moved another 31 presets to production. The agent had tested each one with numerous scenarios in staging first, so I had high confidence they'd work when deployed through the pipeline. On Monday we switched restricted networking on for everything at once, with a single change we could revert.

That's the part that matters. The agent on my laptop could ask the platform questions and get real answers in minutes. A change I'd normally have split into a dozen careful PRs went out in three, because each piece of it had already been checked against the real thing.

Presets with restricted networking enforced in production rose from 2 on 22 October to all 116 on 26 October, while staging probe sandboxes peaked at 101 on Saturday 24 October.

So what does it take?

Give agents a way to check their work against reality, and make it fast.

Most of what made the network change safe wasn't clever. It was making the answer to "did that work?" achievable in minutes instead of hours, using a real environment instead of a guess.

It's also why our review looks the way it does. Once fast checks against a real environment can tell you whether a change works, a person's attention is better spent on whether it's the right change. That's what I still read pull requests for.

This is part 4 of a series:

  1. Starting with a toy
  2. Access without trust
  3. How do you know it's any good?
  4. When agents build the agent platform (this post)