---
title: "How to build an agent factory: the loop, stage by stage"
url: "https://xubris.com/blog/how-to-build-an-agent-factory"
description: "An agent factory is the old development cycle closed into a loop. Eight stages, what breaks without each, and the order a young company should build them in."
---

# How to build an agent factory: the loop, stage by stage

November 6, 2026·8 min read·Editorial team

Five people around a round table in a 1980s office pass a green folder from hand to hand past a green-screen terminal, a printer and a black cube computer, a woman in a magenta jacket holding a pen

An agent factory is not a faster version of the old software development cycle. It is the same cycle closed into a loop, in which every stage leaves a record and people move from doing the work to three decisions: they approve the specification, confirm the verification and agree to the release. Agents prepare everything in between. A team that copies its old process one to one, with an agent where a developer used to be, gets more code and not a better product.

A young company has one advantage here. It has no old process to copy. The loop can be the way it works from the first month, before habits harden around a chat window on somebody’s laptop. That is the case we have in mind below.

## The old cycle in one paragraph

The classic software development lifecycle (SDLC) is a relay of people. An analyst gathers requirements, an architect designs, a developer writes, another developer reviews, a tester tests, an administrator deploys, somebody watches the monitoring. Between each pair there is a hand-off: a document, a ticket, a conversation in the corridor. The knowledge of why something was done this way lives mostly in heads, and leaves with them.

That model worked because the most expensive resource was a developer’s time. In an agent factory execution becomes the cheap part and human attention becomes the expensive one. That reverses the logic of the whole cycle.

## The loop in eight stages

```
  ┌───────────────────────────────────────────────────────────────┐
  │                                                               │
  ▼                                                               │
1. INTAKE ──► 2. TRIAGE ──► 3. SPEC ──► 4. EXECUTION ──► 5. REVIEW
 issue, idea,   sort,         product     the change       first pass
 alert          reproduce     and tech                     in a sandbox
                              [PERSON                           │
                               approves]                        ▼
  8. MONITORING ◄── 7. RELEASE ◄──────────────────── 6. VERIFICATION
  product runs,      [PERSON                           agent walks the
  new issues         agrees]                           user's path,
  appear                                               records proof
                                                       [PERSON confirms]
```

Above the loop sits a coordinator, a foreman. It is an agent that receives a trigger (an issue, a chat message, an alert, a command from a laptop), decides which stage the work is at and starts the right agent with the right model and context. A cheap model for sorting. A strong one for writing the specification. For review, whichever did best on your own tests.

### 1\. Intake: work arrives in one place

An idea, a bug report, an alert or a request from a chat lands in one queue. A factory that work enters through six doors does not know what is on its table, and cannot measure throughput or cost. Without it, half the agents’ work happens outside the loop, on laptops, with no trail.

### 2\. Triage: the cheapest saving in the loop

An agent reads the issue, tries to reproduce it and puts it in one of three bins: ready to execute (a small, clear defect), unclear and needing a specification (a feature, a requirement that can be read three ways), or parked and needing a person (missing data, a business decision). Sorting and first diagnosis used to eat the hours of the most experienced people. Without triage, the execution agent gets vague tasks and produces a lot of code that solves the wrong problem.

### 3\. Specification: where the quality of the loop is decided

For unclear tasks an agent drafts two documents. A product specification says what the user will see and do from start to finish. A technical one says how the change fits the existing architecture. A person reads both, corrects them and approves them before a line of code exists. This is the control point with the most leverage in the factory: changing a sentence costs a minute, changing the same decision in a finished change costs a day. Without it, review turns into archaeology.

### 4\. Execution: the least interesting stage

An execution agent takes a triaged issue or an approved specification and prepares the change. If intake, triage and specification work, this is the most predictable part of the loop. Everyone wants to start here, because this is where the effect is visible. That is the mistake. A fast agent writing code for issues nobody sorted or specified leaves people rejecting changes instead of approving them.

### 5\. Review: the stage that learns

A review agent goes over every change before a person sees it. It works in a sandbox with the code, so it can run a suggested fix before leaving the comment, and it has both specifications in front of it, so it judges the change against the intent and not only the style. A second agent watches the comments people leave in their own reviews and from time to time proposes a change to the reviewer’s instructions. That proposal is an ordinary change, approved by a person. The team’s conventions do not need to be written up front. They accumulate. Without this stage people repeat the same five comments every week.

### 6\. Verification: a person confirms instead of chasing

An agent gets a machine, starts the application and walks the user’s path from start to finish, the way a tester would, and attaches screenshots or a recording to the change. Separately it checks that what was built matches the specification it started from. Automated tests check what someone foresaw. A live walk catches what nobody did: a button hidden behind a notice, a form that works but cannot be filled in on a phone. The person watches a two-minute recording and says yes or no.

### 7\. Release: the decision that stays with a person

A person accepts the change and releases it. Release is the moment risk moves from the team to the customers, and somebody has to sign for it. For the companies we build this matters twice: a release that breaks the export or changes what a customer can take away is a change to the [promise in the contract](https://xubris.com/blog/the-customer-contract-is-a-product), not only to the code.

### 8\. Monitoring: the loop closes

An agent watches the product in use, catches failures and odd behaviour, and opens an issue that goes back to stage one. A whole run can pass without a person until approval: monitoring sees a failure, triage reproduces it, execution prepares a fix, review and verification check it, and in the morning somebody finds a ready change with a recording. Without this stage the factory is an assembly line. With it, the product reports what needs fixing.

## The second loop: the factory improves the factory

Above the product loop runs a quieter one. An observer agent scores every run: what it cost, how many times a person had to correct something, whether the change came back later as a defect. From that it proposes changes to the factory itself: another model at triage, a sharper specification instruction, a new skill for the reviewer.

To make that safe, the factory definition has to be code. Versioned, with a way to undo a bad change, to try a new version on part of the work and to compare results on a fixed set of test tasks. A change to the factory goes the same way as a change to the product: proposal, review, a person’s approval. A factory that rewrites its own instructions without consent does things nobody understands within three months. This is also why [who owns your agent factory](https://xubris.com/blog/who-owns-your-agent-factory) matters: the second loop only works on a definition you hold.

## The old cycle and the factory

Dimension

Old development cycle

Agent factory

Shape

a relay of hand-offs between people

a loop: monitoring feeds new issues

Where a person looks

at finished code

at the specification before code and the recording after verification

Most expensive resource

developer time

human attention at decision points

Team knowledge

in heads and an outdated wiki

in agent instructions, versioned with the code

Testing

tests written up front plus manual clicking

tests plus a live walk with a recording, checked against the specification

Improving the process

a retrospective once a sprint

a score for every run and proposed changes to the factory

Work in progress

private, on a developer’s machine

visible to the team, in the factory’s queue

Accountability for release

a person

still a person

The last row is the one that matters. Requirements, architecture, approval of the specification and the decision to release stay with people. Everything in between changes.

## Where the factory does harm

**Executing tasks that only look simple.** “Bump the library version” sounds like work for an agent, until the new version changes how rounding works in the invoicing module. Start where a mistake is cheap and shows at once: small interface defects, obvious failures, updates that change no behaviour.

**Skipping the specification because the agent writes fast.** Fast writing without an approved specification is the most expensive way to discover that everyone understood the task differently.

**Self-improvement without a brake.** A change to the factory without a person’s approval is drift, not progress.

**A factory without people.** A team told the factory will replace it leaves before the factory works. People who like hard system problems tend to like building the factory most, if they get it as more responsibility rather than as a verdict. In a company of five, that is everyone.

## How you know the factory works

Vanity metric

Outcome metric

lines of code written by agents

how many times a person touched one change from issue to release, and whether that falls

tokens used

the cost of one closed change and its month-to-month trend

number of agents running

the share of issues that went through the loop with no correction after approval

“agents write most of our code”

lead time for changes, deployment frequency, change failure rate and time to restore service (the four DORA measures)

Scoring by a second model can be added, but only as a supplement. If corrections after release are rising, no model’s score will cover the fact that the factory is producing worse work.

## The order to build it in

Each step gives a working system. You can stop after any of them and still have something useful.

1.  **Triage.** An agent sorts incoming issues into the three bins and drafts a first change for the small, well-described defects. Issues arrive sorted, and people stop spending hours labelling.
2.  **Specifications.** For unclear work an agent drafts the product and technical specification, and a person approves them before execution. Larger features enter the factory instead of waiting.
3.  **Review with a learning loop.** A sandboxed agent reviews every change, and a second one turns people’s comments into proposed changes to the reviewer’s instructions.
4.  **Live verification.** An agent walks the user’s path, records proof and compares the result with the specification. People confirm instead of chasing.
5.  **Connection and measurement.** The foreman links the stages, monitoring feeds intake and the observer scores runs. Only now does the second loop start.

The same order works outside engineering. Intake, triage, a brief, a draft, a check against the contract and the brand, a person’s approval, release, measurement: that is a factory for renewals or for support, as [agent factories will not stay in the engineering team](https://xubris.com/blog/agent-factories-will-not-stay-in-engineering) argues.

One thing to do this week: take the last twenty issues from your tracker and sort them by hand, in a spreadsheet, into the three triage bins. If more than half land in “unclear”, the first agent in your factory should not be the one that writes code. It should be the one that writes specifications.

That leaves the decision. You can give the team an agent that writes code faster and watch the review queue grow. Or you can build a loop in which people stop writing and reviewing everything, and start approving the things that actually need their judgement.

-   AI agents
-   agent factory
-   software development
-   DORA
-   building companies

## Keep reading

-   [Attacks got cheap the same way software did](https://xubris.com/blog/attacks-got-cheap-the-same-way-software-did)
-   [Who owns your agent factory?](https://xubris.com/blog/who-owns-your-agent-factory)