How Agents Search Knowledge
Think of an agent’s search process like a skilled researcher who knows what to look for and where to find it:1
Query Analysis
The agent analyzes the user’s question to understand what type of
information would be helpful.
2
Search Strategy
Based on the analysis, the system formulates one or more searches (vector,
keyword, or hybrid).
3
Information Retrieval
The knowledge base returns the most relevant content chunks.
4
Context Integration
The retrieved information is combined with the original question to generate
a comprehensive response.
Agentic Search: The Smart Difference
What makes Agno’s approach special? Agents can programmatically decide when to search and how to use results. Think of it as giving your agent the keys to the library instead of handing it a fixed stack of books. You can even plug in custom retrieval logic to match your specific needs. Key capabilities:- Automatic Decision Making - The agent can choose to search when it needs additional information—or skip it when not necessary.
- Smart Query Generation - Implement logic to reformulate queries for better recall—like expanding “vacation” to include “PTO” and “time off.”
- Multi-Step Search - If the first search isn’t enough, run follow-up searches with refined queries.
- Context Synthesis - Combine information from multiple results to produce a thorough, grounded answer.
Traditional RAG vs. Agentic RAG
Here’s how they compare in practice:- Traditional RAG
- Agentic RAG
Configuring Search in Agno
You configure search behavior on your vector database, and Knowledge uses those settings when retrieving documents. It’s a simple setup:Types of Search Strategies
Agno gives you three main approaches. Pick the one that fits your content and how users ask questions:Vector Similarity Search
Finds content by meaning, not just matching words. When you ask “How do I reset my password?”, it finds documents about “changing credentials” even though the exact words don’t match. How it works:- Your query becomes a vector (list of numbers capturing meaning)
- The system finds content with similar vectors
- Results are ranked by how close the meanings are
Keyword Search
Classic text search—looks for exact words and phrases in your content. When using PgVector, this leverages Postgres’s full-text search under the hood. How it works:- Matches specific words and phrases
- Supports search operators (where your backend allows)
- Works great when users know the exact terminology
Hybrid Search
The best of both worlds—combines semantic understanding with exact-match precision. This is usually your best bet for production. How it works:- Runs both vector similarity and keyword matching
- Merges results intelligently
- Can add a reranker on top for even better ordering
We recommend starting with hybrid search with reranking for strong
recall and precision.
What Affects Search Quality
Content Chunking Strategy
How you split your content matters a lot:- Smaller chunks (200-500 chars): Super precise, but might miss the big picture
- Larger chunks (1000-2000 chars): Better context, but less targeted
- Semantic chunking: Splits at natural topic boundaries—usually the sweet spot
Embedding Model Quality
Your embedder is what turns text into vectors that capture meaning:- General-purpose (like OpenAI’s text-embedding-3-small): Works well for most content
- Domain-specific: Better for specialized fields like medical or legal docs
- Multilingual: Essential if you’re working in multiple languages
Practical Configuration
Making Search Work Better
Add Rich Metadata
Metadata helps filter and organize results:Use Descriptive Filenames
File names can help with search relevance in some backends:Structure Content Logically
Well-organized content searches better:- Use clear headings and sections
- Include relevant terminology naturally (don’t keyword-stuff)
- Add summaries at the top of long documents
- Cross-reference related topics
Test with Real Queries
The best way to know if search is working? Try it with actual questions:Analyze What’s Being Retrieved
Ask yourself:- Are results actually relevant to the query?
- Is important information missing from results?
- Are results in a sensible order? (If not, try adding a reranker)
- Should you adjust chunk sizes or metadata?
Advanced Search Features
Custom Retrieval Logic for Agents
Provide aknowledge_retriever
callable to implement your own decisioning (e.g., reformulation, follow-up searches, domain rules). The agent will call this when fetching documents.
Search with Filtering
Restrict results to subsets based on metadata you stored with documents.Working with Different Content Types
Use appropriate readers; they handle parsing their formats.Best Practices for Search & Retrieval
Content Strategy
- Organize logically; group related content
- Use consistent terminology
- Include context and cross-references
- Keep content current; retire outdated docs
Technical Optimization
- Choose appropriate chunk sizes and strategies
- Select a quality embedder for your domain
- Configure VectorDB search type (vector/keyword/hybrid)
- Add a reranker for better ordering
Monitoring and Improvement
- Test with real user queries regularly
- Observe what agents retrieve
- Gather feedback when answers lack context
- Iterate on chunking, metadata, and search configuration