Enterprise RAG Technology Stack: Open-Source vs Cloud
Choose each layer of the enterprise RAG stack, and compare open-source, cloud-managed and hybrid options.
An enterprise RAG system is assembled from many technologies: parsers, embedding models, vector stores, rerankers, LLMs, orchestration frameworks, observability tools and more. For every layer you can choose open-source software you run yourself, a managed cloud service, or a mix. This lesson walks through the stack layer by layer with typical options, then compares open-source, cloud and hybrid approaches so you can choose deliberately.
What you will learn
- The layers of the enterprise RAG technology stack and common options for each
- The trade-offs between open-source, cloud-managed and hybrid approaches
- The questions to ask when choosing each component
- How to keep the stack replaceable with thin interfaces
Prerequisites
The stack, layer by layer
The options below are examples, not endorsements; the landscape changes quickly, so verify current features, pricing and regional availability.
| Layer | Open-source / self-hosted examples | Managed / cloud examples |
|---|---|---|
| Connectors and ingestion | Custom Python connectors, Apache Airflow, framework loaders | Cloud data-integration services, managed RAG data sources |
| Document parsing | PyMuPDF, Unstructured, Docling, Tesseract OCR | Cloud document AI services (AWS, Azure, Google) |
| Embeddings | BGE, E5, GTE and other open models via sentence-transformers | OpenAI, Google, Amazon, Cohere and other embedding APIs |
| Vector and keyword search | PostgreSQL + pgvector, Qdrant, Weaviate, Milvus, OpenSearch | Pinecone, Azure AI Search, managed OpenSearch/Elastic, cloud vector search |
| Reranking | BGE rerankers, cross-encoders from Hugging Face | Cohere Rerank and other reranking APIs |
| LLM | Open-weight models served with vLLM, Ollama or NIM | Anthropic, OpenAI, Google APIs; Amazon Bedrock; Azure OpenAI |
| Orchestration | LangChain, LangGraph, LlamaIndex, Haystack, plain Python | Managed agent and RAG services |
| Serving | FastAPI, Spring Boot, Docker, Kubernetes | Serverless functions, managed containers |
| Observability and evaluation | OpenTelemetry, Langfuse, Phoenix, RAGAS, DeepEval | LangSmith and hosted observability platforms |
| Identity and secrets | Keycloak, HashiCorp Vault | Entra ID, Okta, cloud IAM and secrets managers |
Open-source vs cloud vs hybrid
| Factor | Open-source, self-hosted | Cloud-managed |
|---|---|---|
| Data control | Full: data never leaves your environment | Depends on the provider's terms, region and configuration |
| Time to first version | Slower: you run and patch everything | Faster: provision and call an API |
| Operating effort | High: upgrades, scaling, GPUs, backups | Low to medium |
| Cost profile | Fixed infrastructure and staff; cheap at high, steady volume | Pay per use; cheap to start, can grow with volume |
| Model quality | Strong open models, usually behind the best frontier models | Access to frontier models |
| Customisation | Unlimited | Within service features |
| Lock-in | Low | Higher, especially with managed RAG services |
Most enterprises end up hybrid: open-source parsing, embedding and vector search in their own cloud account (data stays close), a frontier LLM through an enterprise API or cloud platform (quality), and managed identity, secrets and monitoring.
Questions to ask for each component
- Where is data processed and stored, and does that meet our residency and privacy rules?
- What happens to our data: is it retained, logged or used for training?
- Does it support our scale (documents, queries per second) and latency target?
- How does it handle permissions and multi-tenancy?
- What does it cost at today's volume and at ten times that?
- How hard is it to replace? Is there an export path?
- Who will operate it, and do we have those skills?
Keep the stack replaceable
Components will change: a better embedding model, a cheaper LLM, a different vector store. Hide each one behind a small interface that your business logic depends on:
from typing import Protocol
class Embedder(Protocol):
space_id: str
def embed_documents(self, texts: list[str]) -> list[list[float]]: ...
def embed_query(self, text: str) -> list[float]: ...
class SearchIndex(Protocol):
def upsert(self, doc_id: str, chunks: list[dict]) -> None: ...
def delete(self, doc_id: str) -> None: ...
def search(self, query_vector: list[float], query_text: str, filters: dict, k: int) -> list[dict]: ...
class ChatModel(Protocol):
def answer(self, system: str, prompt: str, max_tokens: int) -> str: ...
def build_stack(config: dict) -> tuple[Embedder, SearchIndex, ChatModel]:
"""Choose implementations from configuration; business code only sees the interfaces."""
if config["embedding"] == "local-bge":
from stack.local import BgeEmbedder as embedder_cls
else:
from stack.cloud import ApiEmbedder as embedder_cls
if config["index"] == "pgvector":
from stack.pg import PgVectorIndex as index_cls
else:
from stack.managed import ManagedIndex as index_cls
from stack.llm import ProviderChatModel
return embedder_cls(config), index_cls(config), ProviderChatModel(config)
The stack.* modules are where you put each vendor's code. Switching a component then means writing one adapter and running the evaluation suite, not editing the whole application. This mirrors the approach in Model-Agnostic RAG.
A sensible default stack
For teams starting out without strong constraints, a pragmatic default is: Python with FastAPI; PostgreSQL with pgvector and full-text search; an open embedding model or an embedding API; a cross-encoder reranker; a frontier LLM through an enterprise API; OpenTelemetry tracing plus an LLM observability tool; RAGAS or custom judges for evaluation; and your organisation's existing identity provider. It is cheap, well understood and easy to evolve.
Key takeaways
- Choose a technology for each layer: ingestion, parsing, embeddings, search, reranking, LLM, orchestration, serving, observability, identity.
- Open-source gives control and low lock-in; cloud gives speed and less operations; most enterprises go hybrid.
- Evaluate components on data handling, scale, permissions, cost at scale, replaceability and skills.
- Hide each component behind a small interface so it can be replaced.
Frequently asked questions
Should we use a managed RAG service?
It is a fast way to validate a use case. Check whether it supports your permissions model, sources and evaluation needs before committing a platform to it.
Do we need GPUs?
Only if you self-host LLMs, large embedding models or rerankers at volume. Small embedding models and rerankers run acceptably on CPUs for many workloads.
Practice exercises
- Fill in the stack table for your organisation, marking each choice as open-source, cloud or hybrid, and why.
- Write an adapter for two embedding providers behind the
Embedderinterface and compare them on your test set.