How infiniflow/ragflow works
RAGFlow is a RAG engine combining document ingestion, knowledge organization, retrieval, and agent workflows. The primary journey is to configure a parsing pipeline, ingest documents into a knowledge base, retrieve grounded evidence for a question, and return an answer through chat or an API. The graph includes those stages plus pipeline execution and agent orchestration. Several backend implementations are unsampled, so high-level relationships rely on README descriptions; unsampled subsystems are represented by their exact tree paths rather than assumed internal call chains.
Main entry points: pipeline.go Ingestion Pipeline · use-document-pipeline-form.ts Document Pipeline Form · chat_pipeline.go Chat Service · dify_retrieval_handler.go Retrieval API
Components 26
Product Entry
- HTTP API
internal/server/api/server.go - Chat Service
internal/service/chat_pipeline.go - Messaging Channels
internal/channels
Ingestion and Knowledge
- Ingestion Tasks
internal/service/ingestion_task_service.go - Ingestion Worker
internal/ingestion/service/ingestion_service.go - Pipeline Executor
internal/ingestion/task/pipeline_executor.go - Ingestion Pipeline
internal/ingestion/pipeline/pipeline.go - Document Parsers
internal/deepdoc/parser - Native Analyzer
internal/binding/cpp/main.cpp - File Storage
internal/storage/storage_factory.go - Knowledge and Document Data
internal/dao - Knowledge Compilation
internal/service/graph/pipeline.go
Retrieval and Answers
- Retrieval API
internal/handler/dify_retrieval_handler.go - Retrieval Service
internal/agent/tool/retrieval_service.go - Agentic RAG
internal/agentic_rag
Agent Runtime
- Agent Pipeline
internal/service/agentic_pipeline.go - Canvas Runtime
internal/agent/canvas/runner.go - Graph Engine
internal/harness/graph/pregel/engine.go - Agent Components
internal/agent/component/registry.go - Code Sandbox
internal/agent/sandbox/manager.go
Pipeline Configuration
- Document Pipeline Form
web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts - Parser Version Selector
web/src/components/parser-tree-select/use-parser-tree-data.tsx - Operator Config Mapping
web/src/utils/pipeline-operator.ts - Parser Config Validation
web/src/components/pipeline-operator-tabs/parser-config-validation.ts - Operator Form Hook
web/src/hooks/use-pipeline-operator.ts
Other components
- User
Connections 28
- User → HTTP API: submits requests
README.md - HTTP API → Chat Service: serves chat
README.md - User → Document Pipeline Form: configures parsing
README.md - Document Pipeline Form → Parser Version Selector: selects pipeline
web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts - Document Pipeline Form → Operator Form Hook: loads operators
web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts - Document Pipeline Form → Operator Config Mapping: transforms config
web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts - Parser Config Validation → Operator Config Mapping: gets operator type
web/src/components/pipeline-operator-tabs/parser-config-validation.ts - User → Ingestion Tasks: requests ingestion
README.md - Ingestion Tasks → Ingestion Worker: queues tasks
- Ingestion Worker → Pipeline Executor: runs document task
internal/ingestion/service/ingestion_service.go - Pipeline Executor → Ingestion Pipeline: executes pipeline
- Ingestion Pipeline → Document Parsers: parses documents
README.md - Document Parsers → Native Analyzer: uses analysis
- Ingestion Pipeline → File Storage: stores files
README.md - Ingestion Pipeline → Knowledge and Document Data: records knowledge
README.md - Ingestion Pipeline → Knowledge Compilation: compiles knowledge
README.md - User → Retrieval API: asks question
README.md - Retrieval API → Retrieval Service: retrieves chunks
internal/handler/dify_retrieval_handler.go - Retrieval API → Knowledge and Document Data: fetches documents
internal/handler/dify_retrieval_handler.go - Chat Service → Agentic RAG: retrieves evidence
README.md - Agentic RAG → Retrieval Service: performs retrieval
README.md - Chat Service → User: returns grounded answer
README.md - User → Messaging Channels: messages agent
README.md - Messaging Channels → Agent Pipeline: routes interaction
- Agent Pipeline → Canvas Runtime: runs workflow
- Canvas Runtime → Graph Engine: executes graph
- Canvas Runtime → Agent Components: dispatches components
- Agent Components → Code Sandbox: runs code tools