LightRAG/tests
Clément THOMAS 62b2a71dda feat(api): add multi-workspace server support for multi-tenant deployments
Enable a single LightRAG server instance to serve multiple isolated workspaces
via HTTP header-based routing. This allows multi-tenant SaaS deployments where
each tenant's data is completely isolated.

Key features:
- Header-based workspace routing (LIGHTRAG-WORKSPACE, X-Workspace-ID fallback)
- Process-local pool of LightRAG instances with LRU eviction
- FastAPI dependency (get_rag) for workspace resolution per request
- Full backward compatibility - existing deployments work unchanged
- Strict multi-tenant mode option (LIGHTRAG_ALLOW_DEFAULT_WORKSPACE=false)
- Configurable pool size (LIGHTRAG_MAX_WORKSPACES_IN_POOL)
- Graceful shutdown with workspace finalization

Configuration:
- LIGHTRAG_DEFAULT_WORKSPACE: Default workspace (falls back to WORKSPACE)
- LIGHTRAG_ALLOW_DEFAULT_WORKSPACE: Require explicit header when false
- LIGHTRAG_MAX_WORKSPACES_IN_POOL: Max concurrent workspace instances (default: 50)

Files:
- New: lightrag/api/workspace_manager.py (core multi-workspace module)
- New: tests/test_multi_workspace_server.py (17 unit tests)
- New: render.yaml (Render deployment blueprint)
- Modified: All route files to use get_rag dependency
- Updated: README.md, env.example with documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 12:07:22 +01:00
..
conftest.py Add GitHub CI workflow and test markers for offline/integration tests 2025-11-18 11:36:10 +08:00
README_WORKSPACE_ISOLATION_TESTS.md Fix linting 2025-11-18 08:07:54 +08:00
test_aquery_data_endpoint.py Add GitHub CI workflow and test markers for offline/integration tests 2025-11-18 11:36:10 +08:00
test_chunking.py Add comprehensive chunking tests with multi-token tokenizer edge cases 2025-11-19 19:31:36 +08:00
test_curl_aquery_data.sh Fix linting 2025-10-06 04:57:11 +08:00
test_graph_storage.py Add GitHub CI workflow and test markers for offline/integration tests 2025-11-18 11:36:10 +08:00
test_lightrag_ollama_chat.py Rename test classes to prevent warning from pytest 2025-11-18 13:33:05 +08:00
test_multi_workspace_server.py feat(api): add multi-workspace server support for multi-tenant deployments 2025-12-01 12:07:22 +01:00
test_postgres_retry_integration.py Add GitHub CI workflow and test markers for offline/integration tests 2025-11-18 11:36:10 +08:00
test_workspace_isolation.py Fix test to use default workspace parameter behavior 2025-11-18 11:51:17 +08:00
test_write_json_optimization.py Add GitHub CI workflow and test markers for offline/integration tests 2025-11-18 11:36:10 +08:00