How cwentor/dataagent works
DataAgent turns natural-language questions into controlled DSL, deterministic SQL, and explainable results. The principal flow enters through the web service, is routed and handled by the agent, compiled against a semantic contract and catalog, then safely executed and presented. Separate branches provide the LangGraph analysis workflow, sandbox and attribution skills, provider management, and audit/observability. Relationships for unsampled subsystems follow README descriptions; the source excerpts are incomplete, so some internal call details remain unverified.
Main entry points: service.py Web Service · langgraph_engine.py Graph Orchestrator · pipeline.py NL to DSL · _query_core.py Guarded Execution
Components 22
User Entry
- Web Service
web/service.py - Authentication
auth/gateway.py - Web Workbench
web/static/app.js
Agent Workflow
- Intent Router
agent/router/intent_router.py - Dialogue Memory
agent/memory.py - NL to DSL
agent/pipeline.py - Tool Agent
agent/tool_agent.py - Graph Orchestrator
core/orchestrator/langgraph_engine.py
Query and Data
- DSL Contract
semantic/dsl_schema.py - Semantic Catalog
semantic/catalog.py - Access Policy
security/policy.py - SQL Compiler
compiler/sql_compiler.py - Guarded Execution
tools/builtins/_query_core.py - DuckDB Warehouse
Analysis and Delivery
- Retrieval Guardrails
core/retrieval/guardrails.py - Analysis Sandbox
core/sandbox/api.py - Analysis Skills
core/skills/decomposition.py - Explain and Visualize
present/explain.py
Platform Services
- Model Providers
providers/adapters.py - Audit and Metrics
audit/logging.py - Authentication Sessions
auth/session.py
Other components
- User
Connections 25
- User → Web Service: asks
- Web Service → Authentication: authenticates
- Web Service → Intent Router: routes intent
agent/router/intent_router.py - Intent Router → NL to DSL: dispatches query
- Web Service → Dialogue Memory: loads context
web/service.py - Intent Router → Tool Agent: dispatches tools
- Web Service → Graph Orchestrator: starts agent run
- NL to DSL → DSL Contract: produces DSL
agent/pipeline.py - NL to DSL → Access Policy: applies policy
agent/pipeline.py - SQL Compiler → DSL Contract: consumes DSL
compiler/sql_compiler.py - SQL Compiler → Semantic Catalog: resolves fields
compiler/sql_compiler.py - Guarded Execution → NL to DSL: generates DSL
tools/builtins/_query_core.py - Guarded Execution → SQL Compiler: compiles query
tools/builtins/_query_core.py - Guarded Execution → DuckDB Warehouse: executes SQL
- Graph Orchestrator → Retrieval Guardrails: uses retrieval
- Graph Orchestrator → Analysis Sandbox: runs analysis
- Analysis Sandbox → Analysis Skills: runs skills
- Graph Orchestrator → Explain and Visualize: creates report
- Web Service → Explain and Visualize: returns explanation
- NL to DSL → Model Providers: requests model
- Graph Orchestrator → Model Providers: selects model
- Web Service → Audit and Metrics: records activity
web/service.py - Graph Orchestrator → Audit and Metrics: emits metrics
core/orchestrator/langgraph_engine.py - Authentication → Authentication Sessions: uses sessions
- Web Workbench → Web Service: submits requests