How to build a WhatsApp AI agent that answers only from your documents
The fear with AI is that it will make things up. Grounding is how you stop it. Here is how it works, and how to set it up.
Ali Mohammad TarifSenior Backend & AI Engineer, ezychat.io
2 min read
Key takeaways
- Grounding means the AI looks up the passages in your own documents that answer a question, and writes its reply from those passages only.
- The most important behaviour is what happens when your documents don't cover the question; the AI should hand the chat to a person rather than guess.
- In ezychat.io, a reply must rest on passages from your documents, and replies that don't are held back; sensitive topics get an extra check.
- Clear documents matter more than clever prompts; one fact per line, with prices next to their conditions, gives the AI something exact to find.
- Start with drafts your team approves, test privately, then let it reply on its own.
A WhatsApp AI agent that answers only from your documents looks up the passage that answers each question in your own price list, FAQs and policies, writes its reply from that passage alone, and hands the chat to a person when nothing in your documents covers the question. That last part is what makes it safe to put in front of customers.
Why AI makes things up
A language model is trained to produce text that sounds right. Ask it the price of your 10 ft kitchen package and, with nothing to go on, it will produce a plausible number. That’s fine in a brainstorm and a disaster in a customer chat.
The fix isn’t a better prompt. It’s changing where the answer comes from.
How grounding works
- Your documents are prepared. When you upload a price list or FAQ, it is split into passages and indexed so it can be searched by meaning, not just keywords.
- The question is looked up. When a customer asks something, the AI finds the passages in your documents that best match it.
- If nothing matches well enough, it stops. A careful system escalates before writing a reply, rather than producing something that sounds right.
- The reply is written from those passages. The AI drafts its answer using only what it found.
- The reply is checked. Before it goes out, the system checks that the reply rests on the passages it was given.
What ezychat.io does at each step
- Before writing, if your documents don’t cover a question that needs facts, your AI employee hands the conversation to your team instead of answering. The customer is told a member of the team will reply.
- While writing, the reply must cite the passages it used.
- After writing, those citations are checked against the passages the AI was actually shown. A reply that cites something it wasn’t shown is treated as ungrounded and held back. Citation markers are removed before the customer sees the message.
- On sensitive topics, a second check confirms the reply is faithful to your documents before it is sent.
On top of grounding sit your guardrails: what it must never promise, what needs a person’s approval, and topics to avoid. Those apply whether the answer is in your documents or not.
Write documents the AI can use
The single biggest improvement is clearer documents:
- One product, one line. “Kitchen package, 10 ft: RM18,800, includes cabinets, quartz top and sink.”
- Conditions next to prices. If delivery is free over RM150, say it beside the delivery charge.
- Your customers’ words. Include “aircond” if that’s what they type.
- Dates on anything temporary. “Raya promotion, until 30 April.”
Our guide to preparing knowledge has more.
Set it up, step by step
- Hire an AI employee and choose your industry, so it starts with the right guardrails.
- Add your documents in Knowledge: PDF, Word, Excel, CSV, text or a photo.
- Test it privately. Ask the questions customers really send, then the awkward ones. Check it hands over when it should.
- Publish, with drafts first. Your team approves each reply until you trust it.
- Switch it to reply on its own. Guardrails still apply to every message.
The full walk-through is in Hire your first AI employee.
Sources
- WhatsApp Business Messaging Policy: escalation paths · checked 18 October 2026
Try it on your own price list
Hire your first AI employee