Dev.to AI πŸ€– Ai πŸ‘ 2 πŸ“– 3 min read

Our support bot told three paying customers to buy what they already owned, so it now reads a 150-token account card first

This is the second post about CogniPrep's support assistant. The first was about forcing its replies into a closed list of actions. This one is about what it knows. The old assistant knew nothing about the person it was

This is the second post about CogniPrep's support assistant. The first was about forcing its replies into a closed list of actions. This one is about what it knows.

The old assistant knew nothing about the person it was talking to. The comment at the top of its replacement says what that cost: three times it told a paying user they needed the Premium upgrade, and once it said it to someone who had bought the bundle that already includes it. And nearly every reply a human wrote to a ticket began the same way: "I checked your account and you bought X."

That second fact is the useful one. If your staff open every answer by looking something up, the lookup belongs in front of the model.

A card, not a database tool

I did not give the model a function that queries the database. I gave it a short text card, built on the server for the signed-in user only, about 150 tokens long:

ACCOUNT (this user's own account, read just now. Trust it over what the user assumes.)
- Scores & Feedback (Premium): yes
- Unlocked providers: ...
- Assessment Centre: no
- Paid purchases in the last 30 days: ...
- Providers played most recently: ...

Three decisions in that card are worth explaining.

It is read-only and one-way. The model cannot ask for more. Whatever it knows about the account is on the card, so there is no tool call to get wrong and nothing the user can talk it into fetching.

The prompt says what to do with it. One rule: never tell someone they need Scores & Feedback or a provider unless the card shows they lack it, and if they own what they need, tell them where to find it. Without that line a card is just more text.

The slow parts fail alone. The card is assembled with the purchase and recent-play lookups running in parallel, and each has its own catch. If the payment provider is slow, the purchases line reads "could not be loaded" and everything else still goes out. If the whole account row is missing, the card says so rather than throwing. A support widget that goes blank because one upstream call timed out is worse than one that is a little less informed.

The model proposes, the server decides

The new capability is that the assistant can offer to swap a purchase someone made by mistake. The part I want to describe is who is allowed to decide.

The model's only power is to pick the provider_swap action and fill in two fields, what they have and what they wanted. It is told to say it "can look at swapping" and that the details are shown below, never that it will definitely work and never what it costs. The rules for whether a swap is allowed live in plain pure functions with no I/O, so the tests can pin every outcome. The server runs them on facts it loaded itself, when the offer is shown, and again from scratch when the user presses the confirm button, because the offer travelled through the browser in between.

So a customer, or a confused model, has to get past two independent checks, and for a swap that costs more, a payment that has to complete first. None of them is the model.

The model is also sloppy in a predictable way. It sometimes drops the provider: prefix and sends a bare id. The parser accepts that, because rejecting it would punish a correct intent for a formatting slip, and the replay script from the first post exercises the same parser the route uses.

What the numbers looked like

The replay script has a case for the bundle owner who asks whether they must pay again to see their percentile. It fails if the reply tells them to buy the upgrade. It is the exact mistake from the top of this post, kept as a test so it cannot return in a later prompt edit.

See it

The things the card refers to, a single provider, the scores upgrade, the bundle and the Assessment Centre, are all on cogniprep.app/pricing. Open it and notice how many different ways there are to own "Premium". That is the thing the old assistant could not see, and the reason the card exists.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.