The most important thing to understand with this guide is the strategies I cover here can be combined with others I have shown like agentic RAG and knowledge graphs. You don’t have to just use one!
Basic Retrieval Augmented Generation (RAG) is simply not enough. If you’re building AI agents that need accurate information retrieval, you know this and you’ve probably learned it the hard way. One of the biggest problems is you lose crucial context when chunking documents – and I have a solution for that!
This video is a step by step guide where I’ll show you in n8n how to implement Contextual Retrieval (specifically contextual embeddings) – a technique introduced by Anthropic that reduces retrieval failures significantly, especially combined with a couple other techniques. The best part is it’s super simple to implement!
This approach works with any vector database, any LLM, and any set of documents or data you have for RAG. I even show quickly at the end of this video how I implemented Contextual Retrieval in Python for my Crawl4AI RAG MCP server!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you want to build production AI agents and applications with a highly scalable and reliable database, check out Neon (serverless Postgres):
And here is their MCP server to manage your database with natural language:
https://github.com/neondatabase-labs/mcp-server-neon
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Contextual Retrieval RAG AI agent built in this video:
https://github.com/coleam00/ottomator-agents/tree/main/contextual-retrieval-n8n-agent
Anthropic article on Contextual Retrieval:
https://www.anthropic.com/news/contextual-retrieval
The Crawl4AI RAG MCP Server:
https://github.com/coleam00/mcp-crawl4ai-rag
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00:00 – Understanding Basic RAG and Why It’s not Enough
02:27 – Introducing Contextual Retrieval
04:21 – How Contextual Retrieval Works
08:09 – Contextual Retrieval Implementation in n8n
16:28 – My Choice of a Database
18:25 – Our RAG AI Agent
20:11 – Testing Our Agent with Contextual Retrieval
22:11 – Future Improvements to Build on Contextual Retrieval
23:25 – Adding Contextual Retrieval to the Crawl4AI RAG MCP Server
25:37 – Final Thoughts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Join me as I push the limits of what is possible with AI. I’ll be uploading videos at least two times a week – Sundays and Wednesdays at 7:00 PM CDT!
source