# "The Simplest RAG Stack That Actually Works Complete Guide"
<!--
ref: @content/youtube/cole-medin/2025-12-10-the-simplest-rag-stack-that-actually-works-complet
version: 4
updated_at: 2026-10-31T19:05:34.677Z
-->

From Cole Medin, 2025-12-10: Hybrid search — running keyword and semantic search together for every query and merging results with Reciprocal Rank Fusion — is the simplest RAG strategy that reliably works across use cases.

Cole Medin walks through a reusable hybrid-search RAG agent template built on MongoDB, Pydantic AI, and Docling, framing it as the simple stack he keeps returning to as his own RAG strategies have matured.

## Core Thesis
Hybrid search — running keyword and semantic search together for every query and merging results with Reciprocal Rank Fusion — is the simplest RAG strategy that reliably works across use cases. Combined with MongoDB's native text + vector capabilities, Pydantic AI for the agent layer, and Docling for ingestion and chunking, you get a fast, citation-ready agent without complex custom infrastructure. Treating search type as an agent-controlled tool parameter turns this into a form of agentic RAG, letting the model pick keyword, semantic, or hybrid based on the question.

## Key Insights
- **Hybrid search beats either mode alone.** Keyword search guarantees exact-match hits (statutes, SKUs, tickers, error codes, year-specific data) but misses synonyms; semantic search captures concepts (king→queen, Han Solo→Chewbacca, "slow PC"→fast-PC articles) but fails on specifics like "2025 revenue."
- **Search type as a tool parameter = agentic RAG.** Exposing `search_type ∈ {keyword, semantic, hybrid}` lets the agent optimize for tokens and latency rather than always running both pipelines.
- **Score incompatibility is the core merge problem.** Vector similarity is bounded 0–1 while keyword scores are unbounded (e.g., 15), so raw comparison is meaningless. Reciprocal Rank Fusion (RRF) solves this by normalizing on rank position, not raw score.
- **MongoDB fits hybrid natively.** Built-in text + vector search, fuzzy matching, and a preview Rank Fusion feature reduce the amount of custom merging code required.
- **Aggregation pipelines do double duty.** They retrieve chunks AND `$lookup`-join them back to source documents, enriching results with provenance metadata so the agent can cite sources (e.g., "internal meeting notes dated January 8th, 2025").
- **Fuzzy matching is non-negotiable.** Typos can appear in user queries, agent-generated terms, OR the underlying knowledge base — edit-distance tolerance is required on all sides.
- **Docling's hybrid chunking removes a hard problem.** Clean chunk boundaries out of the box across PDFs, Word, Markdown, and audio, eliminating the need for custom splitters.
- **Performance holds up.** Even with two pipelines plus RRF, full retrieval (including merge) completes in under a second; tool-call decision time exceeds tool execution time.

## Actionable Takeaways
1. Default agents to hybrid search, but expose `search_type` as a tool parameter and teach the model in the system prompt when specificity (keyword) vs. conceptual breadth (semantic) is needed.
2. Always enable fuzzy matching on text indexes to absorb typos from any source.
3. Set `match_count = 10` per strategy before fusion as a sensible default.
4. Implement RRF yourself for free-tier MongoDB; watch for native Rank Fusion (currently preview) for production simplification.
5. Use `$lookup` to join chunks back to parent documents in the aggregation pipeline so every retrieved chunk carries source metadata for citations.
6. Adopt Docling's hybrid chunking instead of writing custom splitters — it handles PDFs, Word, Markdown, and audio natively.
7. Structure the agent as: separate semantic + keyword aggregation pipelines (swap only the lookup stage) → RRF merge by rank → return enriched chunks to the LLM.
8. Use the linked template repo as a starter and port the pattern to alternative stacks if MongoDB isn't an option.

## Notable Quotes
> "We're going to get the best of both worlds here because we're going to use both strategies for every single search, but it's still going to be fast."

> "As I've been evolving my own RAG strategies, I've also been simplifying things, just putting more and more focus into the strategies like hybrid search that just works so well no matter the use case."

> "Classic RAG will often fail with this because if you have a lot of different years worth of data in your knowledge base, it might find 2023 revenue instead of 2025."

> "How do we know if a score of 15 for text search is more relevant than a 0.85 for vector search?"

> "The real power of MongoDB comes out because not only can we pull specific data and search for it... but we can also transform it into the exact structure that is optimal for our AI agent."

> "It takes more time to decide the tool call than it does to even finish the tool call."

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*