Skip to main content
Knowledge bases provide retrieval-augmented generation (RAG) for your agents. Upload documents, automatically embed them, and agents search relevant context at runtime.

Creating a Knowledge Base

Navigate to Knowledge BasesCreate New
  1. Enter name and description
  2. Click Create
  3. Knowledge base is ready for documents

Knowledge Base List

Uploading Documents

Click Upload File to add documents. Supported formats:
FormatExtensionProcessing
PDF.pdfText extraction with layout preservation
Markdown.mdHeaders preserved as metadata
Plain Text.txtDirect chunking
Word.docxFull formatting support
HTML.htmlTags stripped, content preserved
CSV.csvRow-based chunking
Documents are automatically chunked and embedded when uploaded.

Connecting to Agent

Navigate to Agent SettingsKnowledge Bases
  1. Select toolkit: xpander built-in vector database
  2. Click Add knowledge base
  3. Select your knowledge base from dropdown
  4. Click Add
Your agent now has access to search this knowledge base during conversations.
Connect Knowledge Base to Agent

How It Works

When users send messages, the agent:
  1. Receives user query
  2. Searches knowledge base using vector similarity
  3. Retrieves relevant document chunks
  4. Uses retrieved context to generate response
Example from logs:
DEBUG Tool Calls:
  - Name: 'search_knowledge_base'
    Arguments: 'query: Thai recipes overview'

DEBUG Time to get references: 1.0603s

DEBUG [
  {
    "content": "Pad Thai Goong Sod - Thai Fried Noodles with Shrimps...",
    "score": 78.13
  }
]
The agent automatically uses search_knowledge_base tool when it needs information from your documents.

Testing Knowledge Base

Navigate to Agent PreviewTester Chat Test queries like:
  • “What information do you have?”
  • “Search for [topic] in your knowledge base”
  • “Tell me about [specific document content]“
Test Knowledge Base in Chat

API Access

Use REST endpoints for programmatic access:
curl -X POST https://api.xpander.ai/v1/knowledge \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product Documentation",
    "description": "Technical docs and guides"
  }'
Search Parameters:
ParameterTypeDefaultDescription
search_querystringrequiredQuery to search in the vector database
top_kinteger10Number of top results to return
use_bubblebooleanfalseReturn result capped with padding
bubble_sizeinteger1000Bubble size (padding + result + margin)