Quickstart

Build a knowledge-powered agent in under 5 minutes.

Build an agent that answers questions about your documents.

Create an Agent with Knowledge

knowledge_agent.py
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/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

The following PDF examples require pypdf. Install readers for additional types when needed:

uv pip install -U pypdf python-docx aiofiles

These 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

Agno detects file types automatically and uses the appropriate reader for PDFs, DOCX, CSV, Markdown, and more.

What's Happening

  1. Insert: Content is chunked, embedded with Gemini, and stored in ChromaDB
  2. Query: The agent receives your question and decides to search the knowledge base using the search_knowledge_base tool
  3. 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