AI support chatbots work best when they are built as workflows, not single prompts. A strong chatbot has to understand the user’s question, retrieve trustworthy context, decide whether tools are needed, draft an answer, check that answer, and hand off to a human when confidence is low.
This is the kind of architecture that frameworks such as LangGraph are designed to support. LangGraph.js lets developers model an LLM application as a graph, where each node handles a specific step and the system can route between nodes based on the state of the conversation.
At Gleap, this pattern is central to how we think about Kai, our AI support agent.
Start with the Support Workflow
Before choosing a framework, define the support job. A customer support chatbot usually needs to:
- Answer questions from approved documentation.
- Ask clarifying questions when the request is ambiguous.
- Look up account or product context when permitted.
- Create or route tickets when the answer requires a human.
- Escalate bugs, billing issues, and sensitive requests.
- Keep responses concise, accurate, and on-brand.
LangGraph.js is useful because those steps do not always happen in the same order. A simple question might go straight to retrieval and answer generation. A technical account issue might require tool selection, API lookup, safety checks, and human handoff.
Build the Knowledge Pipeline
The first layer is content ingestion. Your chatbot needs clean, searchable knowledge before it can answer well.
Typical ingestion includes:
- Pulling content from your knowledge base, docs, support articles, and product guides.
- Cleaning navigation, duplicate text, outdated snippets, and formatting noise.
- Splitting content into chunks that preserve useful context.
- Creating embeddings for each chunk.
- Storing chunks and metadata in a vector database such as Qdrant.
Good retrieval depends on good content hygiene. If your knowledge base is outdated, the chatbot will sound confident while giving stale answers.
Use Retrieval-Augmented Generation
Retrieval-augmented generation, or RAG, gives the chatbot trusted source material before it writes. A typical RAG flow looks like this:
- Receive the user’s question.
- Rewrite or classify the query if needed.
- Retrieve relevant content chunks.
- Rerank the chunks by usefulness.
- Generate an answer from the best context.
- Grade the answer before sending it.
LangGraph.js can represent each step as a node. That makes the flow easier to inspect, test, and improve than a single long prompt.
Add Tool Selection
Support questions often require live information. For example, a customer might ask about their workspace plan, an integration error, a failed payment, or a feature flag. The chatbot should not guess. It should decide whether it needs a tool, call the right tool, and use the result carefully.
Tool selection is where graph-based orchestration becomes valuable. One branch can retrieve docs, another can call an internal API, another can create a ticket, and another can escalate to a human agent in live chat.
Grade Before You Answer
Every AI support workflow needs quality checks. A grading step can ask:
- Did the answer use the retrieved context?
- Is the answer complete enough?
- Is the answer safe to send?
- Should the bot ask a follow-up question?
- Should the conversation be handed to a human?
This does not make AI perfect, but it catches many weak answers before customers see them. It also gives the team a place to improve the system without rewriting the whole chatbot.
Connect the Chatbot to the Business
An AI chatbot becomes much more useful when it is connected to support operations. That includes inbox routing, customer context, CRM data, bug reporting, and integrations with the tools your team already uses.
For many teams, building every layer from scratch is unnecessary. Gleap’s Kai combines AI answers, knowledge retrieval, live chat handoff, and product context in one support platform. LangGraph.js is a strong option when you want to build custom agent workflows yourself; Gleap is the path when you want the customer support workflow already connected.