05

July 24, 2026 · View on GitHub

Status[ ] Draft | [ ] In Review | [ ] Approved
Version0.4
Related PRDSection 7 Non-Functional Requirements (Deployment, Security)

1. Environment Requirements | 环境要求

1.1 Runtime

ItemRequirement
Python3.11+
OSLinux (Recommended) / Windows Server / Container
MemoryMinimum 4GB, Recommended 8GB+ (for local LLM/Vector DB)
CPU2+ Cores (AVX support for some vector libs)
DiskSSD recommended for Vector DB I/O

1.2 Dependent Services

ServiceUsageRequired
Vector DBKnowledge Base retrieval (Chroma/Qdrant)Yes
LLM EndpointOpenAI / Ollama / Claude / QwenYes
RedisSession/Cache (Optional for MVP)Optional
PostgreSQLTask/User data (Future)Optional
AADIdentity & SSORecommended for Prod

2. Deployment Options | 部署方式

Suitable for Development, PoC, or Small Teams. Includes API and optional Ollama.

# Clone repo
git clone https://github.com/arthurpanhku/DocSentinel.git
cd DocSentinel

# Run script
chmod +x deploy.sh
./deploy.sh

2.2 Docker Manual | 容器化手动部署

See Dockerfile and docker-compose.yml in repo.

Compose Example:

services:
  agent:
    build: .
    ports: ["8000:8000"]
    env_file: .env
    volumes: ["./data:/app/data"]

2.3 Python Standalone | Python 单机部署

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
uvicorn app.main:app --host 0.0.0.0 --port 8000

2.4 Air-Gapped / Private Cloud | 内网/私有化

For environments without public internet access:

  1. LLM: Use Ollama or vLLM deployed internally.
  2. Identity: Use local accounts or internal IdP (LDAP/AD) if AAD is unreachable.
  3. Dependencies: Mirror PyPI packages or use pre-built Docker images.

3. Verify Installation | 验证安装

Run the integration test script to verify core functions (API, Skills, Orchestrator) in an isolated environment:

./test_integration.sh

3.2 Manual Check

After deployment, you can run a quick self-check using pytest (requires python environment):

# Install test deps
pip install -r requirements-dev.txt

# Run integration tests against your local instance (mocking LLM)
pytest tests/test_health.py tests/test_assessments_api.py

If you see PASSED, the core API and orchestration logic are working correctly.


4. Configuration Reference | 配置项清单

See .env.example for the template.

4.1 App & API

VariableDescriptionExample
ENVEnvironmentproduction
LOG_LEVELLogging levelINFO
API_PREFIXAPI path prefix/api/v1
CORS_ORIGINSComma-separated allowed browser originsLocal console origins
SECRET_KEYSession/Sign keyRandom String

4.2 Authentication (AAD)

VariableDescription
AAD_TENANT_IDAzure Tenant ID
AAD_CLIENT_IDApp Client ID
AAD_CLIENT_SECRETClient Secret
AAD_REDIRECT_URIOIDC Callback

4.3 LLM Provider

VariableDescriptionExample
LLM_PROVIDERBackend choiceopenai / ollama
OPENAI_API_KEYKey for OpenAIsk-...
OLLAMA_BASE_URLLocal LLM URLhttp://localhost:11434
OLLAMA_MODELModel namellama3

4.4 Vector Store

VariableDescriptionExample
CHROMA_PERSIST_DIRData path./data/chroma
EMBEDDING_MODELHuggingFace modelall-MiniLM-L6-v2

4.5 Limits

VariableDescriptionDefault
UPLOAD_MAX_FILE_SIZE_MBMax file size50
UPLOAD_MAX_FILESMax files per req10
KB_REINDEX_ROOTSServer directories allowed for KB reindex./examples
MCP_DOCUMENT_ROOTSDirectories accessible to MCP document tools./examples
AGENT_GATEWAY_ENABLEDEnable remote MCP and A2A endpointstrue
AGENT_GATEWAY_TOKENBearer token for remote agent access; empty means loopback-onlyempty
AGENT_GATEWAY_PUBLIC_URLPublic base URL advertised by the A2A Agent Cardhttp://localhost:8000
AGENT_GATEWAY_ALLOWED_HOSTSMCP Host allow-list; add the exact deployment host and portlocal hosts
AGENT_GATEWAY_ALLOWED_ORIGINSMCP browser Origin allow-list; add trusted web origins onlylocal origins
AGENT_GATEWAY_TASK_TIMEOUT_SECONDSCompatibility MCP wait timeout300

When running through Docker or a reverse proxy, configure AGENT_GATEWAY_TOKEN; forwarded traffic is not considered loopback.

4.6 Parser Engine

VariableDescriptionDefault
PARSER_ENGINEauto, docling, or legacyauto

4.7 Graph RAG (LightRAG)

VariableDescriptionDefault
ENABLE_GRAPH_RAGEnable graph-based retrievaltrue
LIGHTRAG_WORKING_DIRLightRAG data directory./data/lightrag
GRAPH_RAG_QUERY_MODEQuery mode: naive/local/global/hybridhybrid

4.8 Threat Evidence Critic

VariableDescriptionDefault
EVIDENCE_CRITIC_ENABLEDRun inference-time evidence verification for Design threatstrue
EVIDENCE_CRITIC_MAX_CANDIDATESCurrent-document passages supplied per threat5
EVIDENCE_CRITIC_MAX_THREATSThreats included in one verifier request20

The critic never uses policy or assessment-history chunks as proof of a current design fact. If inference is unavailable or a returned evidence ID does not resolve to an allowed current-document passage, the affected threat is marked insufficient_evidence and remains subject to human review.

4.9 SSDLC Pipeline

VariableDescriptionDefault
SSDLC_DEFAULT_STAGEDefault SSDLC stage when not specified: auto or a specific stage nameauto

Valid stage values: requirements, design, development, testing, deployment, operations. When set to auto, the SSDLC Router attempts to detect the stage from document content.


5. Operations and Monitoring | 运维与监控

5.1 Health Checks

  • Liveness: GET /health (Returns 200 OK with version and environment info)
  • LLM Config: GET /config/llm (Shows current LLM provider and model)

5.2 Logging

  • Format: JSON or Text (Standard Output).
  • Privacy: Do not log sensitive document content or full user tokens.
  • Fields: Request ID, User ID, Task ID, Duration, Error Stack.

5.3 Auditing

  • Scope: Who initiated assessment? Who accessed reports?
  • Retention: Comply with organization policy (e.g. 90 days).

5.4 Backup

  • Vector DB: Backup the CHROMA_PERSIST_DIR regularly.
  • Config: Backup .env (securely).

6. Troubleshooting | 常见问题排错

IssuePossible CauseSuggestion
Login Loop / 401AAD Config mismatchCheck Client ID, Secret, and Redirect URI in Azure Portal.
Task Pending ForeverWorker stuck / LLM timeoutCheck logs for LLM connection errors or parser hangs.
Empty KB ResultsEmbeddings mismatchEnsure ingestion and query use the same embedding model.
ServiceNow ErrorNetwork / AuthVerify instance URL reachability and credentials.

7. Changelog | 修订记录

VersionDateChanges
0.42026-03Added SSDLC Pipeline config section.
0.32026-03Removed Streamlit references. Added Parser Engine and Graph RAG config sections. Fixed section numbering. Updated health check endpoints.
0.22025-03Added Docker Compose and standalone deployment options.
0.1InitialDraft Deployment and Runbook.