Engineering · 8 min read

The day our agent made up a price

The fix wasn't writing the instruction more forcefully. It was taking the decision away from the model and putting it on the server, where it can be checked.

The fix wasn't writing the instruction more forcefully. It was taking the decision away from the model.

On a Wednesday in March, a customer asked on WhatsApp how much a three-year e-CNPJ (a Brazilian company digital certificate) cost. The agent answered with a price that wasn't in our price list. It was plausible, it was in the right range, and it was off by forty reais (BRL).

Nobody noticed at the time. We found out two days later, when the customer showed up for the issuance with a screenshot of the conversation.

The first fix, which didn't work

The obvious reaction was to edit the text that guides the agent. The instruction already said to use only the prices in the list. So we rewrote it more forcefully, listed what not to do, and put what mattered in capital letters.

It worked, in the sense that the error became rarer. In about two hundred test conversations, it came back twice. A 1% error rate sounds small until you multiply it by real customer service volume and realize it means one wrong price a day.

And there was a worse problem than the rate: we had no way of knowing when it would happen. An instruction is a request. A request can go unanswered, and when it does, there's no warning.

What actually changed

The second fix started from a different question: what if the agent simply couldn't say a price that wasn't in the list?

This is how it works today. When the agent's reply contains an amount of money, it doesn't go straight to the customer. It goes through a check that extracts the amount, looks it up in that company's approved price list, and only lets the sentence through if it finds it. If it doesn't, the reply is thrown away and the agent has to look up the catalog before answering again.

The difference is one of kind, not degree. Before, the model was told how to behave. Now, the server checks. The model can get it wrong all it wants: the error never reaches the customer.

The same idea in five other places

Once the price lock was in place, it became clear that the same reasoning applied to every promise an agent makes. Every sentence like "I did X" is a claim about the world, and the server knows whether X happened:

  • "I've sent you the link." The sentence is only released after the send is confirmed. Before that, it doesn't exist.
  • "I'll transfer you to Billing." Each team member's working hours are checked first. Outside those hours, the sentence isn't allowed and the agent offers a callback.
  • "I can give you 12% off." A discount is a decision, not information. It goes to the manager on WhatsApp, with the customer still on the line, and waits for approval.
  • "I'll call you tomorrow." Dialing requires an explicit request from the customer or a configured rule, both checked on the server. Not even an API request triggers a call outside the allowed time window.
  • "I have Thursday at ten." The time slot is read from the company's calendar at the moment the agent speaks, not from a cache five minutes old.

What it costs

It costs latency, and that's the only honest argument against it. Every check is a trip to the database before the sentence goes out. We cut that down by keeping each company's approved price list in memory, but it can't go to zero.

Our math was simple: one wrong price a day costs more than a few milliseconds per sentence. And unlike latency, which the customer forgets, a wrong price is something they print out and bring with them.

What we learned

That the temptation, when an AI model does something you don't want, is to improve the text that guides it. It's faster, it doesn't require changing the architecture, and it feels like you've fixed it.

But an instruction isn't a guarantee. If there's a claim your system can't allow, it has to be blocked outside the model, by code you can test. That's our bar today: every promise the product makes to the end customer has an automated test that tries to break it. If it doesn't, it isn't a promise, it's a hope.

See all postsSee the agent in action

What we write about here is in the product

The safeguards, the transfer ladder and the test against simulated customers aren't plans: they're running. In the demo we try to break them in front of you.