How pavan1290/sigma works
Purpose and Runtime Shape
SIGMA-OS is a local desktop-oriented intelligent-agent system: a React/Vite UI talks to a Python FastAPI service that routes natural-language tasks to system, email, and browser automation agents. An Electron main process packages/launches the application for Windows. Primary launch paths are start.sh, backend/app.py, src/main.jsx, and main.cjs.
Client and Desktop Shell
The interactive client is a React application centered on the assistant/chat experience, model selection, API-key management, formatted result display, and system status. It communicates with FastAPI through REST plus a WebSocket channel. Electron is the desktop boundary; shipped Windows artifacts embed the Python backend under release-fixed/win-unpacked/resources/app.asar.unpacked/backend/app.py.
• src/main.jsx
• src/App.jsx
• src/components/IntelligentAssistant.jsx
• main.cjs
API Gateway and Real-Time Control Plane
FastAPI is the application-facing backend, exposing health, model, API-key, command, and WebSocket endpoints (documented as port 5000 and /ws). It accepts UI/API commands, applies model and agent routing, and returns or streams execution updates. This is the key boundary between untrusted user requests and privileged automation.
• backend/app.py
• backend/models.py
• backend/db.py
Agent Routing and Execution
The agent core coordinates task interpretation and dispatch to capability-specific agents. SystemAgent handles local shell/files/processes/screenshots; EmailAgent handles Gmail operations; WebAgent drives browser automation. Their results are normalized for UI/MCP consumers rather than exposing raw execution details directly.
• intelligent_agents/agent_core.py
• intelligent_agents/system_agent.py
• intelligent_agents/email_agent.py
• intelligent_agents/web_agent.py
Model and Output Layer
Model management abstracts interchangeable inference providers and separates “thinking” from execution model selection. Provider keys come from environment/UI-managed configuration; supported integrations include Groq, Google Gemini, OpenAI, Anthropic, and local Ollama. Output formatting converts command and automation results into structured, display-oriented responses.
• intelligent_agents/model_manager.py
• intelligent_agents/output_formatter.py
• .env.example
MCP Integration Boundary
The MCP server publishes system, email, web, analysis, and model capabilities as standard callable tools for external LLM clients such as Claude. It is an alternate ingress/control path alongside FastAPI, delegating tool calls into the same agent capabilities.
• intelligent_agents/mcp_server.py
• intelligent_agents/__init__.py
Automation Workflows and Resilience
A separate backend automation subsystem supports orchestrated workflows, scheduled tasks, monitoring-triggered rules, retries, and recovery. Example JSON definitions indicate workflows/rules are data-driven inputs to this subsystem, distinct from single interactive agent commands.
• backend/automation/orchestrator.py
• backend/automation/workflow_engine.py
• backend/automation/rules_engine.py
• backend/automation/task_scheduler.py
• backend/automation/error_recovery.py
External Dependencies and Privilege Boundaries
Python 3.10+ hosts FastAPI and agents; Node.js runs Vite/React and Electron. Browser automation requires Playwright. System automation uses host-level facilities (shell, filesystem, process inspection, screenshots), while email crosses Gmail APIs and models cross external AI-provider APIs. These integrations make credential handling and command/tool authorization architecturally sensitive.
Main entry points: app.py FastAPI Gateway · agent_core.py Agent Core · orchestrator.py Automation Orchestrator · output_formatter.py Output Formatter
Components 23
Desktop Client
- Launch Script
start.sh - Electron Main · Packages and launches the Windows desktop application.
main.cjs - React Entry
src/main.jsx - Assistant UI · Chat, model selection, API-key management, results, and status.
src/components/IntelligentAssistant.jsx
API & Control Plane
- FastAPI Gateway · Privileged boundary for UI and API commands.
backend/app.py - API Models
backend/models.py - Backend Database
backend/db.py - MCP Server · Alternate ingress for external LLM clients.
intelligent_agents/mcp_server.py
Agent Execution
- Agent Core · Interprets tasks and dispatches capability agents.
intelligent_agents/agent_core.py - System Agent
intelligent_agents/system_agent.py - Email Agent
intelligent_agents/email_agent.py - Web Agent
intelligent_agents/web_agent.py - Model Manager · Separates thinking and execution model selection.
intelligent_agents/model_manager.py - Output Formatter · Normalizes execution results for UI and MCP consumers.
intelligent_agents/output_formatter.py
Workflow Automation
- Automation Orchestrator
backend/automation/orchestrator.py - Workflow Engine
backend/automation/workflow_engine.py - Rules Engine
backend/automation/rules_engine.py - Task Scheduler
backend/automation/task_scheduler.py - Error Recovery
backend/automation/error_recovery.py
External Boundaries
- Host System · Privileged local-system boundary.
- Gmail API
- Playwright Browser
- AI Providers · Provider credentials are configured through environment or UI-managed settings.
.env.example
Connections 28
- Launch Script → FastAPI Gateway: starts
- Electron Main → React Entry: hosts
- React Entry → Assistant UI: renders
- Assistant UI → FastAPI Gateway: REST and WebSocket
- FastAPI Gateway → API Models: validates
- FastAPI Gateway → Backend Database: reads and writes
- FastAPI Gateway → Agent Core: routes commands
- FastAPI Gateway → Automation Orchestrator: starts automation
- MCP Server → Agent Core: delegates tools
- Agent Core → Model Manager: selects models
- Agent Core → System Agent: dispatches
- Agent Core → Email Agent: dispatches
- Agent Core → Web Agent: dispatches
- System Agent → Host System: automates
- Email Agent → Gmail API: calls
- Web Agent → Playwright Browser: drives
- Model Manager → AI Providers: invokes inference
- System Agent → Output Formatter: results
- Email Agent → Output Formatter: results
- Web Agent → Output Formatter: results
- Output Formatter → FastAPI Gateway: structured response
- Automation Orchestrator → Workflow Engine: runs workflows
- Automation Orchestrator → Rules Engine: evaluates rules
- Automation Orchestrator → Task Scheduler: schedules tasks
- Automation Orchestrator → Error Recovery: recovers failures
- Workflow Engine → Agent Core: executes tasks
- Rules Engine → Automation Orchestrator: triggers workflows
- Task Scheduler → Automation Orchestrator: triggers runs