Knowledge Bases

Knowledge Bases

Knowledge bases are collections of content sources that power AI agents with contextual information. They index content, generate vector embeddings, and provide intelligent retrieval capabilities.

What are Knowledge Bases?

A knowledge base is an organized collection of content sources that provides:

  • Interactive Chat — Ask questions and have conversations with your indexed content using built-in RAG
  • Vector Embeddings — AI-powered content representations for similarity matching
  • Agent Context — Provide agents with relevant information automatically
  • Content Triggers — Automatically run agents when content changes
  • Multi-Source Indexing — Combine multiple sources into one searchable collection

Knowledge bases act as the "memory" for your AI agents, allowing them to access and reason about your content intelligently.

Creating a Knowledge Base

  1. Navigate to the Knowledge Bases page
  2. Click Create Knowledge Base
  3. Give it a name and optional description
  4. Select one or more content sources to include
  5. Configure retrieval settings (or keep the defaults)

You can add or remove sources at any time after creation.

Retrieval Settings

Each knowledge base has configurable retrieval settings that control how content is returned to agents:

SettingDescriptionDefault
Reranker ModelModel used to rerank search results for relevance
Top NMaximum number of results returned from the initial vector search20
Top KNumber of results kept after reranking5
Score ThresholdMinimum relevance score (0–1) a result must meet to be included0.0

Chat

Every knowledge base has a built-in chat interface that lets you have interactive conversations with your indexed content. The chat uses RAG under the hood — each message triggers a retrieval against the knowledge base, then feeds the relevant content to an LLM to generate a grounded response.

Starting a conversation

Open a knowledge base and switch to the Chat tab. Type a question and press Enter. A new conversation is created automatically, and the response streams back in real time.

Key capabilities:

  • Multiple conversations — Create as many conversations as you need. Each one maintains its own message history and can be renamed, archived, or deleted.
  • Model selection — Choose between Fast (Nova Lite), Balanced (Claude Sonnet), and Thorough (Claude Opus) tiers per message. You can also select a specific model from the full model catalogue.
  • Streaming responses — Responses stream token-by-token so you see results immediately.
  • Conversation management — Rename conversations for easy reference, archive old ones to keep the sidebar clean, or bulk-delete conversations you no longer need.
  • Regenerate responses — If a response isn't satisfactory, regenerate it to get a fresh answer.
  • Copy and feedback — Copy any message to your clipboard, and use the thumbs-up/down feedback buttons to rate response quality.

How it works

When you send a message, Seclai:

  1. Retrieves relevant content chunks from the knowledge base using the configured retrieval settings (Top N, Top K, reranker, score threshold)
  2. Constructs a RAG prompt with the retrieved context and your conversation history
  3. Sends the prompt to the selected model and streams the response back

Conversations persist across sessions — come back any time to continue where you left off.

API Access

Knowledge bases can be managed programmatically via the Public API using your API key:

# List knowledge bases
curl "https://api.seclai.com/knowledge_bases?page=1&limit=20" \
  -H "X-API-Key: $SECLAI_API_KEY"

# Create a knowledge base
curl -X POST https://api.seclai.com/knowledge_bases \
  -H "X-API-Key: $SECLAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Tech News KB",
    "description": "Aggregated tech news sources",
    "source_ids": ["source-id-1", "source-id-2"]
  }'

# Get a knowledge base
curl "https://api.seclai.com/knowledge_bases/$KNOWLEDGE_BASE_ID" \
  -H "X-API-Key: $SECLAI_API_KEY"

# Update a knowledge base
curl -X PUT "https://api.seclai.com/knowledge_bases/$KNOWLEDGE_BASE_ID" \
  -H "X-API-Key: $SECLAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Renamed KB", "top_k": 10}'

# Delete a knowledge base
curl -X DELETE "https://api.seclai.com/knowledge_bases/$KNOWLEDGE_BASE_ID" \
  -H "X-API-Key: $SECLAI_API_KEY"

See API Examples for more examples in multiple languages.

MCP Tools

Knowledge base operations are available as MCP tools for AI coding assistants:

ToolDescription
list_knowledge_basesList knowledge bases with pagination and sorting
get_knowledge_baseGet full details of a knowledge base
create_knowledge_baseCreate a new knowledge base
update_knowledge_baseUpdate a knowledge base's configuration
delete_knowledge_baseDelete a knowledge base
chat_with_knowledge_baseSend a message and get a RAG-powered response
list_kb_conversationsList conversations for a knowledge base
load_kb_chat_messagesLoad messages from a conversation
rename_kb_conversationRename a conversation
delete_kb_conversationDelete a conversation

See MCP Server → Knowledge Base Tools for setup instructions.

Exporting

Export a knowledge base's full content — sources, metadata, and indexed items — as a downloadable JSON file.

  • UI: Open the knowledge base detail page and click the Export button. You'll see an estimate of the export size before confirming.
  • API: POST /authenticated/resource-exports with resource_type: "knowledge_base" and the knowledge base ID.
  • MCP: Use the create_resource_export tool with resource_type: "knowledge_base".

See Export Formats → Knowledge Base for the full file schema and available filter options.

Next Steps