DlightRAG
DlightRAG is a production multimodal RAG service built on LightRAG. It combines knowledge-graph and vector retrieval with metadata filtering, BM25, visual retrieval, reranking, citations, highlights, and durable agentic answers. The same runtime is available through Web, REST, MCP, and an in-process Python API.
Runtime: Python ≥3.14.7,<3.15 · PostgreSQL 18 ecosystem · Apache-2.0
Architecture
LightRAG supplies graph and vector retrieval. DlightRAG owns product policy, multimodal alignment, durable ingestion and answers, security, storage adapters, and public interfaces. Fast and Research answers share one durable conversation tree; Research adds a per-run workspace, tools, memory, and child agents. See Architecture for module and storage ownership.
Deployment Paths
| Path | PostgreSQL | Parser | Security |
|---|---|---|---|
| Local Docker | Compose PG18 | Self-hosted MinerU by default | Loopback, auth_mode: none |
| Native API | Compose or external PG18 | Any reachable MinerU or Docling | Local or explicit auth |
| Shared service | Managed or self-hosted PG18 | Independently operated parser | simple or jwt |
| Enterprise | Managed PG18 | Independently operated parser | JWKS plus claim access control |
The parser runs outside the DlightRAG app container. The checked-in Docker
configuration uses self-hosted MinerU at
http://host.docker.internal:8210. Docling and MinerU cloud remain supported.
Quick Start
Install Docker + Compose,
uv, git, and make.
Interactive setup
git clone https://github.com/hanlianlu/dlightrag.git
cd dlightrag
uv run prerequisite_setup.py
The wizard configures models, parser, secrets, and the local stack. It defaults to self-hosted MinerU and is safe to rerun.
Manual setup
git clone https://github.com/hanlianlu/dlightrag.git
cd dlightrag
cp .env.example .env
Add the keys required by your config.yaml model blocks:
DLIGHTRAG_MODELS__CHAT__DEFAULT__API_KEY=...
DLIGHTRAG_MODELS__EMBEDDING__API_KEY=...
DLIGHTRAG_MODELS__CHAT__ROLES__EXTRACT__API_KEY=...
DLIGHTRAG_MODELS__CHAT__ROLES__KEYWORD__API_KEY=...
DLIGHTRAG_MODELS__CHAT__ROLES__QUERY__API_KEY=...
DLIGHTRAG_MODELS__CHAT__ROLES__VLM__API_KEY=...
DLIGHTRAG_MODELS__RERANK__API_KEY=...
Install and start MinerU, then start DlightRAG:
make mineru-install
make mineru-service-install # installs and starts the background service
curl http://127.0.0.1:8210/health
docker compose up -d
docker compose ps
Open http://localhost:8100/web/. The stack publishes:
| Service | Address |
|---|---|
| REST API and Web | http://127.0.0.1:8100 |
| MCP streamable HTTP | http://127.0.0.1:8101 |
| PostgreSQL | 127.0.0.1:5432 |
Use make mineru-api when the platform cannot install a background user
service. To use Docling, replace the MinerU block in config.yaml; a commented
example is included there. Parser changes affect only new parses.
Configuration fields and parser operations are documented in Configuration and Operations.
Native API
Run PostgreSQL in Docker and the API on the host:
docker compose up -d postgres
uv sync
DLIGHTRAG_CORPUS__SIDECARS__MINERU__LOCAL_ENDPOINT=http://127.0.0.1:8210 \
uv run dlightrag-api
The checked-in config is Docker-first, so a native process overrides the parser
host alias with loopback. Native managed inputs live under
./dlightrag_storage/inputs/<workspace>.
Use DlightRAG
Web
The Web UI supports workspace and file management, durable Fast and Research conversations, answer attachments, citations, source highlights, child-agent status, and typed Answer Artifacts. English, Chinese, and automatic browser language modes are available under Settings.
REST
Ingestion creates a background job; answers create durable runs and return
202 Accepted.
JOB=$(curl -sS -X POST http://localhost:8100/ingest \
-H "Content-Type: application/json" \
-d '{"source_type":"local","path":"report.pdf"}' | jq -r .job_id)
curl "http://localhost:8100/ingest/jobs/$JOB"
RUN=$(curl -sS -X POST http://localhost:8100/answer \
-H "Content-Type: application/json" \
-d '{"query":"What are the key findings?"}' | jq -r .run_id)
curl -N "http://localhost:8100/answer/$RUN/events"
curl "http://localhost:8100/answer/$RUN"
See Interfaces for requests, responses, pagination, SSE, attachments, citations, and all transport contracts.
MCP
For a local stdio client:
{
"mcpServers": {
"dlightrag": {
"command": "uvx",
"args": ["dlightrag-mcp", "--env-file", "/absolute/path/to/.env"]
}
}
}
The Compose stack also exposes streamable HTTP on port 8101. MCP supports retrieval, durable answers, steering, follow-up/fork/resume, child status, corpus administration, and capability discovery. The authoritative tool list is in Interfaces.
Python
uv add dlightrag
Create an application with create_application(config), use
application.corpora for ingestion and application.answers for durable
answers, then call application.aclose(). Complete typed examples are in
Interfaces.
Core Concepts
| Concept | Meaning | Reference |
|---|---|---|
| Workspace | Isolation unit for indexed data, metadata, jobs, files, and queries | Domain language |
| Ingestion | One durable contract for local files, uploads, object storage, URLs, and SDK sources | Interfaces |
| Retrieval | LightRAG mix retrieval plus metadata, BM25, visual fusion, rerank, and packing | Retrieval and Answer |
| Answer run | One durable lifecycle shared by REST, MCP, Web, Python, and evaluation | Durable Answer Runs |
| Resource | Request-local attachment read deterministically or inspected visually on demand | Retrieval and Answer |
| Source | Durable provenance and download contract for an ingested document | Interfaces |
Security
Loopback development can use access.auth_mode: none. Shared deployments should
use a bearer token or externally issued JWT; JWKS and claim-based workspace/action
rules are supported. DlightRAG does not issue tokens or replace an ingress WAF,
rate limiter, TLS terminator, or identity provider. See
Security.
Development
uv sync
npm --prefix frontend ci
make hooks
make ci # lint, security, format, types, architecture, frontend, unit
make ci-full # plus integration tests
make ci-e2e # plus E2E smoke
Use Operations for reset, rebuild, parser, Langfuse, and maintenance runbooks. RAGAS evaluation is documented in Evaluation.
Documentation
| Document | Owns |
|---|---|
| Architecture | Runtime ownership, flows, storage topology, layering |
| Domain Language | Canonical product vocabulary |
| Configuration | Configuration precedence, fields, defaults, examples |
| Interfaces | Python, REST, MCP, and Web contracts |
| Retrieval and Answer | Retrieval, fusion, rerank, packing, citations, highlights |
| Durable Answer Runs | State machine, leases, events, recovery, retention |
| Security | Authentication, authorization, ingress and content boundaries |
| PostgreSQL | PostgreSQL requirements, schema ownership, tuning |
| Operations | Executable runbooks and recovery workflows |
| Evaluation | RAGAS workflow |
| Web Theme Design | Web appearance and interaction decisions |
Plans, ADRs, and research notes under docs/ are historical design evidence,
not required reading for operating DlightRAG.
License
Apache License 2.0. See LICENSE.
Built by HanlianLyu. Contributions welcome.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dlightrag-2.0.2.tar.gz.
File metadata
- Download URL: dlightrag-2.0.2.tar.gz
- Upload date:
- Size: 6.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35b99354340ca546362c96db30d3a76078a2fb638f967102be146ce7b72f23dd
|
|
| MD5 |
104723bb63d23b953481b1d8f86efb2b
|
|
| BLAKE2b-256 |
190a0d8e94fb331f6b49a9a29df56e1c8469a325d82782802f727aa11c5e8fdc
|
Provenance
The following attestation bundles were made for dlightrag-2.0.2.tar.gz:
Publisher:
publish.yml on hanlianlu/DlightRAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dlightrag-2.0.2.tar.gz -
Subject digest:
35b99354340ca546362c96db30d3a76078a2fb638f967102be146ce7b72f23dd - Sigstore transparency entry: 2696254020
- Sigstore integration time:
-
Permalink:
hanlianlu/DlightRAG@0174a4b1648ace66dea374ab43748d8329ad41b6 -
Branch / Tag:
refs/tags/v2.0.2 - Owner: https://github.com/hanlianlu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0174a4b1648ace66dea374ab43748d8329ad41b6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dlightrag-2.0.2-py3-none-any.whl.
File metadata
- Download URL: dlightrag-2.0.2-py3-none-any.whl
- Upload date:
- Size: 6.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bf6fe65824b477189ff4727494882a7345a7aa3d838585e2cea46380e3df9b8
|
|
| MD5 |
da64db64c831e12f63b340f505594559
|
|
| BLAKE2b-256 |
ce51a22764fb653a2fd6174b9fb1cf69bbe05ac8640ce56b2ac7596ac848990d
|
Provenance
The following attestation bundles were made for dlightrag-2.0.2-py3-none-any.whl:
Publisher:
publish.yml on hanlianlu/DlightRAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dlightrag-2.0.2-py3-none-any.whl -
Subject digest:
3bf6fe65824b477189ff4727494882a7345a7aa3d838585e2cea46380e3df9b8 - Sigstore transparency entry: 2696254121
- Sigstore integration time:
-
Permalink:
hanlianlu/DlightRAG@0174a4b1648ace66dea374ab43748d8329ad41b6 -
Branch / Tag:
refs/tags/v2.0.2 - Owner: https://github.com/hanlianlu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0174a4b1648ace66dea374ab43748d8329ad41b6 -
Trigger Event:
push
-
Statement type: