Skip to main content
When an agent needs information, it searches for relevant chunks rather than loading everything into the prompt. This keeps responses focused and efficient.

How Search Works

1

Query Analysis

The agent analyzes the user’s question to understand what information would help.
2

Search Execution

The system runs vector, keyword, or hybrid search based on configuration.
3

Retrieval

The knowledge base returns the most relevant content chunks.
4

Response Generation

Retrieved information is combined with the question to generate a response.

Search Types

Finds content by meaning, not exact words. When you ask “How do I reset my password?”, it finds documents about “changing credentials” even if those exact words don’t appear.
Best for: Conceptual questions where users phrase things differently than your docs. Classic text search that matches exact words and phrases. Uses your database’s full-text search or keyword matching capabilities.
Best for: Specific terms, product names, error codes, technical identifiers. Combines vector similarity with keyword matching. Usually the best choice for production.
Best for: Most real-world applications where you want both semantic understanding and exact-match precision.
Start with hybrid search and add a reranker for best results.

Agentic vs Traditional RAG

Traditional RAG always searches with the exact user query and injects results into the prompt. Agentic RAG lets the agent decide when to search, reformulate queries, and run follow-up searches if needed.
With Agentic RAG, the agent can:
  • Skip searching when it already knows the answer
  • Reformulate queries for better results
  • Run multiple searches to gather complete information
  • Combine results from different searches

Filtering Results

Filter searches by metadata to target specific content:
For complex filtering with OR, NOT, and comparisons, see Filtering.

Custom Retrieval Logic

Override the default search behavior with a custom retriever:

Improving Search Quality

Chunk Size

How you split content affects retrieval precision:

Embedding Model

Your embedder converts text into vectors that capture meaning. The right choice depends on your content: See Embedders for available options.

Metadata

Rich metadata enables better filtering:

Content Structure

Well-organized content searches better:
  • Use clear headings and sections
  • Include relevant terminology naturally
  • Add summaries at the top of long documents
  • Use descriptive filenames (hr_vacation_policy_2024.pdf not document1.pdf)

Testing

Test with real queries to validate search quality:

Next Steps

Hybrid Search

Deep dive into combining vector and keyword search

Filtering

Filter results by metadata

Vector DB

Storage options for embeddings

Performance Tips

Optimize for speed and accuracy