agentbreeder

Knowledge Bases — Lifecycle & Registry

Create indexes, ingest documents, run hybrid search, and wire knowledge bases into agents.

Knowledge Bases — Lifecycle & Registry

Knowledge bases (RAG indexes) let agents retrieve context from your documents before answering. AgentBreeder handles chunking, embedding, and hybrid search — you just upload files and reference the index in agent.yaml.


How It Works

Your documents (PDF, MD, CSV, JSON)

   Chunking (fixed-size or recursive)

   Embedding (text-embedding-3-small by default)

   Vector store (in-memory or pgvector)

   Hybrid search (vector + full-text, 70/30 default)

   Agent receives top-k chunks as context

Step 1 — Create an Index

Go to Registry → Knowledge Bases → New Index. Configure:

FieldDefaultDescription
NamerequiredSlug-friendly (e.g., product-docs)
Embedding modelopenai/text-embedding-3-smallModel used to embed chunks
Chunk strategyrecursivefixed_size or recursive (splits on semantic boundaries)
Chunk size512 tokensNumber of tokens per chunk
Chunk overlap64 tokensOverlap between adjacent chunks

Click Create Index.

curl -X POST http://localhost:8000/api/v1/rag/indexes \
  -H "Content-Type: application/json" \
  -d '{
    "name": "product-docs",
    "description": "Product documentation and FAQs",
    "embedding_model": "openai/text-embedding-3-small",
    "chunk_strategy": "recursive",
    "chunk_size": 512,
    "chunk_overlap": 64,
    "source": "manual"
  }'

Response:

{
  "data": {
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "name": "product-docs",
    "description": "Product documentation and FAQs",
    "embedding_model": "openai/text-embedding-3-small",
    "chunk_strategy": "recursive",
    "chunk_size": 512,
    "chunk_overlap": 64,
    "document_count": 0,
    "chunk_count": 0,
    "status": "active",
    "created_at": "2026-04-14T00:00:00Z"
  }
}

Step 2 — Ingest Documents

Upload files to the index. Supported formats: .pdf, .txt, .md, .csv, .json.

Open the index → click Upload Documents → drag and drop files.

The dashboard shows a live ingestion progress bar:

✅ Chunking...   14 chunks from docs/product-guide.pdf
✅ Embedding...  14 chunks embedded
✅ Stored        14 chunks indexed
# Upload one or more files
curl -X POST http://localhost:8000/api/v1/rag/indexes/{index_id}/ingest \
  -F "files=@docs/product-guide.pdf" \
  -F "files=@docs/faq.md" \
  -F "files=@data/pricing.csv"

Response (ingestion job):

{
  "data": {
    "id": "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy",
    "index_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "status": "processing",
    "total_files": 3,
    "processed_files": 0,
    "total_chunks": 0,
    "error": null,
    "started_at": "2026-04-14T00:00:00Z",
    "completed_at": null
  }
}

Poll for completion:

GET /api/v1/rag/indexes/{index_id}/ingest/{job_id}
# status: "pending" | "processing" | "completed" | "failed"

Step 3 — Search the Index

Test retrieval before wiring the index to an agent.

curl -X POST http://localhost:8000/api/v1/rag/search \
  -H "Content-Type: application/json" \
  -d '{
    "index_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "query": "What is the refund policy for annual subscriptions?",
    "top_k": 5,
    "vector_weight": 0.7,
    "text_weight": 0.3
  }'

Response:

{
  "data": {
    "index_id": "xxxxxxxx-...",
    "query": "What is the refund policy for annual subscriptions?",
    "top_k": 5,
    "results": [
      {
        "chunk_id": "chunk-001",
        "text": "Annual subscribers are eligible for a full refund within 30 days...",
        "metadata": { "source": "faq.md", "chunk_index": 12 },
        "score": 0.94,
        "similarity": 0.91
      }
    ],
    "total": 5
  }
}

Score is the combined hybrid score (vector similarity × vector_weight + text score × text_weight).


Step 4 — Use in agent.yaml

name: support-agent
version: 1.0.0
framework: claude_sdk

knowledge_bases:
  - ref: kb/product-docs         # ← resolves from registry at deploy time
  - ref: kb/return-policy

# At runtime, the agent automatically queries all attached
# knowledge bases and includes the top-k chunks as context
# before sending the user's message to the model.

Multiple knowledge bases

You can attach multiple knowledge bases to one agent. Each base is queried independently and the top-k results from all bases are merged and ranked before being included in the agent's context window.


Chunking Strategies

StrategyHow it worksBest for
fixed_sizeSplit every N tokens with O-token overlapStructured data, code, tables
recursiveSplit on \n\n, \n, ., in order — keeps paragraphs intactProse, documentation, FAQs

Choosing the wrong strategy can hurt retrieval quality — recursive is the better default for most text.


Embedding Models

The embedding_model field accepts any provider/model-id string:

ValueDimensionsNotes
openai/text-embedding-3-small1536Default — best cost/quality balance
openai/text-embedding-3-large3072Higher quality, higher cost
ollama/nomic-embed-text768Local, no API key needed
ollama/mxbai-embed-large1024Larger local model

Changing the embedding model

If you change embedding_model after ingesting documents, you must re-ingest all files. Vectors from different models are not compatible.


RAG YAML Schema (standalone rag.yaml)

You can define knowledge bases as standalone YAML files in version control:

spec_version: v1
name: product-docs
version: 1.0.0
description: Product documentation and FAQs
team: customer-success
owner: alice@company.com

backend: in_memory           # in_memory | pgvector

embedding_model:
  provider: openai
  name: text-embedding-3-small
  dimensions: 1536

chunking:
  strategy: recursive        # fixed_size | recursive
  chunk_size: 512
  chunk_overlap: 64

sources:
  - type: file
    path: "docs/**/*.md"     # glob pattern
  - type: file
    path: "docs/**/*.pdf"

search:
  hybrid: true
  vector_weight: 0.7
  text_weight: 0.3
  default_top_k: 5

API Reference

MethodPathDescription
POST/api/v1/rag/indexesCreate a new vector index
GET/api/v1/rag/indexesList all indexes (paginated)
GET/api/v1/rag/indexes/{id}Get index metadata
DELETE/api/v1/rag/indexes/{id}Delete index and all its chunks
POST/api/v1/rag/indexes/{id}/ingestUpload files and start ingestion
GET/api/v1/rag/indexes/{id}/ingest/{job_id}Poll ingestion job status
POST/api/v1/rag/searchHybrid search (vector + full-text)

agent.yaml knowledge_bases field

knowledge_bases:
  - ref: string    # required — registry reference (kb/name)
FieldTypeRequiredDescription
refstringYesRegistry reference in format kb/{name}

Next Steps

WhatWhere
Add tools to your agentTools →
Connect MCP serversMCP Servers →
Register system promptsPrompts →
Full agent.yaml fieldsagent.yaml Reference →

On this page