How pavansaxena/mars works
MARS accepts executive queries through its API, routes strategic requests to relevant department specialists, grounds their assessments in historical precedents and optional live data, then synthesizes a risk-aware recommendation with lineage. The graph preserves the documented calibration, conformal-risk, and evaluation capabilities. Several runtime modules are listed but unsampled, so those connections are shown only where the README explicitly documents them; evaluation links likewise follow the cited imports or documentation.
Main entry points: master_agent.py Workflow Orchestrator · case_retrieval_service.py Precedent Retrieval · server.py MCP Tool Layer · aggregator.py Assessment Aggregator
Components 25
API Surface
- Query API
backend/app/api/routes.py - OpenAI-Compatible API
backend/app/api/openai_compat.py
Decision Agents
- Workflow Orchestrator
backend/app/agents/master_agent.py - Finance Agent
backend/app/agents/finance_agent.py - Legal Agent
backend/app/agents/legal_agent.py - Operations Agent
backend/app/agents/operations_agent.py - R&D Agent
backend/app/agents/rd_agent.py
Reasoning Engine
- Semantic Router
backend/app/reasoning/semantic_router.py - Assessment Aggregator
backend/app/reasoning/aggregator.py - Confidence Calibration
backend/app/reasoning/confidence.py - Conformal Risk Bounds
backend/app/reasoning/conformal_predictor.py - Weight Registry
backend/app/reasoning/weight_registry.py
Evidence and Tools
- Precedent Retrieval
backend/app/services/case_retrieval_service.py - Vector Retriever
backend/app/storage/retriever.py - Text Embedder
backend/app/storage/embedder.py - Supabase pgvector
backend/app/services/supabase_client.py - MCP Tool Layer
backend/app/mcp/server.py - Live Data Providers
backend/app/mcp/providers/base.py
Evaluation
- Evaluation Dataset
evaluation/dataset.py - Retrieval Benchmark
evaluation/eval_retrieval.py - Routing Benchmark
evaluation/eval_routing.py - Generation Benchmark
evaluation/eval_generation.py - Longitudinal Evaluation
evaluation/eval_longitudinal.py
Other components
- Corporate Executive
- Decision Recommendation
Connections 35
- Corporate Executive → Query API: submits query
- Query API → Workflow Orchestrator: invokes workflow
backend/app/api/routes.py - Corporate Executive → OpenAI-Compatible API: submits query
- OpenAI-Compatible API → Workflow Orchestrator: invokes workflow
backend/main.py - Workflow Orchestrator → Semantic Router: routes query
- Workflow Orchestrator → Finance Agent: dispatches active agents
- Workflow Orchestrator → Legal Agent: dispatches active agents
- Workflow Orchestrator → Operations Agent: dispatches active agents
- Workflow Orchestrator → R&D Agent: dispatches active agents
- Finance Agent → Precedent Retrieval: retrieves precedents
- Legal Agent → Precedent Retrieval: retrieves precedents
- Operations Agent → Precedent Retrieval: retrieves precedents
- R&D Agent → Precedent Retrieval: retrieves precedents
- Precedent Retrieval → Vector Retriever: calls retrieval
backend/app/services/case_retrieval_service.py - Vector Retriever → Text Embedder: embeds query
backend/app/storage/retriever.py - Vector Retriever → Supabase pgvector: queries vectors
backend/app/storage/retriever.py - Semantic Router → Text Embedder: embeds query
backend/app/reasoning/semantic_router.py - Finance Agent → MCP Tool Layer: uses live tools
- Legal Agent → MCP Tool Layer: uses live tools
- Operations Agent → MCP Tool Layer: uses live tools
- R&D Agent → MCP Tool Layer: uses live tools
- MCP Tool Layer → Live Data Providers: dispatches provider calls
backend/app/mcp/server.py - Workflow Orchestrator → Assessment Aggregator: sends assessments
- Assessment Aggregator → Confidence Calibration: ranks by confidence
- Assessment Aggregator → Conformal Risk Bounds: computes risk bounds
- Confidence Calibration → Weight Registry: uses calibrated weights
- Assessment Aggregator → Decision Recommendation: produces recommendation
- Query API → Decision Recommendation: returns response
backend/app/api/routes.py - Retrieval Benchmark → Evaluation Dataset: loads cases
evaluation/eval_retrieval.py - Routing Benchmark → Evaluation Dataset: loads cases
evaluation/eval_routing.py - Generation Benchmark → Evaluation Dataset: loads cases
evaluation/eval_generation.py - Longitudinal Evaluation → Evaluation Dataset: evaluates chronology
- Retrieval Benchmark → Precedent Retrieval: benchmarks retrieval
evaluation/eval_retrieval.py - Routing Benchmark → Semantic Router: benchmarks routing
evaluation/eval_routing.py - Generation Benchmark → Workflow Orchestrator: evaluates generation
evaluation/eval_generation.py