tagni
All posts
Engineering·6 min read

How we keep agents from making things up

Grounding, refusal, and the unglamorous engineering that decides whether an answer can be trusted in front of a paying customer.

A support agent that is wrong is worse than no agent at all. A wrong answer costs you the original ticket, a second ticket to correct it, and a quantity of trust that is difficult to price. So most of the engineering behind Tagni is not about generating good answers. It is about refusing to generate bad ones.

Retrieval is the whole game

Every answer an agent gives has to trace back to something you wrote. Not something adjacent, not something plausible. Something specific, current, and attributable.

That means the retrieval layer does most of the work:

  • Chunking that respects structure. Splitting a doc every 500 tokens destroys tables and step lists. We split on headings and list boundaries, then attach the parent heading path to every chunk so context travels with it.
  • Recency weighting. A policy page edited last week outranks one edited last year, even when the older page matches the query more closely.
  • Conflict detection. When two sources disagree, we surface both to the agent rather than letting it silently pick. Usually this means your docs need a fix, and we would rather you knew.

Refusal as a first-class outcome

The most valuable thing an agent does some days is decline. We treat "I do not know" as a successful outcome with its own path, not a failure to be minimised.

An agent refuses when the retrieved context does not actually contain the answer, when sources conflict irreconcilably, or when the action requested sits outside what that agent is permitted to do. In each case it hands off with a summary of what it checked, so the human does not start from nothing.

The measure of a support agent is not how many questions it answers. It is how reliably it knows which ones it should not.

Grounding checks after generation

Generating the answer is the middle of the process, not the end. Before anything reaches a customer we run a verification pass that asks a narrower question: is every factual claim in this draft supported by the retrieved sources?

Claims that fail get stripped or the whole draft gets rejected and regenerated. It costs latency. It is worth it. In practice this catches the specific failure mode that damages trust most, which is a mostly correct answer with one confidently wrong detail buried in the middle.

Actions need a tighter leash than answers

Reading is reversible. Refunding is not.

Any action with a side effect runs through an explicit permission layer with its own limits: which agent, which action, up to what value, under what conditions. An agent that can issue a refund under fifty dollars against a verified duplicate charge is useful. One that can issue arbitrary refunds is a liability with a friendly tone.

What this costs

Honesty is slower. A grounded, verified, permission checked answer takes a couple of seconds longer than an ungrounded one. We think that is the easiest trade in the entire product, and we would make it again at ten times the latency.