Documentation Index
Fetch the complete documentation index at: https://docs.agno.com/llms.txt
Use this file to discover all available pages before exploring further.
Build an agent that answers questions about your documents.
Create an Agent with Knowledge
from agno.agent import Agent
from agno.knowledge.embedder.google import GeminiEmbedder
from agno.knowledge.knowledge import Knowledge
from agno.models.google import Gemini
from agno.vectordb.chroma import ChromaDb
from agno.vectordb.search import SearchType
# Create a knowledge base with ChromaDB
knowledge = Knowledge(
vector_db=ChromaDb(
collection="docs",
path="tmp/chromadb",
persistent_client=True,
search_type=SearchType.hybrid,
embedder=GeminiEmbedder(id="gemini-embedding-001"),
),
)
# Load content into the knowledge base
knowledge.insert(url="https://docs.agno.com/introduction.md", skip_if_exists=True)
# Create an agent that searches the knowledge base
agent = Agent(
model=Gemini(id="gemini-3-flash-preview"),
knowledge=knowledge,
search_knowledge=True,
markdown=True,
)
agent.print_response("What is Agno?", stream=True)
Setup
Create virtual environment
uv venv --python 3.12
source .venv/bin/activate
Install dependencies
uv pip install -U agno chromadb google-genai
Export your API key
export GOOGLE_API_KEY=your-google-api-key
Run the agent
python knowledge_agent.py
The agent searches the knowledge base, finds relevant content, and answers based on what it found.
Load Different Content Types
knowledge.insert(path="docs/product-guide.pdf")
knowledge.insert(path="data/") # Entire directory
knowledge.insert(url="https://example.com/docs.pdf")
knowledge.insert(text_content="Your content here...")
Agno detects file types automatically and uses the appropriate reader for PDFs, DOCX, CSV, Markdown, and more.
What’s Happening
- Insert: Content is chunked, embedded with Gemini, and stored in ChromaDB
- Query: The agent receives your question and decides to search the knowledge base using the
search_knowledge_base tool
- Response: The agent uses the retrieved content to answer, grounding its response in your data
This is Agentic RAG. The agent decides when to search rather than blindly injecting context on every query.
Next Steps
Agents with Knowledge
Agentic RAG, traditional RAG, reranking
Teams with Knowledge
Distributed search, coordinated RAG
Vector Stores
PgVector, Pinecone, Weaviate, and 20+ more
Search & Retrieval
Vector, keyword, and hybrid search