The Knowledge Pipeline: Three Simple Steps
1
Store: Break Down and Index Information
Your documents, files, and data are processed by specialized readers, broken into chunks using configurable strategies, and stored in a vector database with their meanings captured as embeddings.Example: A 50-page employee handbook is processed by Agno’s PDFReader, chunked using SemanticChunking strategy, and becomes 200 searchable chunks with topics like “vacation policy,” “remote work guidelines,” or “expense procedures.”
2
Search: Find Relevant Information
When a user asks a question, the agent automatically searches the knowledge base using Agno’s search methods to find the most relevant information chunks.Example: User asks “How many vacation days do I get?” → Agent calls
knowledge.search()
and finds chunks about vacation policies, PTO accrual, and holiday schedules.3
Generate: Create Contextual Responses
The agent combines the retrieved information with the user’s question to generate an accurate, contextual response, with sources tracked through Agno’s content management system.Example: “Based on your employee handbook, full-time employees receive 15 vacation days per year, accrued monthly at 1.25 days per month…”
Vector Embeddings and Search
Think of embeddings as a way to capture meaning in numbers. When you ask “What’s our refund policy?”, the system doesn’t just match the word “refund”—it understands you’re asking about returns, money back, and customer satisfaction. That’s because text gets converted into vectors (lists of numbers) where similar meanings cluster together. “Refund policy” and “return procedures” end up close in vector space, even though they don’t share exact words. This is what enables semantic search beyond simple keyword matching.Setting Up Knowledge in Code
Here’s how you connect the pieces to build a knowledge-powered agent:Smart Defaults: Agno provides sensible defaults to get you started quickly:
- Embedder: If no embedder is specified, Agno automatically uses
OpenAIEmbedder
with default settings - Chunking: If no chunking strategy is provided to readers, Agno defaults to
FixedSizeChunking(chunk_size=5000)
- Search Type: Vector databases default to
SearchType.vector
for semantic search
What Happens When You Add Content
When you callknowledge.add_content()
, here’s what happens:
- A reader parses your file - Agno picks the right reader (PDFReader, CSVReader, WebsiteReader, etc.) based on your file type and extracts the text
- Content gets chunked - Your chosen chunking strategy breaks the text into digestible pieces, whether by semantic boundaries, fixed sizes, or document structure
- Embeddings are created - Each chunk is converted into a vector embedding using your embedder (OpenAI, SentenceTransformer, etc.)
- Status is tracked - Content moves through states: PROCESSING → COMPLETED or FAILED
- Everything is stored - Chunks, embeddings, and metadata all land in your vector database, ready for search
What Happens During a Conversation
When your agent receives a question:- The agent decides - Should I search for more context or answer from what I already know?
- Query gets embedded - If searching, your question becomes a vector using the same embedder
- Similar chunks are found -
knowledge.search()
orknowledge.async_search()
finds chunks with vectors close to your question - Filters are applied - Any metadata filters you configured narrow down the results
- Agent synthesizes the answer - Retrieved context + your question = accurate, grounded response
Key Components Working Together
- Readers - Agno’s reader factory provides specialized parsers: PDFReader, CSVReader, WebsiteReader, MarkdownReader, and more for different content types.
- Chunking Strategies - Choose from FixedSizeChunking, SemanticChunking, or RecursiveChunking to optimize how documents are broken down for search.
- Embedders - Support for OpenAIEmbedder, SentenceTransformerEmbedder, and other embedding models to convert text into searchable vectors.
- Vector Databases - PgVector for production, LanceDB for development, or PineconeDB for managed services - each with hybrid search capabilities.
Choosing Your Chunking Strategy
How you split content dramatically affects search quality. Agno gives you several strategies to match your content type:- Fixed Size - Splits at consistent character counts. Fast and predictable, great for uniform content
- Semantic - Uses embeddings to find natural topic boundaries. Best for complex docs where meaning matters
- Recursive - Respects document structure (paragraphs, sections). Good balance of speed and context
- Document - Preserves natural document divisions. Perfect for well-structured content
- CSV Row - Treats each row as a unit. Essential for tabular data
- Markdown - Honors heading hierarchy. Ideal for documentation
Managing Your Knowledge Base
Once content is loaded, you’ll want to check status, search, and manage what’s there:Use
knowledge.get_content_status()
to debug when content doesn’t appear in search results. It’ll tell you if processing failed or is still in progress.Automatic vs Manual Search
Agno gives you two ways to use knowledge with agents: Agentic Search (search_knowledge=True
):
The agent automatically decides when to search and what to look for. This is the recommended approach for most use cases - it’s smarter and more dynamic.
Traditional RAG (add_knowledge_to_context=True
):
Relevant knowledge is always added to the agent’s context. Simpler but less flexible. Use this when you want predictable, consistent behavior.