Overview
Give agents access to documents, databases, and domain expertise.
Knowledge gives agents access to information beyond their training data. Load files, URLs, or raw text, and agents can ground responses in retrieved content.
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.vectordb.chroma import ChromaDb
# Create a knowledge base
knowledge = Knowledge(
vector_db=ChromaDb(
collection="docs",
path="tmp/chromadb",
persistent_client=True,
),
)
# Load content
knowledge.insert(url="https://docs.agno.com/introduction.md")
# Create an agent that searches the knowledge base
agent = Agent(knowledge=knowledge, search_knowledge=True)
agent.print_response("What is Agno?")The agent searches its knowledge base and grounds its response in the content.
For a documentation site with llms.txt, use Published Pages to synchronize Markdown and vectors, search sections, and read the page revision behind a result. This mode also offers a read-only page filesystem for explicit retrieval tools.
How It Works
Knowledge combines three components:
-
Content ingestion: Read documents from files, URLs, cloud storage, or raw text. Agno includes readers for PDF, DOCX, CSV, Markdown, and more.
-
Chunking and embedding: Documents are split into searchable chunks and converted to vector embeddings that capture semantic meaning.
-
Search and retrieval: When an agent needs information, it searches the vector database for relevant chunks and includes them in its context.
You can use Agentic RAG (agent decides when to search) or Traditional RAG (always inject context). Agentic RAG is the default and works well for most use cases.
Why Knowledge Matters
Language models have broad general knowledge but lack context about your specific domain. Knowledge bridges this gap by providing relevant information at runtime.
Start with your content. Load company documentation, database schemas, product specs, support FAQs, or research papers. The agent retrieves relevant passages and uses them as context for its response.
Then let agents learn. Agents can write to knowledge as well as search it: save insights they discover and retrieve them later, building expertise across conversations.
def save_learning(title: str, insight: str) -> str:
"""Save a reusable insight to the knowledge base."""
knowledge.insert(name=title, text_content=insight)
return f"Saved: {title}"
agent = Agent(
knowledge=knowledge,
search_knowledge=True,
tools=[save_learning], # Agent can write to knowledge
)The persistent collection keeps saved insights available to later runs.
Examples
Quick Start
Build an agent with knowledge in 5 minutes
Knowledge for Agents
Agentic RAG and traditional RAG
Knowledge for Teams
Shared knowledge bases for multi-agent teams
Concepts
Vector DB
Store and search embeddings
Content DB
Track knowledge contents
Search & Retrieval
Vector, keyword, and hybrid search
Readers
Ingest from various sources
Chunkers
Control document splitting
Embedders
Convert text to vectors
Filtering
Filter results by metadata
Vector Stores
Agno supports 19 vector databases, from local options like LanceDB and ChromaDB to managed services like Pinecone and Weaviate.
All Vector Stores
See supported databases