lite-interpreter is a production-oriented data-intelligence agent platform prototype.
Its current architecture is:
- macro orchestration: deterministic DAG
- micro orchestration: DeerFlow as a dynamic
Super Node - governance plane: local harness policy + risk decisions inspired by AutoHarness
- control plane: Blackboard + Event Bus + MCP-style state sync
- execution boundary: final code execution remains inside
lite-interpretersandbox - model backend: DashScope models through LiteLLM
- KAG framework adapter: LlamaIndex
The project goal is not to build a free-form autonomous agent first. The goal is to build a controllable, observable, secure agent runtime for enterprise-style data analysis tasks.
Recent design emphasis:
- keep the system explicitly centered on data-analysis tasks
- classify tasks into dataset / rule / hybrid / dynamic-research analysis modes
- keep context compression evidence-aware instead of treating history as generic chat text
- ship deterministic evals that verify routing and evidence preservation
Current high-level design:
- deterministic DAG handles stable SOP-like paths
- DeerFlow dynamic swarm handles complex long-tail exploration
- Blackboard is the source of truth for task state and execution state
- dynamic traces are written back to Blackboard and streamed to UI
- successful dynamic paths can be harvested into reusable skill candidates
Key principles:
- keep main control in
lite-interpreter - use DeerFlow as a high-capability tool, not as the system owner
- keep code execution under local audit + sandbox
- route dynamic and sandbox actions through a shared governance layer
- prefer explicit state, bounded budgets, and reversible flows
All primary model calls are now designed around:
- DashScope
- LiteLLM
Configured aliases:
fast_modelreasoning_modelcoder_modelembedding_model
Config file:
litellm_config.ymlconfig/analysis_runtime.yaml
Environment variable:
DASHSCOPE_API_KEY
The project keeps the original KAG design philosophy and uses:
- Docling for parsing
- LlamaIndex as the framework adapter layer
- Postgres as source-of-truth text storage
- Qdrant for vector recall
- Neo4j for graph recall
Important:
- KAG was not rewritten into DeerFlow
- KAG was not collapsed into generic LangChain chains
- The original design ideas remain:
- layout-aware chunking
- parent-child chunking
- sentence-splitter fallback
- MAGMA-style graph extraction
- hybrid recall with rerank and budget control
- new Python 3.12 conda env:
lite_interpreter - DeerFlow installed in that env from local source
- CPU-only PyTorch installed for compatibility
- Streamlit installed for UI demo
config/analysis_runtime.yaml- defines lightweight data-analysis runtime policy for routing, compression, and summary purposes
src/dynamic_engine/deerflow_bridge.py- supports
embedded - supports
sidecar - supports
auto
- supports
src/dynamic_engine/supervisor.py- prepares
TaskEnvelope,ExecutionIntent, governance decision, and dynamic request
- prepares
src/dynamic_engine/runtime_gateway.py- isolates runtime execution from DAG-owned planning
src/dynamic_engine/runtime_registry.py- selects the concrete dynamic runtime backend behind the gateway
src/dynamic_engine/trace_normalizer.py- normalizes runtime events before state sync and SSE projection
src/dag_engine/nodes/dynamic_swarm_node.py- coordinates supervisor + gateway + trace normalization
- writes request to Blackboard
- forwards trace events
- writes result back into execution state
src/dynamic_engine/runtime_backends.py- exposes runtime capability manifest metadata for the active backend
src/api/routers/runtime_router.py- exposes runtime inventory and capability inspection endpoints
config/harness_policy.yaml- governance mode, profiles, risk thresholds, sandbox deny patterns
src/harness/governor.py- emits allow/deny decisions for dynamic delegation and sandbox execution
- now resolves allowed/requested abilities through the capability registry
src/common/capability_registry.py- canonical registry for
knowledge_query,sandbox_exec,state_sync,dynamic_trace, and related aliases
- canonical registry for
src/blackboard/schema.py- stores governance mode/profile/decision history per task
src/sandbox/session_manager.py- creates lightweight
SandboxSessionhandles around each sandbox execution
- creates lightweight
src/sandbox/docker_executor.py- records session lifecycle alongside the existing Docker execution flow
src/mcp_gateway/tools/sandbox_exec_tool.py- normalizes sandbox results into
ExecutionRecordwhile preserving session metadata
- normalizes sandbox results into
src/skillnet/skill_schema.py- skill descriptors now carry
required_capabilities, replay cases, and validation state
- skill descriptors now carry
src/skillnet/skill_harvester.py- harvested dynamic skills now derive required capabilities from governance/runtime context
- generates replay cases and validator-backed metadata for each candidate
src/skillnet/skill_validator.py- runs lightweight validation before a candidate can be treated as promotion-ready
src/skillnet/skill_retriever.py- filters skill candidates by available capabilities and approved promotion state
src/skillnet/skill_promoter.py- derives promotion state (
harvested/approved/needs_review/rejected) from validation + authorization
- derives promotion state (
src/mcp_gateway/tools/skill_auth_tool.py- authorizes a skill against a governance profile using capability metadata
src/dag_engine/nodes/analyst_node.py/src/dag_engine/nodes/coder_node.py- approved skills now appear in planning and code-generation payloads, so promoted skills start affecting execution paths
- promotion provenance and skill strategy hints are now carried into execution planning
src/storage/repository/memory_repo.py- persists approved skills per tenant/workspace so later tasks can reuse historical promoted skills
- now supports capability-filtered lookup for router / analyst / coder reuse
- records lightweight usage telemetry for matched historical skills
src/skillnet/skill_retriever.py- now derives match source/reason/score for historical approved skill selection
historical_skill_matches/used_historical_skills- task state and final response now distinguish matched historical skills from those actually used in code generation
- codegen-used historical skills now record replay-case ids and capability ids for richer feedback
MemoryRepo.record_skill_outcome(...)- task completion now feeds success/failure counters back into historical skill usage telemetry
src/blackboard/schema.py- dynamic request / summary / trace / artifacts / skill candidate fields
- governance mode / profile / decision fields
- normalized control-plane fields:
task_envelope,execution_intent,decision_log,execution_record
src/common/contracts.py- now also defines
RuntimeCapabilityManifest,ExecutionEvent, andToolCallRecord
- now also defines
src/mcp_gateway/tools/state_sync_tool.py- partial patch sync
- append trace event helper
src/common/event_bus.py- subscribe / unsubscribe support
- mirrors task events into an append-only event journal for replay
src/common/event_journal.py- task-scoped event replay store used by SSE
src/common/schema.pyUI_TASK_TRACE_UPDATEUI_TASK_GOVERNANCE_UPDATE
src/api/main.pysrc/api/routers/sse_router.pysrc/api/routers/analysis_router.pysrc/api/routers/execution_router.pysrc/api/routers/diagnostics_router.pysrc/api/routers/runtime_router.pysrc/api/schemas.py
Available routes:
GET /healthGET /api/diagnosticsGET /api/conformanceGET /api/runtimesGET /api/runtimes/{runtime_id}/capabilitiesGET /api/audit/logsPOST /api/session/loginGET /api/session/mePOST /api/tasksGET /api/tasks/{task_id}/executionsGET /api/tasks/{task_id}/resultGET /api/tasks/{task_id}/eventsPOST /api/dev/tasks/{task_id}/demo-tracePOST /api/uploadsGET /api/knowledge/assetsGET /api/skillsGET /api/executions/{execution_id}GET /api/executions/{execution_id}/artifactsGET /api/executions/{execution_id}/tool-callsGET /api/executions/{execution_id}/events
Operational notes:
- task / execution / knowledge / memory / upload / asset / skill APIs now require
tenant_id+workspace_idscope, either from authenticated API token binding or explicit query/form scope - set
API_AUTH_TOKENS_JSONto enable bearer-token auth; when configured, the token scope is authoritative over client-supplied tenant/workspace values - token roles are hierarchical:
viewerfor read-only task/runtime access,operatorfor task creation and uploads,adminfor policy, diagnostics, and demo-trace controls - the API now also supports local user-to-session login via
POST /api/session/login; session tokens carry one or more tenant/workspace grants and reuse the same role model GET /api/audit/logsisadmin-only and returns persistent API audit records scoped to the caller's tenant/workspaceGET/POST /api/policy,POST /api/dev/tasks/{task_id}/demo-trace, andGET /api/diagnosticsare disabled by default and must be explicitly enabled via env vars- set
STRICT_PERSISTENCE=trueto disable silent in-memory fallback for state/memory repositories /api/diagnosticsnow exposes repository status, startup recovery, and detected Postgres driver state when enabled- Postgres-backed persistence now expects a SQLAlchemy-compatible driver such as
psycopgorpsycopg2; the default dependency set includespsycopg[binary]
src/frontend/app.pysrc/frontend/pages/task_console.pysrc/frontend/pages/knowledge_manager.pysrc/frontend/pages/skill_manager.pysrc/frontend/components/file_uploader.pysrc/frontend/components/status_stream.py
Capabilities:
- connect to SSE via browser
EventSource - view task status updates
- view dynamic trace updates
- view harness governance allow/deny decisions
- fetch task result, executions, and tool-call resources through API
- attach execution-level streams after executions are discovered
- distinguish static-chain synthetic tool calls from dynamic runtime tool calls in the Task Console
- upload workspace assets directly from the Task Console
- inspect uploaded knowledge assets and parser/index state
- inspect approved and preset reusable skills
- create a minimal real task
- trigger a fake demo trace
- optionally authenticate requests from the Task Console with an API token
src/common/llm_client.py- unified LiteLLM wrapper
- sync + async wrappers for chat / embeddings
src/kag/retriever/query_engine.py- emits evidence-aware retrieval payloads and normalized hit lists
- now also emits
EvidencePacketfor normalized knowledge-plane results
src/mcp_gateway/tools/knowledge_query_tool.py- returns evidence-aware retrieval payloads instead of a thin hit wrapper
src/kag/framework/llama_index_adapter.py- LlamaIndex sentence splitter
- LiteLLM + DashScope embedding adapter
src/kag/builder/embedding.py- main embedding path uses DashScope via LiteLLM
src/kag/builder/chunker.py- sentence fallback uses LlamaIndex splitter
src/kag/builder/parser.py- returns typed
ParsedDocument - rebuilds section hierarchy from Docling text items instead of assuming
document.sections
- returns typed
src/kag/retriever/recall/hybrid_search.py- query embedding uses the new embedding path
src/dag_engine/nodes/data_inspector.py- fast LLM fallback now uses
fast_model
- fast LLM fallback now uses
src/common/utils.pyestimate_tokens_fastfor classification / rough heuristicscount_text_tokens_exactandcount_message_tokens_exactfor prompt-window enforcementfit_items_to_budgetfor final prompt assembly
src/kag/retriever/budget.py- now enforces exact-fit budget against the target context model
src/dag_engine/nodes/context_builder_node.py- performs final context fit before handing material to downstream nodes
- now emits an
analysis_briefwith evidence refs, known gaps, and next-step guidance for data-analysis planning
src/runtime/analysis_runtime.py- classifies tasks into
dataset_analysis,document_rule_analysis,hybrid_analysis,dynamic_research_analysis, andneed_more_inputs - resolves lightweight runtime decisions per call purpose without turning the project into a generic framework
- classifies tasks into
src/evals/runner.py- runs deterministic seed evals for route correctness and evidence pinning
src/evals/cases.py- stores seed data-analysis cases for dataset, rule, hybrid, and dynamic-research tasks
scripts/run_deerflow_sidecar.pyscripts/smoke_deerflow_bridge.pyscripts/smoke_dashscope_litellm.pyscripts/demo_task_trace.pyscripts/create_task.pyscripts/check_hybrid_readiness.py
Use the lite_interpreter conda env:
conda run -n lite_interpreter python -m pytest -qDeterministic eval report:
conda run -n lite_interpreter python -m src.evals.runWrite reports into a specific project directory when needed:
conda run -n lite_interpreter python -m src.evals.run --output-dir artifacts/evalsCurrent result:
237 passed, 3 skipped
The repo now has a solid demo/integration spine, but some modules are still placeholders or partial:
src/dag_engine/nodes/analyst_node.pysrc/dag_engine/nodes/coder_node.pysrc/dag_engine/nodes/auditor_node.pysrc/dag_engine/nodes/executor_node.pysrc/dag_engine/nodes/debugger_node.py- some API surfaces outside the demo path
- some frontend pages outside Task Console
Interpretation:
- the system-level integration path exists
- the end-to-end production business workflow is not fully finished
- this repository is currently strongest as a controlled prototype / architecture demo
config/settings.pylitellm_config.ymlsrc/common/llm_client.pysrc/dynamic_engine/deerflow_bridge.pysrc/dag_engine/nodes/router_node.pysrc/dag_engine/nodes/dynamic_swarm_node.pysrc/dag_engine/nodes/skill_harvester_node.pysrc/mcp_gateway/tools/state_sync_tool.pysrc/api/main.pysrc/api/routers/sse_router.pysrc/api/routers/analysis_router.pysrc/frontend/pages/task_console.pysrc/frontend/components/status_stream.py
src/dag_engine/dag_graph.pysrc/kag/builder/orchestrator.pysrc/kag/retriever/query_engine.pysrc/skillnet/skill_harvester.py
src/api/routers/upload_router.pysrc/frontend/pages/knowledge_manager.pysrc/frontend/pages/skill_manager.py- several deeper production workflow nodes
Use:
conda run -n lite_interpreter <command>Why this env:
- Python 3.12 compatible with DeerFlow harness
- DeerFlow already installed
- Streamlit already installed
- tests already validated there
- project commands in
Makefilealready default to this env
If you prefer an interactive shell first:
conda activate lite_interpreterDASHSCOPE_API_KEY
DEERFLOW_RUNTIME_MODEDEERFLOW_SIDECAR_URLDEERFLOW_SIDECAR_TIMEOUTDEERFLOW_CONFIG_PATHDEERFLOW_MODEL_NAMEDEERFLOW_MAX_EVENTSDEERFLOW_MAX_STEPSDEERFLOW_RECURSION_LIMIT
From repo root:
make run-sidecar
make run-api
make run-frontend
make demo-trace
make create-task
make test-stream
make smoke-modelsexport OPENAI_API_KEY=your_real_key
export DEERFLOW_CONFIG_PATH=/home/linsir365/projects/deer-flow/config.yaml
make run-sidecarexport DEERFLOW_RUNTIME_MODE=sidecar
export DEERFLOW_SIDECAR_URL=http://127.0.0.1:8765
export DEERFLOW_CONFIG_PATH=/home/linsir365/projects/deer-flow/config.yaml
make run-apimake run-frontendmake demo-tracemake create-taskIf you want to understand the project quickly:
docs/code_tour.mddocs/deerflow_integration.mddocs/runtime_support_matrix.mddocs/openharness_adaptation_plan.mdconfig/settings.pylitellm_config.ymlsrc/common/llm_client.pysrc/kag/framework/llama_index_adapter.pysrc/dynamic_engine/deerflow_bridge.pysrc/dag_engine/nodes/dynamic_swarm_node.pysrc/api/routers/sse_router.pysrc/frontend/pages/task_console.py
- DeerFlow live task execution still depends on valid external model credentials
- the frontend is a demo-grade console, not a polished product UI
- not all DAG business nodes are complete
- dependency surface is broad because DeerFlow and KAG both bring heavy stacks
- some modules in the repository are still architectural placeholders
docs/deerflow_integration.mddocs/code_tour.mddirectory.txt项目二.md