Quickstart
Build a knowledge-powered agent in under 5 minutes.
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.5-flash"),
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/activateInstall dependencies
uv pip install -U agno chromadb google-genaiExport your API key
export GOOGLE_API_KEY=your-google-api-keyRun the agent
python knowledge_agent.pyThe agent searches the knowledge base, finds relevant content, and answers based on what it found.
Load Different Content Types
The following PDF examples require pypdf. Install readers for additional types when needed:
uv pip install -U pypdf python-docx aiofilesThese packages support PDF, DOCX, and CSV reading respectively. See readers for other formats and requirements.
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_basetool - 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.