A support agent for Tierra Diamond

This is the English demo of the agent in production.

Ask it something

POST /api/v1/chatrunning3 tools, 1 answer

01Customer

My budget is 40 million for an engagement ring. Oval or round, and is there a card fee?

02Model calls 3 tools

  • search_knowledge

    "card payment fee"

    hybrid search

  • search_products

    stone_shape="Oval"

    SQL filters

  • search_products

    stone_shape="Round"

    SQL filters

03Agent

Within your budget, NCH8501 has an 8.0 x 6.0 mm oval center stone, from 29,930,000 VND in 14k gold.

On the card: Tierra covers the fee for settings and jewelry. A GIA-certified center stone carries a 2% bank fee, which you avoid by paying cash or by bank transfer.

Condensed from a test chat. The customer sees only the answer.

Agent report

November 2026

Documents
6, in 48 chunks
Catalog
1,307 products
Tools
6
Model
Nemotron 3 Ultra
Per message
6 model calls max
Answers from the shop's documents

Policies, stores and gemstones, from 6 cleaned-up documents, with the passage behind each answer.

Finds real products

1,307 items filtered by budget, shape and metal, shown as cards built from the catalog.

Quotes only today's offers

Dates are checked in code, so an expired offer is never quoted.

Books a store visit

Checks the store's hours in code. Nothing is booked until the customer confirms.

Hands the chat to a person

Offers a handoff, alerts staff in Slack and switches to live chat.

Finds the right passage

50 test questions, typos included

0.501.00
0.82first result
0.94top 3
0.98top 5

How it's built

01

Architecture

One streaming endpoint, one agent, three kinds of knowledge.

Scroll sideways to see all of itOpen full size
  • Raw tool results stay on the server; the client gets text plus the cards and sources the server builds.
  • History is rebuilt from Postgres, so a client cannot rewrite what the bot said.

02

Fixing the knowledge first

A retrieval system repeats whatever its sources say.

  1. 1Merged conflictsEach fact lives in one place.
  2. 2Checked against tierra.vnStore list went from 13 to 17.
  3. 3Moved bot notes to the promptInstructions are not retrieved as facts.
  4. 4Translated with trade termsEvery number compared automatically.
  5. 5Left out internal materialThe staff-training deck is never ingested.

03

Stored the way it is read

Not everything belongs in a vector store.

SourceRead byWhy
Policy documentsHybrid searchAsked in many different ways
Product catalogSQL filters“Under 40 million” is an exact value
PromotionsAdded to the promptThey expire and must be quoted word for word

04

Hybrid retrieval

Vector search for paraphrases, BM25 for exact terms, merged by rank.

Scroll sideways to see all of itOpen full size

Chunking: 6 documents into 48 chunks of about 760 characters

  1. 1Split at headingsAt every ### heading and every numbered FAQ, so a question stays with its answer.
  2. 2Merge short sectionsUnder 350 characters, joined with neighbours up to 1,200, so related rules come back together.
  3. 3Split long onesOver 1,500 characters, at paragraph breaks.
  4. 4Prefix the heading pathDocument > section > topic, so a chunk still says what it is about on its own.
  5. 5Embedtext-embedding-3-large, 3,072 dimensions, stored as halfvec in pgvector with an HNSW index.

Search: every question, top 5 chunks to the model

  1. 1Vector searchTop 20 by cosine distance in pgvector. Catches paraphrases.
  2. 2BM25 keyword searchTop 20 over lowercased, accent-stripped words. Catches codes like PT900, and “bao hanh” still matches “bảo hành”.
  3. 3Reciprocal rank fusionMerges the two rankings by position, so their scores never need calibrating against each other.
  4. 4No routingEvery search covers all 6 documents, so a wrong guess at the topic cannot hide an answer.

05

Promotions

A wrong discount is the costliest mistake, so dates are checked in code.

Scroll sideways to see all of itOpen full size
  • Expired offers never reach the model; upcoming ones are labelled as not yet available.
  • Stacked discounts compound: 15% then 5% is 19.25%, not 20%.

06

Tools

No router. The model reads six tool descriptions and decides what to call.

ToolCalled when
search_knowledgePolicies, stores, gemstones, payment, warranty
search_productsThe customer wants to see or compare products
show_productsIt recommends products or the customer compares
suggest_repliesIt asks a narrowing question
book_appointmentThe customer wants to visit a store
escalate_to_staffThe customer agreed to talk to a person
Scroll sideways to see all of itOpen full size

07

In the chat

The model chooses what to show; the server decides what it says.

  • show_products takes only product codes. The server loads each product, so a card cannot carry a price the model made up.
  • Answers cite the passages they used, as footnotes the customer can open.
  • Reply chips under a narrowing question: shape, metal, budget.
  • A booking is checked in code, then waits for the customer to press Confirm. The server accepts that answer only for a booking it asked about.

08

Handoff to staff

The bot offers the handoff and escalates only once the customer agrees.

Scroll sideways to see all of itOpen full size
  • One-way: once escalated, the bot never answers in that chat again.
  • Staff get a Slack alert with the bot's summary and reply through the staff API.

09

Evaluation

50 questions with typos and casual phrasing, run through the real search.

0.82

right chunk first

0.94

in the top 3

0.98

in the top 5

0.88

mean reciprocal rank

ChoiceCompared withResult
Hybrid searchVector onlyTop 5: 1.00 vs 0.96
text-embedding-3-largebge-m3, 3-smallMRR 0.90 vs 0.86, 0.79
Heading path in chunksNo prefixTop 5: 0.94 vs 0.88
gpt-5.4-mini (production)glm-5.3-flash, gpt-5-mini3.7s vs 5.7s, 12.3s