How do chatbots work? A chatbot reads a message, works out what the person wants and sends a reply. A rule-based chatbot picks that reply from a script written in advance; an AI chatbot searches the business's own content and has a language model write the answer from what it finds.

Most chatbots on business websites today are the AI kind, and an AI chatbot works by searching before it speaks. When a visitor types a question, the chatbot turns it into a representation of meaning, finds the passages in the business's own content that are closest to it, and has a language model write a short answer from those passages. If nothing matches, a good one says so and offers a person.

That is how AI chatbots work on a business website today, and it is how Dante AI agents work. The rest of this page shows the flow every chatbot follows, compares rule-based and AI chatbots step by step, takes the AI mechanism apart one step at a time, then follows a single visitor question all the way through, from the first keystroke to a teammate taking over the chat.

Key takeaways

  • Every chatbot, old or new, does the same five jobs in the same order.
  • A rule-based chatbot is a decision tree.
  • A modern business chatbot runs in two phases.
  • Training a chatbot on your own content is mostly reading and filing.
  • The question is embedded the same way the passages were, and the vector database returns the passages nearest to it, a handful at most.

How do chatbots work?

Every chatbot, old or new, does the same five jobs in the same order. What differs is how it does steps two and three. Here is the flow at a glance:

The chatbot flow: message in, answer out

  1. Message in. A visitor types a question into the chat window on a website, app or messaging channel.
  2. Understand. The chatbot works out what the visitor wants: a rule-based bot matches keywords or button clicks, an AI chatbot reads the meaning of the whole sentence.
  3. Find the answer. A rule-based bot follows the branch of its script; an AI chatbot retrieves the closest passages from the business's own content.
  4. Reply. A rule-based bot sends the reply written for that branch; in an AI chatbot a language model writes a short answer from the retrieved passages.
  5. Hand over or log. If the chatbot cannot help, a good one says so and passes the chat to a person. Either way the conversation is saved for review.

That is the whole answer to how chatbots work. The rest is detail about steps two and three, and that detail is what decides whether a chatbot helps your customers or frustrates them. For the plain definition and the main types, see what is a chatbot.

How does a rule-based chatbot work, compared with an AI chatbot?

A rule-based chatbot is a decision tree. Someone writes the questions it expects, the keywords or buttons that trigger each branch, and the reply at the end of every branch. An AI chatbot, often called an LLM chatbot because a large language model writes its replies, needs no script: it answers from whatever content you give it. Side by side:

Rule-based chatbotAI (LLM) chatbot
How it understands a messageMatches keywords, patterns or button clicksReads the meaning of the sentence, typos and slang included
Where the answer comes fromA reply written in advance for each branchPassages retrieved from your website, documents and Q&A pairs
Who writes the repliesA person, one branch at a timeA language model, from your content, shaped by your instructions
A question nobody planned forLoops back to the menu or says it does not understandAnswers if your content covers it, admits the gap if not
Keeping it currentEdit the script every time something changesUpdate the page or document it learned from
Main riskRigid and frustrating off-scriptWrong or stale source content gives wrong answers
Best forShort fixed menus, such as picking a departmentAnswering real customer questions from your own information

Rule-based chatbots go back to ELIZA in 1966 (when did AI chatbots start has the full timeline). For the buying decision between the two, see our rule-based vs AI chatbot buyer's guide. The rest of this page is about the AI kind, because that is what answers questions on a business website today.

See an AI chatbot answer from your own content. Add your website to Dante AI, ask it a question your customers ask every week, and check where the answer came from.

Get started free

How do AI chatbots actually work?

A modern business chatbot runs in two phases. The first happens once, before any visitor arrives: the chatbot reads your content and indexes it by meaning. The second happens on every message:

  1. Read the question. The visitor's words, typos included, are converted into a list of numbers (an embedding) that captures what the sentence means rather than which words it uses.
  2. Retrieve. That embedding is compared against the indexed passages from your content, and the closest few are pulled out.
  3. Check the match. Passages that are only loosely related are set aside. If none is a strong match for a specific question, the chatbot should admit the gap instead of guessing.
  4. Write the answer. A large language model receives the question, the retrieved passages and your instructions (tone, rules, what to avoid), and writes a short reply grounded in those passages.
  5. Hand over or log. If the visitor wants a person, the chat moves to your team. Either way the conversation is saved, so you can see what was asked and fix what was missed.

This pattern is called retrieval-augmented generation, or RAG. Our RAG chatbot guide goes deeper on the term itself. The short version: the model supplies the language, your content supplies the facts.

What happens before the first visitor arrives?

Training a chatbot on your own content is mostly reading and filing. In Dante AI it works like this:

  • You give it sources. Website URLs, file uploads (PDF, Word, slides, spreadsheets and more), pasted text and hand-written Q&A pairs, per the knowledge sources docs. The crawler follows internal links on your domain and reads only public pages.
  • The text is split into passages. Each page or document is cut at paragraph and sentence boundaries into overlapping passages of roughly a thousand characters, so a fact near the edge of one passage still appears whole in the next.
  • Each passage is embedded. Every passage gets its own embedding and is stored in a vector database, a search index organised by meaning instead of by keyword.

Nothing here changes the language model. It is not retrained on your pages; it is handed the right passages at the moment it needs them. That is why switching an agent's model in Dante AI never changes what the agent has learned (AI models docs), and why fixing an answer means fixing the content. For choosing and cleaning sources, see how to train a chatbot on your own data.

What happens when a visitor asks a question?

The question is embedded the same way the passages were, and the vector database returns the passages nearest to it, a handful at most. Each one comes back with a similarity score. A relevance floor drops the hopeless hits, and the survivors are labelled as strong or weak matches before the model sees them.

That label matters more than any prompt. In Dante AI, when a visitor asks a specific factual question and every retrieved passage is a weak match, the agent returns a fixed honest reply ("I do not have information about that") without asking the model at all, so there is no chance for it to fill the gap from general knowledge. Broad questions such as "what can you help with?" are the exception, because a weak sample of your content is still a fair answer to them.

When the matches are strong, the model writes the reply from them, shaped by the behaviour you set in the agent behaviour field. Dante agents do not browse the live web: they answer from your knowledge and the current conversation only, on every plan (web search docs).

What does one question look like, step by step?

Take an invented example: a garden centre whose website has a delivery page ("we deliver within 20 miles, Monday to Saturday; bulky items such as compost and paving go on our own van") and an opening-hours page. Its Dante AI agent is trained on the site, and Human Handover is on.

  1. The question. A visitor types: "can u bring 10 bags of compost saturday? im about 12 miles away". No keyword list would catch that phrasing. The embedding does not need one.
  2. Retrieval. The nearest passages are the delivery paragraph about the 20-mile radius and Saturday runs, and the line about bulky items on the van. Both are strong matches. A passage about seed potatoes comes back too, labelled weak, and the model is free to ignore it.
  3. The answer. The model replies in two sentences: yes, 12 miles is inside the delivery area, Saturday is a delivery day, and compost goes on the van. It quotes no terms and conditions, and it invents no price, because the delivery page does not state one.
  4. The gap. The visitor follows up: "can you take the old paving away while you're here?". Nothing on the site covers removal. Every passage is weak, so the agent says it does not have that information rather than promising a service the shop may not offer.
  5. The handover. The visitor taps Talk to a human. The chat lands in the team Inbox marked Awaiting, the visitor sees a short holding message, and the AI stops replying to that request so the two never contradict each other. A teammate clicks Take it, answers about paving removal, and clicks Resolve to hand the chat back to the AI (Inbox docs).
  6. The fix. Next morning the owner reads the conversation in Chat history, adds one Q&A pair about paving removal, and the next visitor who asks gets the answer without waiting for a person.

Steps one to four happen without anyone at the garden centre doing anything. Step five is where the business stays in control. Human Handover is included on the Advanced and Pro plans; our guide to chatbots with human handover covers how to set the rules.

Watch the five steps run on your own content. Train an AI agent on your website, then ask it the question your customers ask most and one your site does not answer.

Get started free

How do rule-based, retrieval-augmented and agentic chatbots differ?

"Chatbot" covers three quite different machines. Most of the confusion about how chatbots work comes from mixing them up.

Rule-based chatbotRetrieval-augmented AI chatbotAgentic chatbot (AI agent with tools)
How it reads a questionMatches keywords or button clicks against a scriptConverts the question into meaning and searches your content by meaningSame as retrieval-augmented, then decides which tool or step to use
Where answers come fromReplies written in advance for each branchPassages retrieved from your website, files and Q&A pairsYour content plus live systems it is connected to, such as a booking or order system
An unscripted questionFails or loops back to the menuAnswers if your content covers it, admits the gap if notAnswers, or runs a lookup or action if one is connected
What it can doFollow a fixed flowAnswer, capture details, hand over to a personTake actions in other systems on the visitor's behalf
Main riskRigid, frustrating for anything off-scriptWrong or stale source content gives wrong answersAn action taken on a misunderstanding; needs tight permissions
Setup workWrite and maintain every branchPoint it at your content and keep that content currentContent plus connecting and testing each tool
Best forShort, fixed menusAnswering customer questions from your own informationMulti-step tasks such as changing a booking

Dante AI agents sit in the middle column, with handover to your team on top. For the choice between the first two columns, see our rule-based vs AI chatbot buyer's guide; for where chatbots end and agents begin, see AI agent vs chatbot.

Why do AI chatbots sometimes get it wrong?

Because retrieval decides the answer, most wrong answers trace back to the content rather than the model:

  • The fact is not there. The page that would answer the question was never written, or lives behind a login the crawler cannot open.
  • The fact is out of date. A price or policy changed on the site, but the agent's copy was not refreshed. Re-crawl after any change that matters.
  • The fact cannot be read. Pages built entirely by JavaScript after load, or PDFs that are images with no underlying text, give the crawler little to work with (knowledge sources docs).
  • Too much nearly relevant material. Forty loosely related documents crowd out the six that matter. Fewer, cleaner sources retrieve better.

The grounding check described above stops the worst failure, an invented answer, but it cannot supply a fact you never gave it. More on this in why AI chatbots fail.

Do AI chatbots learn from conversations?

Not on their own, and that is a feature. A chatbot that rewrote its own knowledge from what strangers typed would drift in ways nobody approved. Instead, every conversation is saved to Chat history. When a reply gets a thumbs-down, the Revise answer button lets you edit it into what the agent should have said; saving adds a Q&A pair to the agent's knowledge and retrains it, so the next visitor gets the corrected answer (Chat history docs). Live visitor conversations appear in Chat history on paid plans; on Free you see your own Sandbox tests.

How can you watch it work on your own site?

  1. Create an agent and add your website. Start at dante-ai.com with Get started; the free plan needs no card and includes 100 message credits a month.
  2. Ask your three most common customer questions in the Sandbox, a private preview where you can also see which of your sources each answer came from (Sandbox docs).
  3. Ask one question your site does not answer. A grounded agent should say it does not have that information.
  4. Fix a gap at the source by adding a page, a document or a Q&A pair, then ask again.
  5. Turn on handover before you publish, so the questions your content cannot answer reach a person. Paid plans start at $40 a month on Starter; Human Handover is on Advanced and Pro (pricing).

Watching the answer change after you add one Q&A pair explains retrieval better than any diagram. Before you put the agent in front of customers, run it through our checklist on how to test a chatbot.

Sources