Train an AI Agent on Your Knowledge Base: A Practical Guide
How to train an AI agent on your company's knowledge base: organizing documents, RAG, hallucination control and simulations before publishing.

Marlos Carmo
Founder of Tolky
Updated on November 16, 2026

Share
The question that comes up most when a company evaluates an AI agent is: how will it know what my company sells, charges and allows? The short answer is that it does not know on its own. You have to teach it, and the quality of that teaching defines the quality of the service.
This guide shows how to organize the knowledge base, how the AI uses that material, how to control the risk of invented answers and how to test everything before talking to a real customer.
Updated in November 2026.
What does it mean to train an AI agent on your knowledge base?
Training an AI agent on your knowledge base means giving it the company's material, such as policies, prices, manuals and frequent answers, so its replies come from that content and not from generic knowledge. On most customer service platforms, this is not "training a model from scratch": it is connecting a language model to an organized base and giving clear instructions.
The knowledge base works as the agent's source of truth. If it is out of date, the agent answers wrong, even with a good model. If it is organized, the agent answers precisely and admits when it does not know. For the concept of an agent, see what an AI agent is.
How does the AI use the knowledge base? The role of RAG
The AI uses the knowledge base through RAG, the technique of retrieving relevant passages from the base and handing them to the model before it answers. Instead of relying only on what it learned in training, the model receives, at the moment of the question, passages from your company's manuals, policies and frequently asked questions.
The process has three steps: split the documents into passages, find the ones most similar to the question and build the answer from them. Two practical consequences follow:
- A clear document becomes a clear answer. An ambiguous or contradictory passage produces an ambiguous or contradictory answer.
- RAG reduces hallucination, but does not eliminate it. What closes the gap is combining a reviewed base, instructions and limits.
At Tolky, the AI answers from the company's knowledge base and stays within the scope you define. Off-topic messages are deflected, and fixed answers handle what cannot vary.
What is hallucination and how do you reduce the risk?
Hallucination is when the AI generates information that looks correct but is false or has no support in the data it received, such as an invented deadline, price or policy. It happens because language models generate the most likely text, not necessarily the true one.
Four practices reduce the risk in customer service:
- Reviewed base: the right, current content in place of a guess.
- Honesty instruction: the agent must admit when it does not know and offer to hand off to a person.
- Scope limit: the AI answers only what falls within the defined topic.
- Conversation review: looking at where the AI hesitated shows what is missing from the base.
None of them guarantees zero errors, which is why promises that "the AI never errs" deserve suspicion. The post AI governance in customer service goes deeper into controls and responsibilities.
How do you organize the knowledge base?
The base works best with one subject per document, direct language, a visible review date and an owner for each topic. The table shows what to do and what to avoid.
| Good practice | Why it helps | What to avoid |
|---|---|---|
| One subject per document | Retrieval finds the right passage | A huge document mixing topics |
| Direct language | The answer comes out clear | Internal jargon and unexplained acronyms |
| Visible review date | You can tell if it is current | Old versions circulating |
| One owner per topic | Someone updates it when things change | A base with no owner |
| A single version of each rule | Avoids contradictory answers | Two documents with different prices |
| Real frequent questions | Covers what customers actually ask | Inventing questions nobody asks |
At Tolky, base material can come from files, links and text. Start with what generates the most requests: exchange policy, deadlines, prices, usage rules and process steps. For the first batch, 10 to 20 well-written documents tend to deliver more than hundreds of loose files.
What should the AI not answer?
The AI should not answer what depends on a human decision, what is sensitive or what the base does not cover, and the rule must be written down. Define in advance a list of what stays out: negotiating exceptions, delivery promises that depend on third parties, diagnoses, legal or financial advice, and others that make sense in your sector.
For these cases, the right setup is to deflect and hand off to a person, with the history, so the customer does not repeat everything. See AI to human handoff: rules. The AI should also introduce itself as an AI assistant, and fixed answers are useful for what cannot vary, such as a legal notice or a policy text.
How do you test with simulations before publishing?
Testing with simulations means running rehearsed conversations against the agent before any real customer, and comparing what it answers with what it should answer. It is the step that best prevents surprises in production.
At Tolky, there is a simulations area where you save simulations with personas and scenarios and run the conversation to see how the agent responds. A simple test script:
| Test type | Example question | What to check |
|---|---|---|
| Direct question | "What is the exchange deadline?" | Answer matches the policy |
| Out-of-scope question | "Can you recommend a lawyer?" | Deflects and does not invent |
| Question with no answer in the base | A product that does not exist | Admits it does not know |
| Angry customer | A harsh complaint | Keeps its tone and hands off to a person |
| Contradictory information | Two different rules | Reveals a gap in the base, so you can fix it |
| Ambiguous question | "How much is it?" without saying what | Asks what is missing |
Repeat the tests every time the base changes. A simulation that passed yesterday can fail today if a document was changed.
How do you keep the base current after publishing?
After publishing, the work becomes routine: review the conversations where the AI could not answer, fix or create the missing document and test again. It is the fastest way to find what is missing from the base.
A simple routine, weekly at first:
- List the conversations where the customer asked for a person or the AI admitted it did not know.
- Group them by topic and decide whether a document is missing, a document is confusing, or the topic should indeed go to a person.
- Update the base and record the review date.
- Run the related simulations.
- Track the resolution rate and handoffs. See AI resolution rate: how to measure it.
The memory of the customer's history is another component of good service; see conversational memory.
Which mistakes should you avoid when training an AI agent?
The most common mistakes when training an agent are uploading too many documents without review, leaving conflicting versions and publishing without testing. All have simple fixes, and most show up in the first simulations.
- Uploading everything at once: old files, drafts and internal spreadsheets enter the base and contaminate answers. Prefer a small, reviewed set.
- Mixing internal and external audiences: an internal discount policy should not be reachable by the customer. Separate what the agent may say from what is for the team only.
- Forgetting to set the tone: the base answers what, but the agent also needs to know how to speak: formal or friendly, short or detailed.
- Not reviewing fixed answers: policy texts and legal notices must be current, because they do not vary.
- Publishing without running the hard cases: test the complaint, the out-of-scope question and the one with no answer in the base.
- Treating the base as a project with an end: it changes with the company. Without an owner and a review routine, it goes stale.
When something fails, resist the urge to "teach" only by rewriting the agent's instruction. Often the problem is an ambiguous or missing document, and fixing the source solves it for all similar questions.
Where does Tolky fit, and what does it not promise?
Tolky is the platform where the knowledge base, the agent's scope, simulations and the handoff to the team live together, on WhatsApp and the other channels. It does not promise that the AI never errs or that the base maintains itself: answer quality depends on the content you maintain.
When choosing a platform, use this criterion as part of the 12-question checklist for choosing an AI agent for WhatsApp. Tolky aggregates more than 5 million AI messages per month and more than 67% AI resolution, platform figures, not a customer's. See the WhatsApp support solution and, if you use HubSpot, how to integrate it with an AI agent.
Frequently asked questions
Do I need thousands of documents to start?
No. A small set of well-written documents on the most frequent topics tends to deliver more than a huge, disorganized base. Start with what generates the most requests and expand.
Does the AI learn on its own from conversations?
You should not assume so. The safe path is to review conversations, update the base and test again, so the change is deliberate and traceable.
Does RAG eliminate hallucination?
No. RAG reduces the risk by grounding the answer in passages from your base, but quality depends on clear, current documents without contradictions, plus instructions and scope limits.
What does the AI answer when it cannot find the answer?
It depends on the setup. The recommended design is to admit it does not know and offer to hand off to a person, instead of inventing. Test this behavior in simulation.
How long does it take to train an agent?
It depends on the volume and quality of the documents. What weighs most is organizing the content and testing. Ask the Tolky team for a schedule for your case.
Can I use the same base across several channels?
Yes. Tolky runs WhatsApp, web chat, Microsoft Teams and voice on the same history, and you define the scope of each service.
Conclusion
Training an AI agent is, in practice, organizing the company's knowledge, setting limits and testing before publishing. RAG and a reviewed base reduce hallucination; simulations and continuous review keep quality up. Shall we talk?
See the plans, explore WhatsApp support or talk to the team →
Share
Tags
- train an AI agent on a knowledge base
- knowledge base for AI
- RAG in customer service
- AI hallucination
- #conversational AI CRM
- AI agent simulation
- train a chatbot with documents
- #AI agent for WhatsApp
Cited in
- How to Choose an AI Agent for WhatsApp: A 12-Question Checklist
- AI Agent for Microsoft Teams: Internal Support and Campaigns
- Conversational AI for clinics and healthcare: appointments and LGPD
- Conversational AI for education: student enrollment on WhatsApp
- Conversational AI for vehicle protection: quotes, claims and billing
- Integrate HubSpot with a WhatsApp AI Agent: Step by Step
- Voice AI and Semantic IVR: The End of Press 1 in Customer Service
About the author

Marlos Carmo
Founder of Tolky
Marlos Carmo is an AI entrepreneur and founder of Tolky, the conversational-era infrastructure and AI CRM that unifies intelligent service, multi-channel support (such as WhatsApp and voice), live CRM, and operational intelligence in a single ecosystem. He is a finalist for the SXSW Innovation Awards and a member of Francesco's Economy, a global network of young entrepreneurs focused on innovation and social impact. He works connecting Artificial Intelligence and digital transformation in projects for large organizations.
Next step
Want to bring this to your operation?
Tati, Tolky's AI assistant, understands your scenario in a few questions, suggests the best path and connects you with someone from the team, with full context.


