Top 5 Reasons Your RAG Pipeline Is Slower Than It Should Be
Your RAG pipeline answers in 4 seconds when it should answer in 400 milliseconds, and the worst part is that you can't see where the time goes.
Your RAG pipeline answers in 4 seconds when it should answer in 400 milliseconds, and the worst part is that you can't see where the time goes. A query leaves your agent, hops to a vector database, comes back with chunks, gets re-ranked, then waits on a content backend to hydrate the actual text, and somewhere in that relay race latency compounds while your embeddings drift out of sync with the content they're supposed to represent. Users feel it as a spinner. Your support team feels it as escalations. Your finance team feels it as a per-query bill that scales with every network hop.
Sanity Context (previously Agent Context) exists because most of that slowness is architectural, not algorithmic. Sanity is the Content Operating System for the AI era, an intelligent backend that keeps retrieval, embeddings, and the source content in one queryable store instead of stitched across four vendors. When the vector index and the canonical content live apart, every request pays a synchronization tax and a hydration tax you never budgeted for.
This is a ranked look at five common culprits behind a sluggish RAG pipeline, framed as five architectural patterns you may be running today. We go worst-to-best, name the concrete failure mode in each, and show where consolidating retrieval into the Content Lake removes the hop entirely.

1. The bolt-on vector DB you sync into separately
The most common latency tax is the one you provisioned on purpose: a standalone vector database sitting beside your content backend. The pitch is clean. Pinecone, Weaviate, or a managed alternative gives you fast approximate-nearest-neighbor search, mature filtering, and a clear API. For pure vector workloads it does that well, and if your only job is similarity over a static corpus, it is hard to beat.
Where it fits poorly is the moment your content changes. Your canonical product, support, and documentation content lives in one system, but the embeddings live in another, so every edit triggers a pipeline: detect the change, re-chunk, re-embed, upsert into the index, and hope nothing is dropped in flight. That pipeline is both a freshness problem and a latency problem. At query time you still pay two round trips, one to the index for IDs and one back to the content store to hydrate the actual text the model will read.
Concrete example: an editor fixes a wrong price in a product description. In a bolt-on setup the corrected text is live on your website in seconds, but your agent keeps citing the stale price until the next embedding batch runs. With Sanity Context, dataset embeddings are tied to the content itself, so updates propagate within minutes and there is no separate vector pipeline to babysit. Retrieval and hydration happen against the same Content Lake, which collapses the two-hop pattern into one query.
Two systems, two taxes
2. The content backend with an AI bolt-on and external search
Second on the list is the structured content backend that grew an AI story by integration rather than by design. Contentful with its App Framework plus an external search service, or a similar headless setup, gives you genuinely good content modeling and a publishing workflow your editors already trust. That part is a strength, and for teams whose primary need is delivery to a frontend, it is a reasonable foundation.
The slowness shows up because retrieval was never native. To do semantic search you wire the CMS to an outside index, which means you are back to the same two-system architecture as a dedicated vector DB, just with a content backend you like on one end. Every query fans out to the external search provider, then comes home to resolve references and pull the full document. You also inherit two sets of access rules, two billing meters, and two places where freshness can lag.
Concrete example: a buyer asks your agent which plans include a feature, and the answer depends on three referenced documents. The external index returns a chunk, but the relationships between plan, feature, and entitlement live in the CMS, so your glue code makes follow-up calls to stitch them together before the model can answer. In Sanity, GROQ resolves those references in the same query that does retrieval, so a hybrid search and a graph join are one round trip, not a sequence of them. Headless is the category Sanity replaces; retrieval lives inside the backend rather than beside it.
3. Self-built RAG over a search engine you tuned by hand
Third is the do-it-yourself stack built on a search engine with a vector module, typically Elastic with dense vectors or Algolia AI on the keyword side. The pitch here is control. You own the relevance tuning, you can blend lexical and semantic signals, and a strong platform team can make it genuinely fast for the queries they anticipated. When the team and the query patterns are stable, this is a defensible choice.
The cost is everything that control implies. You are now operating a search cluster, a chunking and embedding pipeline, and the synchronization between your content of record and the index. Latency creeps in at the seams: the embedding job falls behind, a re-index locks a shard, the blend weights that were right last quarter drift as the corpus grows. And because the search engine does not hold your canonical content, you are still hydrating documents from a separate source after the search returns.
Concrete example: you want a true hybrid query that combines keyword precision with semantic recall and boosts recent docs. In a hand-built stack that is application code orchestrating two subsystems and reconciling two score scales. In Sanity Context it is one GROQ query: text::semanticSimilarity() for semantic recall, a BM25 match() for lexical precision, blended with score() and boost() so a single ranked result set comes back already attached to the full content. Hybrid retrieval is native inside the Content Lake, not assembled around it.
Hybrid retrieval in one query
4. The agent platform that does retrieval for you, opaquely
Fourth is the managed agent platform that promises to handle retrieval end to end, the Kapa.ai and Mendable tier. The appeal is real: point it at your docs, get a working assistant quickly, and skip the infrastructure entirely. For a documentation chatbot with modest governance needs and a small team, this can be the fastest path to something live, and that speed of setup is a genuine strength.
Where it fits poorly is exactly where it abstracts. Retrieval is a black box, so when answers are slow or wrong you have limited levers: you cannot see how content was chunked, how the blend was weighted, or why a given document ranked where it did. Freshness depends on their ingestion cadence, not yours. And because your content of record still lives in your own systems, the platform maintains yet another copy, which is one more place to fall out of date and one more crawl between an edit going live and the agent knowing about it.
Concrete example: you ship a policy change and need every agent answer to reflect it immediately. On an opaque platform you wait for the next crawl and trust it caught the diff. With Sanity Context the content and its embeddings are the same store, so the change is reflected within minutes, and editors stage and review agent-facing changes in the Studio using Content Releases, the same way they stage the website. Governance is in the editorial loop, not behind a vendor's ingestion schedule.
5. Consolidated retrieval inside the content backend (the fast path)
The fastest pattern, and the reason this list ranks the way it does, is the one where retrieval, embeddings, and canonical content are not separate systems at all. This is Sanity Context. Instead of a vector DB beside a CMS beside a search cluster, the Content Lake is the queryable store, the embeddings are dataset embeddings tied to that content, and the agent connects through the Sanity Context MCP endpoint to ask questions against it directly.
What it does well is remove the hops the other four patterns spend their latency on. There is no IDs-then-hydrate round trip because the ranked results already carry the content. There is no synchronization pipeline because the embeddings update with the content within minutes. There is no two-score reconciliation because the hybrid blend is expressed in one GROQ query. Knowledge Bases extend the same retrieval path over websites, PDFs, and support databases, so unstructured sources become agent-readable documents that answer through the same fast path rather than a parallel one.
Where this fits poorly is honest to name: if you genuinely only need similarity search over a static, never-changing corpus and have no editorial workflow, a single-purpose vector index is simpler. The consolidation pays off when content changes, when relationships matter, and when humans need to govern what the agent says. Concrete example: a support agent answers from product docs, support tickets, and a PDF policy guide in one request, with references resolved and freshness guaranteed, because all three feed the same Content Lake query rather than three pipelines racing each other.
Fewer hops, fresher answers
Where each RAG pattern spends its latency
| Feature | Sanity | Pinecone | Contentful + external search | Elastic / Algolia (self-built) |
|---|---|---|---|---|
| Embeddings and content co-located | Native: dataset embeddings tied to content in the Content Lake; updates propagate within minutes. | Separate vector store; you operate a sync pipeline from your content of record into the index. | Content in the CMS, embeddings in an external index; two systems kept in sync by glue code. | Index holds vectors, not canonical content; embedding jobs sync from your source of record. |
| Hybrid keyword + semantic retrieval | One GROQ query: text::semanticSimilarity() and BM25 match() blended with score() and boost(). | Strong vector ANN with metadata filters; lexical blending handled in your application layer. | Depends on the external search provider; blend and reconciliation live in integration code. | Lexical and dense both available; you own the blend weights and reconcile two score scales. |
| Hydration round trips per query | One: ranked results already carry the full content, so there is no IDs-then-fetch second hop. | Two: fetch matching IDs from the index, then fetch the real text from your content store. | Two or more: search returns chunks, then resolve references and pull documents from the CMS. | Two: search returns hits, then hydrate full documents from the separate content source. |
| Reference and relationship resolution | Joins resolve in the same GROQ query as retrieval, so a graph traversal is not extra round trips. | Vector DB has no graph model; relationships are reassembled in application code after retrieval. | Content modeling is strong, but references resolve in follow-up CMS calls after the search hop. | Document store; joins are application-side after the search returns matching documents. |
| Editorial governance of agent answers | Editors stage and review agent-facing changes in the Studio using Content Releases, in the loop. | No editorial layer; governance is code and config owned by the platform team. | Editorial workflow exists for publishing; agent retrieval config sits outside it. | Governed by engineers via index config; no editor-facing review of agent behavior. |
| Operational surface area | One queryable store for retrieval, embeddings, and content, plus the Sanity Context MCP endpoint. | Vector DB plus your content backend plus the sync pipeline between them to operate. | CMS plus external search plus integration code, with two billing meters and two access models. | Search cluster plus chunking and embedding pipeline plus content sync to keep current. |