Inside Our Autonomous Software Factory: How AI Agents Write, Test and Ship Our Code A team of AI agents has spent two months building features for an in-house product on an assembly line in which a small Python program called fx holds each batch's state in files, picks the next agent and rejects any hand-back that breaks a rule, so no agent can advance a batch on its own. The system runs 16 roles — some agents on a strong model, some on a cheaper one, and some plain code — and in its first real batch a live check that signs in as each persona in a throwaway Docker copy of the app found the only two real bugs, which no test or code reviewer had caught, according to the team's account. The factory never merges its own work: fx ship merges the latest main branch, reruns every check and writes the pull request, and the owner confirms once. You hand it a few feature requests. Minutes later it hands back a pull request that has been planned, tested, reviewed and tried out by an agent playing your customer. What we learned running AI agents as an assembly line, told through one small made-up example: a loyalty card for a coffee chain. For two months, a team of AI agents has built the features of our in-house product. They work like a production line: each agent has one job, and its work gets checked before the next one starts. Our first version cost more to build than the product it shipped. The second one works, and it rests on one rule: A small Python program called fx keeps each batch's state in files, picks the next agent and refuses any hand-back that breaks a rule. Agents read, plan, code and review, but none of them can move a batch forward. Picture Brewline, a loyalty app for a coffee chain with three outlets. The owner wants three things, each written as a short story with numbered acceptance criteria. Hidden in it are a money question is a free coffee any size? , a time-zone trap when does a birthday start? and a privacy hole can outlet A see outlet B’s customers? . Watch where each gets caught. Sixteen roles work the line. Some are agents on a strong model, some on a cheaper one, and some are plain code that never makes a judgment call. One command starts it: /factory new loyalty S1 S2 S3. A cheap reader per story lists every spot where a builder would have to guess. The birthday reader asks: with servers on UTC, does a customer in Mumbai get the pastry at midnight or at 5:30 in the morning? S1 and S2 both touch RewardService, so fx builds them as one group. Planners read the code and outline a test for every criterion. The product lead never reads code, on purpose, because an agent that reads code tends to accept whatever it already does. It settles three questions from the spec and sends the two about money to a person. The critic tries to break each plan, with evidence. It finds that a refunded coffee keeps its stamp and that baristas would see all three outlets, both fixed before any test exists. Then the tests are written and run on today’s code. Each must fail, because a test that passes before the feature exists proves nothing. On approval, fx locks the nine tests, moves the Jira tickets and writes each answer back into the story file, so the spec stays the one source of truth. Anything that isn't money, rules, access or a surprise gets a default the owner can overturn. Each story gets a fresh builder, and risk picks its model: the birthday story gives away food, so it gets the stronger one. Gates check every commit the moment a builder says “done”. If a locked test was changed, or a test deleted or skipped, the work goes straight back to the same builder while it still remembers why. Reviewers only see code whose checks pass, and later rounds re-read only what changed. A reviewer can record anything, but to block it must bring proof that fx can verify: In round 2 every test passed and the code looked fine. One reviewer still failed it, because it doesn’t read code. fx starts a throwaway copy of the app in Docker, and an agent signs in as each persona and works through the criteria the way they would. It buys ten coffees. It asks for another outlet's numbers. Anything short of a pass blocks. This part is real. In our first real batch, the live check found the only two real bugs, and no test or code reviewer had caught either. That’s why it now runs in every round. fx ship merges in the latest main branch, reruns every check and writes the pull request: each criterion with its test and result, plus what got fixed and what's still open. The owner confirms once, and the factory never merges its own work. All of its state lives in files, so a crashed session or a closed laptop just means typing /factory next later. Afterwards a lessons agent proposes three lessons at most, like “a birthday is a local date, so test 00:30 and 23:30 India time.” The owner keeps the good ones, and the next batch reads them. Two things surprised us. A cheaper model saves only 17 to 40 percent, because most of what an agent reads comes from the cache, which costs about the same on both. And the biggest waste is reading the same thing twice, so nearly every saving came from agents reading less. Every agent run is logged with its tokens and tied to the group, story and round it worked on. We show tokens rather than dollars, so you can price them at whatever rate you pay. None of this replaces engineering judgment. It moves that judgment to the two moments that matter most: writing the spec before the work starts, and saying yes before it ships. Everything in between is a line we can measure, and we keep making it cheaper. Inside Our Autonomous Software Factory: How AI Agents Write, Test and Ship Our Code https://pub.towardsai.net/inside-our-autonomous-software-factory-how-ai-agents-write-test-and-ship-our-code-5261ae0d38a2 was originally published in Towards AI https://pub.towardsai.net on Medium, where people are continuing the conversation by highlighting and responding to this story.