support agent

Support answers a customer
can check for themselves

Cerro Alto’s agent answers from the store’s own help centre, looks the order up while you watch, and hands you to a person the moment the documents run out — instead of guessing.

Fixture mode — recorded turns, replayed at measured timings. No key set.

Cerro Alto CoffeeSupport · Mon–Fri 9–5 ET
Fixture mode

Ask about an order, a grind, or a subscription. If I can't answer it from our help centre, I'll hand you to a person rather than guess.

Built with

claude-opus-5Voyage embeddingsNext.js 15Shopify Admin APITypeScriptnode:test
the difference

Where guessing ends,
grounding begins

Three ways to answer a support question, and only one of them the customer can verify.

A generic chatbot

  • Invents a delivery window it has no source for
  • Cannot see the order, so it asks the customer to go and check
  • Promises a refund nobody authorised

Canned macros

  • Answer the question they were written for, not the one asked
  • Go stale the day the policy changes
  • Turn every edge case into a queue

This agent

  • Cites the document each claim came from
  • Reads the live order, and shows the call that read it
  • Escalates by rule when money or damage is involved
what it does

Four parts, each of them
testable on its own

Retrieval, tools, escalation and citation are separate contracts with separate tests — so a regression in one is visible before it reaches a customer.

Grounded retrieval

Answers are assembled from the store’s own help centre — hybrid lexical and embedding search over six policy documents, shipped at k=6.

No document, no claim.

Live order lookup

A typed tool call hits the Shopify Admin API and returns a normalised envelope, so status, carrier and dates come from the order — not from the model.

Real data, real latency, shown.

Deterministic escalation

Refunds over the approval limit, damage claims and low-confidence retrievals route to a person through code, not through a prompt asking nicely.

No prompt can talk past it.

Checkable answers

Every answer carries the documents it was built from as clickable chips. The customer can read the policy the agent read.

Cited, or it doesn’t ship.

who it is for

Three people have to
live with this thing

The customer who asks, the lead who answers for the answer, and whoever inherits the code. Each of them needs something different from it.

Someone who wants an answer at 11pm and has no interest in whether it came from a model or a person.

  • Gets the shipping rule as it is written, not an approximation of it.
  • Can click through to the document the answer was built from.
  • Is handed to a human the moment the documents stop covering the question — with the ticket already written.

how it works

One turn, three decisions,
none of them hidden

The widget renders the agent’s actual state machine. Nothing in it is simulated — the spinner clears because a tool returned.

STEP 1

Retrieve before reasoning

The question is embedded and searched against the committed index. Six chunks come back with scores; if the best of them falls under the relevance floor, the turn is already on its way to a human.

retrieve(q, k=6) → chunks[] floor → escalate
STEP 2

Call tools, in the open

Order lookup, help-centre search and escalation are typed tools with contracts and their own tests. The widget shows each call as it starts and the real elapsed time when it returns.

lookup_order("CA-10244") → { status, carrier, eta }
STEP 3

Answer, or hand off

Claims not supported by the retrieved context fail the citation gate. When the policy says a human decides — money, damage, anything past the approval limit — the agent writes the ticket instead of the promise.

gate B: every claim ∈ context else → handoff(ticket)
evidence

Measured offline,
printed with its command

Every figure below came from a command that runs on a clean clone with no keys and no network. The half that could not be measured is left blank on purpose.

251/252

unit and contract tests passing, with 1 skipped loudly because it needs an embeddings key.

14/16

retrieval cases where every expected source came back — 88%, on the offline embedding stub.

94%

top-k hit rate at the shipped k=6, where false below-floor escalation reaches 0%.

0.815

mean reciprocal rank at k=6 — within 0.007 of its ceiling at k=12, for half the context.

Not measured

Answer accuracy, both hard gates, latency and cost per conversation. They need a live run against a key, which has not happened — so no number is given for them.

Two failures, published

Both retrieval misses are written up in full in the report, including the one where the relevance floor is confident and wrong. That case is why the citation gate exists.

what it is wired to

Eight moving parts,
all of them named

Nothing here is a black box you have to take on faith. Each piece is either an API with a contract or a file in the repository.

Anthropic APIclaude-opus-5, streaming, tool use
Shopify Admin APIorder status, carrier, dates
Voyage embeddingswith an OpenAI fallback
The help centresix markdown policy documents
Human handoffticket written at escalation
TypeScripttyped contracts per tool
node:test252 tests, no framework
Next.js on Vercelthe demo you are reading
receipts

Three claims, and
where to check each

A page arguing that nothing should be claimed without a source does not get to run testimonials. These are the claims it makes, and the file each one lives in.

ESCALATION

Refunds above the limit cannot be talked past.

The trigger reads the order envelope, not the conversation. An order flagged requiresApproval routes to a person whatever the customer or the model says next.

src/escalation/triggers.ts · refundOverApprovalLimit
GROUNDING

No document above the floor means no answer.

When nothing retrieved clears the relevance floor the turn escalates with a stated reason rather than improvising from the model’s own priors.

src/escalation/triggers.ts · retrieval_below_floor
HONESTY

The half that was not measured prints no number.

The eval report publishes both retrieval misses in full, including the case where the relevance floor is confident and wrong — which is why the citation gate exists at all.

evals/report.md · §4, not run
run it yourself

What you can check
without asking me

One half of this project runs on a clean clone with no keys and no network. The other half needs keys and has not been run. Both are listed.

Everything below ran on a machine with no API keys and no network.

The test suite

Unit and contract tests over every module

$ npm test

252 tests · 251 pass · 1 skipped

  • Tool contracts, each with its own file
  • Escalation triggers, one test per rule
  • Date arithmetic against a fixed anchor
  • The skipped one says out loud why it skipped

Retrieval evals

Sixteen labelled cases over the committed index

$ npx tsx evals/run.ts --retrieval-only

14/16 retrieved every expected source

  • Runs against the offline embedding stub
  • Both misses are written up, not rounded away
  • Expected sources are labelled in dataset.json
  • No key, no network, no excuses

The top-k sweep

Why the shipped setting is k=6 and not k=8

$ npx tsx src/retrieval/sweep-topk.ts

94% hit rate · MRR 0.815 · 0% false floor

  • Recall plateaus at k=8, for a third more context
  • k=6 is where false escalation reaches zero
  • MRR within 0.007 of its ceiling
  • The table in the case study is this command
examples

Three questions worth
trying in the widget

One answered from policy, one that calls a tool, one the agent refuses to answer. All three are reachable above without a key.

ORDER STALLED

CA-10244 hasn’t moved in four days

The agent looks the order up, reads the carrier scan history, and says what the shipping policy actually commits to — including the part where nothing has gone wrong yet.

lookup_ordershippingno escalation

Answered from policy plus the live order

REFUND OVER LIMIT

A dead kettle on CA-10250

A damage claim above the approval limit. The agent declines to promise the refund, writes a ticket carrying the order and the customer’s account of the fault, and says who decides next.

returns-refundsescalate_to_human

Handoff — the system working

PRODUCT ADVICE

Which grind for an Aeropress?

No order, no tool call. Straight retrieval against the brewing guide, with the grind chart cited so the customer can check it before buying the wrong bag.

brewing-grind-guidecited

Answered from one document

faq

The questions that
come up first

Is this running live?

It depends on the key. With ANTHROPIC_API_KEY set it is real inference against claude-opus-5. Without one it runs in fixture mode — turns recorded from real runs, replayed at the measured timings. The widget header says which, always. The public deploy runs fixtures on purpose: it works, you can click it, and it spends nothing.

Where do the answers come from?

Six policy documents written for this store — shipping, returns and refunds, subscriptions, freshness and storage, a brewing and grind guide, and an FAQ. They are chunked, embedded and committed to the repository, which is what makes a clean clone runnable without a key.

What happens when it doesn’t know?

It stops. If nothing retrieved clears the relevance floor, or a claim isn’t supported by the retrieved context, the turn escalates instead of improvising. Escalation is rendered as a deliberate state in the widget, not as an error — because it is the system working correctly.

Why is the end-to-end score missing?

Because it was not run. The offline half — retrieval, the top-k sweep, the unit suite — ran on a machine with no keys and no network, and those numbers are printed next to the command that produced them. Answer accuracy, the two hard gates, latency and cost need a live run, so no number is given for them at all.

Is any of the customer data real?

None of it. The brand, catalogue, orders and policies were all built for this project. No real customer information appears anywhere in the repository or in this demo.

Can I read how it was built?

Yes — the spec, plan, task list and tool contracts that produced the code are committed under specs/, and the case study walks through the retrieval decisions and the two failures that were not rounded away.

have a look

Ask it something
it should refuse

The interesting turn isn’t the one it answers. Try the refund over the approval limit, watch the handoff, then read how that rule is enforced.