Skip to main content

What You’ll Build

A research agent that merges your internal data (from a vector store, database, or any retrieval system) with live web research from Tavily. You provide a simple RAG function — the agent identifies gaps in your internal knowledge and fills them with web data, producing a comprehensive report with citations.

View Source on GitHub

Why Hybrid Research?

Your internal data is your competitive edge — customer records, product specs, domain expertise. But it’s never complete. Markets shift, competitors launch products, and your knowledge base can’t keep up. The hybrid approach gives you:
  • Grounded answers rooted in your proprietary data
  • Complete coverage with real-time web context
  • Enrichment opportunities by storing relevant web findings back into your knowledge base

Modes

Best for quick answers, lower latency, and cost-sensitive applications.
  1. Query your internal RAG
  2. Generate subqueries based on what’s missing
  3. Parallel web search with deduplication
  4. Synthesize everything into a report

Parameters

Return Value

Structured Output

Use output_schema to get consistent, parseable results:

Custom Synthesis

Guide how the report is structured with research_synthesis_prompt:

Data Enrichment Pattern

When your agent searches the web to fill knowledge gaps, those results are relevant to your users — otherwise the agent wouldn’t have needed them. This creates a flywheel:
  1. Agent queries internal data and finds gaps
  2. Agent searches the web to fill gaps
  3. Web results get synthesized into the answer
  4. Store those web results internally for future queries
Over time, your knowledge base grows with exactly the information your users need.

Implementing Your RAG Function

The internal_rag_function is simple: take a query, return relevant context as a string.
Tips:
  • Return 3-10 relevant chunks — enough context without overwhelming
  • Include source metadata (file names, URLs, doc IDs) for traceability
  • The hybrid researcher handles the rest: gap detection, web search, synthesis

Next Steps

Tools Reference

Deep dive into search_and_answer, search_dedup, and the other retrieval primitives.

Chatbot

See how the chatbot routes between quick search and deep research.