Kognita
All posts
Tutorial2026-10-09·9 min read

Building a support bot with Kognita and Claude in 30 minutes

A grounded support bot is mostly two moving parts: retrieval that finds the right answer, and a model that phrases it with citations. Here's how to wire Kognita search to Claude into a working bot, fast.

A support bot that actually works isn't a huge project — it's two parts wired together. Kognita handles the hard half (ingesting your help content and returning the right passages for any question), and Claude handles the other half (turning those passages into a clear, cited answer). This walkthrough builds a working, grounded support bot from those two pieces. The point isn't the exact code so much as the shape: retrieve, then generate from what you retrieved — never from the model's imagination.

building a support bot with Kognita and Claude

The architecture in one picture

The whole bot is a loop:

  1. User asks a question.
  2. Kognita runs hybrid search over your help content and returns the most relevant passages, each with its source.
  3. You build a prompt: the retrieved passages as context, plus an instruction to answer only from them and cite sources.
  4. Claude generates the answer.
  5. You return it — with citations — to the user.

That's it. The intelligence is split cleanly: retrieval decides what the bot knows for this question, the model decides how to say it. Keeping these separate is what makes the bot trustworthy — the model never invents facts because it's constrained to the retrieved context.

Step 1: Ingest your help content into Kognita

First, give the bot something to know. Create a knowledge base and add your support content — help articles, FAQs, policy docs. Ideally connect a source (like Notion or your docs site) so it stays in sync, but you can also add content directly:

# Create the knowledge base
curl -X POST "$BASE/knowledge-bases" \
  -H "X-API-Key: $KEY" -H "X-Organization-Id: $ORG" \
  -d '{"name": "Support KB", "description": "Help center content"}'

# Add content (repeat per document; ingestion is async)
curl -X POST "$BASE/knowledge-bases/$KB_ID/content" \
  -H "X-API-Key: $KEY" -H "X-Organization-Id: $ORG" \
  -d '{"title": "Refund Policy", "body": "Refunds are available within 14 days..."}'

Kognita chunks, embeds, and indexes each document in the background. Once content shows READY, it's searchable.

Step 2: Retrieve for a question

At query time, run a hybrid search — vector plus keyword, reranked — so the bot handles both natural-language questions and exact terms (product names, error codes):

import requests

def retrieve(question: str, k: int = 5) -> list[dict]:
    resp = requests.post(
        f"{BASE}/knowledge-bases/{KB_ID}/search/hybrid",
        headers={"X-API-Key": KEY, "X-Organization-Id": ORG},
        json={"query": question, "limit": k},
    )
    resp.raise_for_status()
    return resp.json()["results"]   # each: {content, source, score}

This is the half that determines whether the bot can answer at all. If retrieval doesn't surface the right passage, no prompt engineering downstream will save the answer — which is why the retrieval quality (hybrid + reranking) matters more than the prompt.

Step 3: Generate a grounded answer with Claude

Now hand the passages to Claude with a prompt that forces grounding:

import anthropic

client = anthropic.Anthropic()

def answer(question: str) -> str:
    passages = retrieve(question)
    context = "\n\n".join(
        f"[Source: {p['source']}]\n{p['content']}" for p in passages
    )
    resp = client.messages.create(
        model="claude-fable-5",
        max_tokens=800,
        system=(
            "You are a support assistant. Answer using ONLY the provided "
            "sources. Cite the source for each claim. If the sources don't "
            "contain the answer, say you don't have that information and "
            "offer to connect the user to a human — never guess."
        ),
        messages=[{
            "role": "user",
            "content": f"Sources:\n{context}\n\nQuestion: {question}",
        }],
    )
    return resp.content[0].text

Three instructions do the heavy lifting: answer only from the sources (no hallucinated facts), cite each claim (verifiable, trustworthy answers), and admit ignorance + escalate when the answer isn't there (the behavior that separates a good support bot from a liability). That last one is what makes it safe to put in front of customers — a bot that says "I don't have that, let me get you a human" beats one that confidently makes up a refund policy.

Step 4: Wrap it in an interface

The core is done — everything else is delivery. Drop the answer() function behind whatever surface you need:

  • A web chat widget on your help center.
  • A Slack command for internal support.
  • An email or ticket auto-responder that drafts grounded replies for an agent to approve.

For a chat experience, stream the response so it appears token-by-token instead of after a pause — Claude supports streaming, and it makes the bot feel far more responsive.

Why this is only 30 minutes

The reason this isn't a month-long project is that the two hard problems are already solved for you. Retrieval quality — chunking, embedding, hybrid search, reranking, keeping content fresh — is what Kognita does, so you call one search endpoint instead of building a RAG pipeline. Fluent generation with grounding is what Claude does, so you write a prompt instead of training a model. Your job is the wiring: retrieve, prompt, generate, return. That's genuinely a half-hour of work for a working prototype.

Taking it further

Once the basics work, the natural upgrades are: let the model drive retrieval (expose Kognita's search as an MCP tool so Claude decides when to search and can search again to refine — turning the fixed pipeline into an agent), scope retrieval with metadata (so a query about one product can't pull another's docs), and add feedback capture (thumbs up/down) to measure answer quality and find coverage gaps. But none of that is needed for a solid v1. Retrieve, ground, cite, escalate-when-unsure — that four-part recipe is a support bot you'd actually trust with customers, and it's the same recipe whether you build it in thirty minutes or scale it to production.