Control at both ends: how our AI agents ship code that moves money

VG
Vincent Gonod
November 23, 202610 min approx.

We stopped reading our fintech code line by line. In October, our tech team merged 2,373 pull requests. The nine people on our fintech team merged 932 of them, up from 122 in April. We run 10 projects at the same time. We used to run 2 a quarter, and they were smaller.

Part of this code moves money. It computes the VAT on a client invoice and decides when a supplier gets paid. One cent matters here. Our clients recompute the VAT on each invoice from its base and its rate, and a gap of one cent is enough to send the invoice back.

At this volume, no human reads every line. So we moved control to both ends of the money flow. At the entry, we capture the facts before anyone invoices. For example, the legal identity of a client comes from a company registry. At the exit, a checker reads every invoice before it goes out. An AI reads the PDF the way the client will, and a failed check blocks the invoice. In between, a list of business scenarios with real amounts proves each change to the code.

This article shows the real questions, scenarios and checks we use, and where we got it wrong.

Our review queue broke first

For years, code review had one shape. A human wrote the PR, another human reviewed it, then it went to production. Then agents started writing the code. The agent writes in one hour what took a day. The reviewer still reads at the old speed. Most teams call this AI-native. It is the old process with a faster typist.

Three stages of code review: human writes and reviews, agent writes and human reviews, then business scenarios, agents, machine checks and a human when it matters
Three stages of code review. Naboo fintech runs stage 3 today.

We were there in September. Our rule was simple: a fintech PR gets its first review within 4.5 working hours. On Monday 28 September, I counted the fintech PRs past that deadline. There were 19. Almost every fintech PR touches money, so almost every PR went to the same few senior reviewers.

Adding reviewers would not scale. So we asked what a human review is for. Our answer had two parts: it checks the code, and it passes knowledge from one engineer to the next. Machines can check code if we give them precise questions and real proof. Knowledge still needs people. So in our third stage, agents write and check the code, and the human review keeps one job: passing knowledge.

Agents follow the rules that fail the build

Agents follow the rules that CI enforces. They ignore the rules that live only in someone's head. So the first work was on the architecture.

Our financial code and our booking code had grown into each other. The tech leads decided to isolate fintech, module by module. Each financial module (payments, fees, exchange rates, invoicing, ledger, card processing) gets a closed boundary and one documented entry point. The goal is a module that you can test with a sheet of numbers.

Our staff engineer in fintech wrote lint rules, first as warnings, then as errors. Today, in each isolated module, a PR that crosses the boundary fails CI, whoever wrote it.

We then turned the private tricks of our power users into shared skills, in one plugin that every engineer installs.

The proof goes in the ticket

Take the VAT rounding on our client invoices. Our discovery skill found 7 ways our invoice and the client's own sum can differ by a cent. Its research agents showed that Odoo, Stripe and Dolibarr, in one of its modes, round the VAT once per rate. On 22 October, tech, product and finance chose the rule in a single meeting.

Then the rule becomes proof. Before an agent writes a line, the ticket carries its harness: business scenarios with real amounts, each marked as blocking the release or not. One scenario from the rounding harness:

GivenWhenThenBlocks release
Three pens at EUR 19.99 excl. VAT, VAT 20 %Generate the client invoiceVAT EUR 11.99, total EUR 71.96yes

Round the VAT of each pen and you get 4.00 × 3 = 12.00. Round the VAT of the total once and you get 11.99. An agent will code either rule and write green tests for it. Only the business knows that our clients check 11.99.

So the engineers write the harness with the business. On money, it also covers the cases that hurt: a payment that runs twice, or a payment with no funds behind it. Every bug we fix becomes a new scenario. A ticket with no harness gets no code: the agent stops and asks its owner. The rounding rule went live on 5 November, eleven days ahead of plan, and agents wrote most of the code.

Machines attack what you cannot undo

On money, the worst bugs are the ones you cannot undo: a payout sent twice, a wire to the wrong partner, a write to a bank with no rollback. Our machine checks start from those.

On the money path, a second agent tries to break the change. It did not write the code, so it has no reason to trust it. It starts from the scenarios in the ticket and lists what can go wrong with the money. What happens if the same payout request arrives twice? What happens if the payment provider answers too late? Other agents then play each case for real, on a test copy of our platform. Payments run in the test environment of our payment provider, so no real money moves. A case that fails sends the change back to the agent that wrote it.

Then a risk score decides who looks next. An agent answers about twenty yes/no questions on every PR. In fintech, "does it touch money?" is almost always yes, so our questions are precise. Can this payout run twice? Does the change write to a bank or a payment provider? Does it match a payment to another client or partner? Does it rewrite data already stored? Does it hide a failure behind a silent default? A change to how money is computed is enough to call a human.

The reviewer learns the change

The human review exists for knowledge: the reviewer has to understand the change. Comments are no longer how we pass that knowledge along. In September, a reviewer left comments on the code of almost one fintech PR in two. In November, that dropped to one in twenty-five. For us, a PR with no comment is a good sign: the machines found the problems before a human looked.

When a human reviews, an agent prepares the review first. It sorts the changed files. A file that computes money, dates, state, or permissions gets the long review. The agent writes the intent: what must change, what must not change, and what the PR does beyond that. It also shows a worked example before and after the change, with real amounts. The reviewer reads the intent and the example, then approves once they understand the change. A comment now means the harness missed a case. That case becomes a new scenario, so the next agent gets it right.

Our reviews used to say "LGTM". Now they say "Go: every amount that leaves in a payout is proved by a test."

Facts at the entry, a checker at the exit

Our fintech business lead built our vision on one rule: an agent on a money flow without facts repeats errors faster. Facts come first, then rules, then agents. People keep the rules and the exceptions.

Control at both ends of the money flow: facts and rules at the entry, agents proved by business scenarios, an invoice checker at the exit
Control at both ends of the money flow, on client and commission invoices today.

The facts are structured data that an agent can read. They include the legal entities of the client and the supplier, the invoice address, the supplier terms, and the proof of service. Each client's billing entity comes from a company registry, with a locked legal identity. The purchase order is a fact too. The client issues it, and our invoice must match it. An agent that starts from the right legal entity and the right purchase order does not have to guess.

At the other end, a checker runs on every client and commission invoice before it gets a number. Some of its checks are rules in code, on the purchase order and the VAT numbers. Others use an AI that reads the printed PDF like the client, down to the cent. A failed check blocks the invoice. If the AI check does not answer, no invoice goes out. Only business owners and finance supervisors can pass a failed check, with a written reason that we record.

The checker has two jobs. The first is to catch errors in what people enter: a partner with no VAT number, or a purchase order that is missing, too small, or addressed to the wrong entity. That job stays.

The second is to catch problems on our side: a bug in our code, or a check that is too strict. That job is a patch. In the week of 2 November, the checker blocked 142 of 346 bookings for a cause on our side, before any invoice went out. Each one went back to the code or to the check. On 16 and 17 November, it blocked 12 of 131. The checker is our last harness, the one that runs in production on every invoice. Most public write-ups on coding agents stop at the merge. Our last check runs after it, in production. Today it covers client and commission invoices. Payouts come next.

What still gets through

Bugs still reach production. Some come from the code. The hardest ones come from a rule that was missing or wrong.

Our supplier payment queue is the clearest case. We built it before the finance rules were written, and they arrived when the project was three-quarters done. The tests proved the code we had written, but no test can cover a rule that does not exist yet. We are writing the missing rules and their scenarios now, and that costs far more than writing them first.

So when a bug gets through, we fix the rule and its scenario first, then the code. An engineer who fixes a bug remembers it. An agent does not carry that lesson into its next session. That lesson has to live in the harness, where every later agent must pass it.

What our engineers do now

Our agents now ship code on our money flows every day. Our engineers rarely read code line by line. They spend their time where agents cannot decide: the business rule, the scenario that proves it, and the intent behind each change. Any team putting agents on money will hit the same point. Start with the facts and the proof, then bring in the agents.

Facts first. Proof in the middle. A checker at the exit.

Thanks

This work belongs to the whole fintech team: Pierre Le Corff, Basile Durst, Antonin Marchard, Xavier Nouaille, Maximilien Andile, Yoann Lallement, Coline Velard, Victor Darmayan, Lucien Thibert, and Stéphane Colson. Thanks also to Virginie Cazol, who gave our money flows their facts and their rules.