Knowledge is the retrieval primitive: a vector index with an optional keyword index and optional reranker. Pal and Dash both use it heavily.
Loading content
Three ways to put content in:--recreate to rebuild from scratch. Without it, content is upserted by primary key.
Chunking and embedding
By default,Knowledge chunks long content into ~500-token segments and embeds each chunk with text-embedding-3-small. Override with:
agno.knowledge.chunking.*: by markdown headers, by code structure, by recursive token count, by semantic boundaries.
Hybrid search
search_type="hybrid" runs both:
| Index | Catches |
|---|---|
| Vector (semantic) | “different words for the same idea” |
| BM25 (keyword) | “find the doc that mentions this exact term” |
Metadata filtering
Metadata attached at ingest time becomes a filter at query time:tenant_id) or topic scoping (filter by category).
When the model gets the chunks
Withadd_knowledge_to_context=True:
- User message arrives.
- AgentOS runs
knowledge.search(message)automatically. - Top-k chunks get inserted into the system prompt.
- The model answers with the chunks visible.
search_knowledge=True:
The agent gets a search_knowledge_base(query) tool. The model decides when to call it. Useful for follow-up retrieval mid-run.
Both flags are common to set together. Auto-search hits first, the tool catches “I need to look up something else” cases.
Reranking
For larger knowledge bases, add a reranker:See it in action
agents/dash/, Knowledge docs