# haseebashfaq488/ai-automation architecture

> Architecture diagram of the GitHub repository haseebashfaq488/ai-automation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/haseebashfaq488/ai-automation
- Repository: https://github.com/haseebashfaq488/ai-automation

## Overview

Jarvis is an AI automation control plane: users interact through a Next.js dashboard, while a FastAPI backend exposes agent, task, worker, tool, skill, and pipeline operations. Worker execution turns agent decisions into tool calls; separate pipelines support file organization, email, and WhatsApp workflows. The tree documents integrations and UI surfaces, but most of their implementations were not sampled, so those branches are shown at subsystem level and uncertain wiring is omitted.

Main entry points: [`backend/app/main.py`](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/main.py) (FastAPI App), [`backend/app/workers/base/engine.py`](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/workers/base/engine.py) (Worker Engine), [`backend/app/modules/file_management/pipelines`](https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/file_management/pipelines) (Automation Pipelines), [`AI-Automation Frontend/app/lib/api.js`](https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/lib/api.js) (Frontend API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Dashboard"]
  node_dashboard["Dashboard<br/>[page.js]"]
  node_workers_ui["Workers UI<br/>[page.js]"]
  node_worker_ui["Worker Detail<br/>[page.js]"]
  node_chat["Chat And Controls<br/>[Chat.js]"]
  node_api_client["Frontend API Client<br/>[api.js]"]
end

subgraph group_api["API Control Plane"]
  node_app["FastAPI App<br/>[main.py]"]
  node_agent_routes["Agent Routes<br/>[agent.py]"]
  node_task_routes["Task Routes<br/>[tasks.py]"]
  node_worker_routes["Worker Routes<br/>[workers.py]"]
  node_pipeline_routes["Pipeline Routes<br/>[pipelines.py]"]
end

subgraph group_execution["Agent Execution"]
  node_worker_engine["Worker Engine<br/>[engine.py]"]
  node_worker_agents["Worker Agents<br/>[worker_agent.py]"]
  node_execution_engine["Tool Execution"]
  node_tool_registry["Tool Registry<br/>[tool_registry.py]"]
end

subgraph group_automation["Automation Modules"]
  node_pipelines["Automation Pipelines"]
  node_file_tools["File Management"]
  node_gmail["Gmail Skills And Tools"]
  node_drive["Drive Skills And Tools"]
  node_whatsapp["WhatsApp Skills And Tools"]
end

subgraph group_state["State And Events"]
  node_memory["Conversation Memory"]
  node_event_bus["Event Bus<br/>[bus.py]"]
  node_database[("Database And Repository<br/>[repository.py]")]
end

subgraph group_integrations["External Services"]
  node_wa_service["WhatsApp Web Service<br/>[server.js]"]
  node_gmail_service["Gmail"]
  node_drive_service["Google Drive"]
  node_antigravity["Antigravity CLI"]
  node_opencode["OpenCode CLI"]
end

node_user(("User"))

node_user -->|"uses"| node_dashboard
node_user -->|"manages workers"| node_workers_ui
node_dashboard -->|"interacts through"| node_chat
node_dashboard -->|"requests through"| node_api_client
node_workers_ui -->|"requests through"| node_api_client
node_worker_ui -->|"requests through"| node_api_client
node_api_client -->|"HTTP requests"| node_app
node_app -->|"routes requests"| node_agent_routes
node_app -->|"routes requests"| node_task_routes
node_app -->|"routes requests"| node_worker_routes
node_app -->|"routes requests"| node_pipeline_routes
node_worker_engine -->|"requests decisions"| node_worker_agents
node_worker_engine -->|"runs tool steps"| node_execution_engine
node_execution_engine -->|"looks up tools"| node_tool_registry
node_pipeline_routes -->|"runs selected pipeline"| node_pipelines
node_pipelines -.->|"uses file capabilities"| node_file_tools
node_pipelines -->|"runs email workflows"| node_gmail
node_pipelines -->|"runs messaging workflows"| node_whatsapp
node_whatsapp -->|"calls service"| node_wa_service
node_gmail -.->|"uses integration"| node_gmail_service
node_drive -.->|"uses integration"| node_drive_service
node_worker_agents -.->|"CLI integration"| node_antigravity
node_worker_agents -.->|"CLI integration"| node_opencode
node_worker_engine -->|"emits execution events"| node_event_bus
node_worker_engine -->|"session state"| node_database

click node_dashboard "https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/page.js"
click node_workers_ui "https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/workers/page.js"
click node_worker_ui "https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/worker/%5Bid%5D/page.js"
click node_chat "https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/components/Chat.js"
click node_api_client "https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/lib/api.js"
click node_app "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/main.py"
click node_agent_routes "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/api/routes/agent.py"
click node_task_routes "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/api/routes/tasks.py"
click node_worker_routes "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/api/routes/workers.py"
click node_pipeline_routes "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/api/routes/pipelines.py"
click node_worker_engine "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/workers/base/engine.py"
click node_worker_agents "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/workers/antigravity_worker/agent/worker_agent.py"
click node_execution_engine "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/core/execution_engine.py"
click node_tool_registry "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/registry/tool_registry.py"
click node_pipelines "https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/file_management/pipelines"
click node_file_tools "https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/file_management/tools"
click node_gmail "https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/gmail"
click node_drive "https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/drive"
click node_whatsapp "https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/whatsapp"
click node_memory "https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/memory"
click node_event_bus "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/core/events/bus.py"
click node_database "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/modules/database/repository.py"
click node_wa_service "https://github.com/haseebashfaq488/ai-automation/blob/main/backend/whatsapp_service/server.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_workers_ui,node_worker_ui,node_chat,node_api_client,node_user toneBlue
class node_app,node_agent_routes,node_task_routes,node_worker_routes,node_pipeline_routes toneAmber
class node_worker_engine,node_worker_agents,node_execution_engine,node_tool_registry toneMint
class node_pipelines,node_file_tools,node_gmail,node_drive,node_whatsapp toneRose
class node_memory,node_event_bus,node_database toneIndigo
class node_wa_service,node_gmail_service,node_drive_service,node_antigravity,node_opencode toneTeal
```

## Components

### Dashboard

- [Dashboard](https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/page.js): `AI-Automation Frontend/app/page.js`
- [Workers UI](https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/workers/page.js): `AI-Automation Frontend/app/workers/page.js`
- [Worker Detail](https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/worker/%5Bid%5D/page.js): `AI-Automation Frontend/app/worker/[id]/page.js`
- [Chat And Controls](https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/components/Chat.js): `AI-Automation Frontend/app/components/Chat.js`
- [Frontend API Client](https://github.com/haseebashfaq488/ai-automation/blob/main/AI-Automation%20Frontend/app/lib/api.js): `AI-Automation Frontend/app/lib/api.js`

### API Control Plane

- [FastAPI App](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/main.py): `backend/app/main.py`
- [Agent Routes](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/api/routes/agent.py): `backend/app/api/routes/agent.py`
- [Task Routes](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/api/routes/tasks.py): `backend/app/api/routes/tasks.py`
- [Worker Routes](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/api/routes/workers.py): `backend/app/api/routes/workers.py`
- [Pipeline Routes](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/api/routes/pipelines.py): `backend/app/api/routes/pipelines.py`

### Agent Execution

- [Worker Engine](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/workers/base/engine.py): `backend/app/workers/base/engine.py`
- [Worker Agents](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/workers/antigravity_worker/agent/worker_agent.py): `backend/app/workers/antigravity_worker/agent/worker_agent.py`
- [Tool Execution](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/core/execution_engine.py): `backend/app/core/execution_engine.py`
- [Tool Registry](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/registry/tool_registry.py): `backend/app/registry/tool_registry.py`

### Automation Modules

- [Automation Pipelines](https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/file_management/pipelines): `backend/app/modules/file_management/pipelines`
- [File Management](https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/file_management/tools): `backend/app/modules/file_management/tools`
- [Gmail Skills And Tools](https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/gmail): `backend/app/modules/gmail`
- [Drive Skills And Tools](https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/drive): `backend/app/modules/drive`
- [WhatsApp Skills And Tools](https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/whatsapp): `backend/app/modules/whatsapp`

### State And Events

- [Conversation Memory](https://github.com/haseebashfaq488/ai-automation/tree/main/backend/app/modules/memory): `backend/app/modules/memory`
- [Event Bus](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/core/events/bus.py): `backend/app/core/events/bus.py`
- [Database And Repository](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/app/modules/database/repository.py): `backend/app/modules/database/repository.py`

### External Services

- [WhatsApp Web Service](https://github.com/haseebashfaq488/ai-automation/blob/main/backend/whatsapp_service/server.js): `backend/whatsapp_service/server.js`
- **Gmail**
- **Google Drive**
- **Antigravity CLI**
- **OpenCode CLI**

### Other components

- **User**

## Connections

- User → Dashboard: uses
- User → Workers UI: manages workers
- Dashboard → Chat And Controls: interacts through
- Dashboard → Frontend API Client: requests through
- Workers UI → Frontend API Client: requests through
- Worker Detail → Frontend API Client: requests through
- Frontend API Client → FastAPI App: HTTP requests
- FastAPI App → Agent Routes: routes requests
- FastAPI App → Task Routes: routes requests
- FastAPI App → Worker Routes: routes requests
- FastAPI App → Pipeline Routes: routes requests
- Worker Engine → Worker Agents: requests decisions
- Worker Engine → Tool Execution: runs tool steps
- Tool Execution → Tool Registry: looks up tools
- Pipeline Routes → Automation Pipelines: runs selected pipeline
- Automation Pipelines → File Management: uses file capabilities
- Automation Pipelines → Gmail Skills And Tools: runs email workflows
- Automation Pipelines → WhatsApp Skills And Tools: runs messaging workflows
- WhatsApp Skills And Tools → WhatsApp Web Service: calls service
- Gmail Skills And Tools → Gmail: uses integration
- Drive Skills And Tools → Google Drive: uses integration
- Worker Agents → Antigravity CLI: CLI integration
- Worker Agents → OpenCode CLI: CLI integration
- Worker Engine → Event Bus: emits execution events
- Worker Engine → Database And Repository: session state
