Skip to main content
Chunking divides documents into smaller pieces for better retrieval.

Default chunking

from agno.knowledge import Knowledge

knowledge = Knowledge(
    path="docs/",
    vector_db=vector_db,
    chunk_size=1000,  # Characters per chunk
    chunk_overlap=200  # Overlap between chunks
)

Semantic chunking

Use Chonkie for semantic-aware chunking:
from agno.knowledge import Knowledge
from agno.knowledge.chunking.semantic import SemanticChunker

knowledge = Knowledge(
    path="docs/",
    vector_db=vector_db,
    chunker=SemanticChunker()
)

Other chunking strategies

from agno.knowledge.chunking.fixed import FixedChunker
from agno.knowledge.chunking.recursive import RecursiveChunker

# Fixed-size chunks
knowledge = Knowledge(
    path="docs/",
    chunker=FixedChunker(chunk_size=500)
)

# Recursive chunking (splits by paragraphs, then sentences)
knowledge = Knowledge(
    path="docs/",
    chunker=RecursiveChunker()
)
See cookbook examples for patterns.

Build docs developers (and LLMs) love