RAGFlow is an open-source Retrieval-Augmented Generation (RAG) engine that effectively combines deep document understanding with agentic workflow capabilities. Its primary goal is to transform complex, unstructured data into high-fidelity, production-ready AI systems with strong contextual grounding and explainability. README.md76-78
RAGFlow provides a production-ready platform that:
This end-to-end design caters to enterprises of any scale, focusing on "Quality in, quality out" by leveraging deep document layout analysis, table extraction, and rich multi-modal features. README.md112-122 pyproject.toml4
Sources: README.md76-122 pyproject.toml4
RAGFlow employs a modular, microservices-oriented three-tier architecture that supports scalability, fault tolerance, and asynchronous task processing. The architecture separates user-facing API operations from intensive document processing workloads using task queues mediated primarily by Redis streams. This design enhances responsiveness and allows parallel processing of large document ingestion workflows.
This diagram shows:
Sources: README.md141-145 docker/.env140-146 api/utils/api_utils.py45-51
RAGFlow's design segments responsibilities into distinct tiers:
| Tier | Description | Key Components |
|---|---|---|
| 1. Frontend / API Tier | Handles user requests, front-end interaction, and chat orchestration. Uses Quart asynchronous HTTP server supporting streaming, CORS, Auth, and schema validation. | API server in api/ragflow_server.py(Quart), Python SDK, React Web UI. Supports hybrid proxy mode with the Go server (docker/.env:158-159) |
| 2. Asynchronous Task Tier | Decouples compute-intensive tasks such as document parsing, embedding, and indexing from synchronous API processing. Tasks are submitted to Redis Streams queues and processed by TaskExecutor workers (rag/svr/task_executor.py). | Redis Streams for task queueing, Task executor workers, DeepDoc vision engine, GraphRAG, sandbox executor. |
| 3. Persistence Tier | Employs storage engines suitable for different kinds of data: metadata, documents, vectors, raw files. | Relational DBMS: MySQL/PostgreSQL via peewee ORM (api/db/db_models.py), Document stores: Elasticsearch, Infinity, OpenSearch, OceanBase; MinIO for object storage. |
This clear separation of concerns ensures high availability, isolate resource-intensive operations, and supports scale-out in each tier independently.
Sources: pyproject.toml5-8 docker/.env13-159 README.md134-139
The following diagram bridges RAGFlow's key domain concepts to internal code entities and packages:
This highlights the correspondence between domain concepts and code subsystems, guiding developers in navigating the codebase more efficiently.
Sources: api/utils/api_utils.py45-51 common/mcp_tool_call_conn.py40-80 rag/svr/task_executor.py1-80
| Component | File Path | Description |
|---|---|---|
| Python API Server | api/ragflow_server.py | Main Quart-based HTTP RESTful API server, handling client API calls and streaming chat support. |
| Go Server | cmd/server_main.go | Implements high-performance service layer and native components. Handles search and user services with lower latency. |
| Admin Service | admin/server/admin_server.py | Admin backend providing operational and monitoring interfaces. |
| MCP Server | mcp/server/server.py | Implements Model Context Protocol server for agentic workflows and tool integration. |
Sources: api/utils/api_utils.py45-50 .github/workflows/tests.yml132-139
Sources: README.md89-140 docker/.env13-159 docs/quickstart.mdx34
| Technology | Usage | Location / Reference |
|---|---|---|
| Python >= 3.13 | Primary backend language | Codebase top-level |
| Go | High-performance server layer | cmd/server_main.go |
| C++ | Native tokenizer and components | internal/cpp (not listed fully here) |
| Quart | Asynchronous HTTP server framework | api/ragflow_server.py |
| Peewee ORM | Relational database ORM | api/db/db_models.py |
| Redis (via Valkey) | Task queues, caching | rag/utils/redis_conn.py |
| Elasticsearch / Infinity / OpenSearch / OceanBase | Document vector stores | Configured via docker/.env, integrated in DocStore related modules. |
| MinIO | Object storage for raw documents and images | Seen in Docker config and usages in task executor |
| Technology | Usage |
|---|---|
| React + Vite | Web UI framework and build |
| Internationalization (i18n) | 10+ languages supported |
Sources: pyproject.toml1-160 uv.lock1-10 README.md1-140
The following steps describe the typical data lifecycle from ingestion to query response:
This pipeline is orchestrated asynchronously to maximize API responsiveness and scale.
Sources: README.md94-138 docker/.env13-138 Dockerfile11-16
RAGFlow is a comprehensive, production-grade RAG engine designed with a clean modular architecture that integrates deep document understanding, multi-modal parsing, embedding generation, and AI agentic workflows within a scalable three-tier microservice structure. Its architecture addresses both synchronous API interactions and asynchronous, compute-heavy document ingestion and knowledge processing tasks through task queues and background workers. The system is flexible and extensible, supporting multiple storage backends, LLM providers, and document types. The ecosystem includes powerful native components (Go server, C++ tokenizer) complementing its Python core services.
Sources: Entire provided sources with primary insights from README.md76-145 docker/.env13-159 api/utils/api_utils.py1-200 pyproject.toml1-160 Dockerfile1-130 .github/workflows/tests.yml132-139
Refresh this wiki
This wiki was recently refreshed. Please wait 6 days to refresh again.