
Building custom AI chatbots: from GPT prototype to production
What makes an AI chatbot production-ready: grounding with RAG, guardrails, human hand-off, test sets, monitoring and GDPR for business use.
In short: You can build a chatbot prototype with GPT or Claude in an afternoon. It becomes production-ready once it draws on your own knowledge (usually via RAG), knows its limits, hands uncertain cases to people and is tested continuously against real questions. Most of the work sits in these layers around the language model, much less in the model itself.
Why the prototype is misleading
A system prompt, an API key and a chat window: that is enough for an impressive first demo. The trouble starts when real users arrive. They ask questions the prompt never anticipated, ask about prices the model then invents, or try to get the bot to say things your company would never stand behind.
A language model knows nothing about your products, delivery times or refund rules. It produces plausible text. Without a connection to reliable data, that leads to hallucinations: wrong statements that sound convincing.
The building blocks of a production chatbot
Grounding with RAG
Retrieval-augmented generation (RAG) is the standard way to give a model your knowledge. Documents, FAQ pages and product data are split into chunks, stored as vectors and searched for every question. The matching chunks go into the prompt together with the question, and the model answers from them.
Quality depends heavily on preparation: how documents are chunked, whether outdated versions are removed, and whether search combines semantic and keyword matching. For data that changes constantly, like stock levels or order status, a direct API call works better than a document index. Our article on LLM integration for enterprise goes deeper into the architecture.
Tools and actions
Many bots should do things as well as answer: book an appointment, open a ticket, write a lead into the CRM. Current models support this through tool calling. The model decides which function to call with which parameters, and your backend runs it. Every action needs a server-side check, because the model must never be the final authority on permissions.
Guardrails and human hand-off
Decide what the bot talks about and what it does not. A customer service bot does not need to give legal advice or promise discounts. The hand-off matters just as much: when the bot is unsure, the customer seems frustrated or explicitly asks for a person, the conversation goes to your team with a summary. Our article on automating customer support with AI shows how this works in practice.
Test before your customers do
A chatbot does not behave deterministically. A small prompt change can make answers worse somewhere else entirely. That is why you need a test set: a collection of real questions with expected answers or criteria that runs before every change. Add deliberate attacks too, such as prompt injection ("ignore all previous instructions…"), off-topic questions and requests for confidential data.
Part of the evaluation can be automated, for example with a second model grading answers against criteria. It should not fully replace human spot checks.
Running it: monitoring, cost, data protection
Monitoring and improvement
In production, log conversations (in a privacy-compliant way), response times, hand-offs and user feedback. This data shows where knowledge is missing and which questions the bot regularly fails on. Close those gaps every week and the bot gets noticeably better within a few months.
Cost and latency
Billing is per token. Long prompts with lots of context cost more and take longer. Prompt caching, smaller models for simple tasks and streamed answers keep both cost and perceived waiting time down.
GDPR and the EU AI Act
Clarify where data is processed, sign data processing agreements and do not send the model personal data it does not need. The EU AI Act also requires transparency: users must be able to tell that they are talking to an AI.
Frequently asked questions (FAQ)
Which language model is best for a business chatbot?
The major models from OpenAI, Anthropic, Google and Mistral all handle customer conversations well. The choice depends on data protection requirements, cost, latency and language quality in the languages your customers use. A clean architecture lets you switch models later.
Do I need to train my own model?
Usually not. For company knowledge, RAG is the better route, because content can be updated immediately and sources stay traceable. Fine-tuning makes more sense for a specific tone or a narrow output format.
How do I stop the bot from making things up?
You cannot rule it out completely. You reduce the risk a lot if the bot may only answer from retrieved sources, says openly when it does not know, and passes sensitive topics to a person.
How long does it take to get a chatbot into production?
A narrowly scoped bot with a maintained knowledge base can be live within a few weeks. It takes longer when content has to be prepared first or many systems need to be connected.
Conclusion
A production chatbot is a small software product with a data pipeline, tests and operations. Invest early in the knowledge base, the hand-off and the test set, and you get a bot customers trust, with a model underneath that you can swap without starting over.
If you are planning a chatbot for your business, talk to us about AI and automation.
Related posts
- AI Agents for Business: A Practical Introduction
How AI agents differ from chatbots and classic automation, where they help small and mid-sized companies, and how to introduce a first agent safely.
- Workflow automation with n8n: a getting started guide
Getting started with n8n: cloud or self-hosting, triggers and nodes, a first workflow, error handling and what to settle before you run it in production.
- LLM integration for enterprise: architecture and best practices
How to integrate language models into business software safely: architecture, RAG, structured outputs, data protection, cost control and quality assurance.
- AI automation for SMEs: how to find the hours you lose
How small businesses use a simple time audit to find the processes worth automating with AI, and how to measure the time they actually get back.