Skip to content
Nextlink EXIMSoftware engineering & AI agents
All insights

· 3 min read

How we built an AI support agent with human handoff (and what we got wrong first)

A practical walkthrough of a production support agent: intent discovery from real tickets, tool permissions, the escalation summary, and the evaluation suite that caught two bad model upgrades.

Sandeep Kumar, Founder & Lead Engineer

Sandeep Kumar · Founder & Lead Engineer, Nextlink EXIM

Most support chatbots fail for a boring reason: they were designed from a demo, not from the tickets. This is how we built one that resolves about two thirds of a logistics SaaS help desk's volume, and the mistakes we made along the way.

Start with three months of tickets

Before touching a model, we exported 2,700 tickets and read a sample of 400 by hand. We tagged each one with an intent and a note on what resolving it actually required: just information, a read-only lookup, or an action.

Fourteen intents covered 71% of volume. The top five:

  1. Where is my invoice / resend my invoice
  2. How do I add or remove a user
  3. Shipment status didn't update
  4. Password or login problems
  5. How does feature X work

That list decided the whole design. Everything else is implementation.

Decide what the agent may do, in writing

We wrote a one-page permissions table with the client before any code:

| Action | Agent may | Notes | | --- | --- | --- | | Look up account, plan, invoices | Do it | Read-only | | Resend an invoice | Do it | Idempotent, logged | | Add a user | Do it if requester is an admin | Checked against the account, not the chat | | Change plan, refund, delete anything | Never | Creates a request for a person | | Promise a delivery date | Never | Quotes the tracking status only |

The two "never" rows are the reason the client trusted it. A previous bot had invented a refund policy in production. Not being able to do something is a feature.

The architecture, briefly

  • Retrieval over the help centre and internal runbooks, chunked by heading, stored in Postgres with pgvector. Every answer carries citations the customer can click.
  • Tools as typed functions with explicit permission checks that run in code, not in the prompt.
  • A state machine (we used LangGraph) with a small number of states: classify, retrieve, act, answer, escalate. Keeping it small made the traces readable.
  • Escalation writes into the Zendesk ticket: a two-line summary, the customer's sentiment, what the agent already tried, and the relevant account facts. The human starts with the story, not a cold ticket.

What we got wrong

We let it answer when retrieval was weak. Early on, if the top retrieved chunk had a low similarity score, the agent would still try. Accuracy on the "how does feature X work" intent was 74%. We added a hard rule: below a threshold, escalate. Accuracy on that intent went to 93% and the escalation rate rose by only four points.

We measured the wrong thing first. Our first dashboard showed "deflection rate". The client's head of support rightly pointed out that a bad answer the customer gives up on also counts as deflection. We switched to resolution confirmed by the customer (a thumbs-up or no reopen in 72 hours) plus CSAT.

We underestimated the handoff. The summary written into the ticket turned out to be the most praised feature. We'd treated it as an afterthought.

Evaluation is the product

We built an evaluation set of 180 real conversations (anonymised) with expected outcomes: the right intent, whether an action should be taken, and key facts the answer must contain. It runs on every change to a prompt, tool or model.

It has rejected two model upgrades so far. Both looked better in general benchmarks and both dropped accuracy on the billing intent by more than five points. Without the suite we would have shipped them.

Results after 90 days

  • 68% of tickets resolved by the agent, CSAT 4.6/5 (human baseline 4.4)
  • Median first response from about six hours to forty seconds
  • Zero incorrect refunds or plan changes, because it cannot make them
  • Model cost per resolved ticket: well under a dollar

If you're doing this yourself

Read the tickets. Write the permissions table before the prompt. Make "I'll pass this to a colleague" a first-class outcome, not a failure. And build the evaluation set before you ship, because you will want to change models within three months and you'll need to know if it's safe.

If you'd rather we did it with you, the case study has more detail, and the contact page is the fastest way to reach me.

Tell us what's slowing your team down.

A 30-minute call with Sandeep, no sales team. We'll tell you honestly whether we're the right fit and what it would roughly cost.