# thefullgc/opensuperagent architecture

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

- Interactive diagram: https://gitdiagram.com/thefullgc/opensuperagent
- Repository: https://github.com/thefullgc/opensuperagent

## Overview

OpenSuperAgent is a self-hosted, message-driven agent system: users configure model providers and Router/Worker models, submit requests through the console or connected channels, and follow task progress and results. The runtime accepts and routes incoming work, manages persistent sessions, and coordinates workers and operations; delivery sends outbound updates. The web console exposes task, connection, skills, system, and Router views. Edges are limited to relationships visible in excerpts or the SOURCE INDEX; unshown internal routing details are omitted.

Main entry points: [`src/app.ts`](https://github.com/thefullgc/opensuperagent/blob/main/src/app.ts) (Application Runtime), [`src/session/manager.ts`](https://github.com/thefullgc/opensuperagent/blob/main/src/session/manager.ts) (Session Manager), [`src/storage/index.ts`](https://github.com/thefullgc/opensuperagent/blob/main/src/storage/index.ts) (Domain Store), [`src/worker/loop.ts`](https://github.com/thefullgc/opensuperagent/blob/main/src/worker/loop.ts) (Worker Loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Console and API"]
  node_webapp["Web Console<br/>[App.tsx]"]
  node_webapi["Web API Client<br/>[api.ts]"]
  node_server["HTTP API<br/>[server.ts]"]
end

subgraph group_runtime["Request Runtime"]
  node_ingress["Message Ingress<br/>[index.ts]"]
  node_app["Application Runtime<br/>[app.ts]"]
end

subgraph group_agents["Agent Execution"]
  node_router["Request Router<br/>[loop.ts]"]
  node_worker["Worker Loop<br/>[loop.ts]"]
  node_sessions["Session Manager<br/>[manager.ts]"]
  node_pizza["Agent Runtime<br/>[pizza-agent.ts]"]
  node_execution["Operation Runner<br/>[runner.ts]"]
  node_supervisor["Task Supervisor<br/>[index.ts]"]
  node_watchdog["Runtime Watchdog<br/>[index.ts]"]
  node_workers["Worker Definitions<br/>[definition.ts]"]
  node_catalog["Skill Catalog<br/>[import.ts]"]
end

subgraph group_state["State and Delivery"]
  node_settings["Runtime Settings<br/>[store.ts]"]
  node_store[("Domain Store<br/>[index.ts]")]
  node_database[("SQLite State<br/>[db.ts]")]
  node_events["Event Bus<br/>[bus.ts]"]
end

subgraph group_integrations["Channels and Models"]
  node_llm["Model Client<br/>[client.ts]"]
  node_channels["Channel Adapters<br/>[index.ts]"]
  node_delivery["Delivery Service<br/>[index.ts]"]
end

node_user(("Operator"))

node_user -->|"submits requests"| node_webapp
node_webapp -->|"calls API"| node_webapi
node_webapi -->|"sends HTTP requests"| node_server
node_server -->|"uses runtime"| node_app
node_app -->|"initializes"| node_ingress
node_app -->|"opens state"| node_store
node_app -->|"constructs"| node_delivery
node_app -->|"configures adapters"| node_channels
node_app -->|"coordinates"| node_sessions
node_app -->|"uses router"| node_router
node_app -->|"starts worker loop"| node_worker
node_app -->|"starts supervisor"| node_supervisor
node_app -->|"starts watchdog"| node_watchdog
node_app -->|"emits events"| node_events
node_sessions -->|"reads and writes"| node_store
node_sessions -->|"creates facade"| node_pizza
node_worker -->|"uses sessions"| node_sessions
node_worker -->|"reads and writes"| node_store
node_execution -->|"records operations"| node_store
node_supervisor -->|"coordinates sessions"| node_sessions
node_watchdog -->|"checks sessions"| node_sessions
node_watchdog -->|"uses event bus"| node_events
node_store -->|"opens database"| node_database
node_delivery -->|"queues and updates"| node_store
node_channels -->|"reads adapter config"| node_settings
node_server -->|"uses settings"| node_settings
node_router -.->|"requests model decisions"| node_llm
node_worker -.->|"runs agent turns"| node_llm
node_user -.->|"sends messages"| node_channels
node_worker -.->|"uses definitions"| node_workers
node_router -.->|"accesses skills"| node_catalog

click node_webapp "https://github.com/thefullgc/opensuperagent/blob/main/web/src/App.tsx"
click node_webapi "https://github.com/thefullgc/opensuperagent/blob/main/web/src/api.ts"
click node_server "https://github.com/thefullgc/opensuperagent/blob/main/src/api/server.ts"
click node_ingress "https://github.com/thefullgc/opensuperagent/blob/main/src/ingress/index.ts"
click node_app "https://github.com/thefullgc/opensuperagent/blob/main/src/app.ts"
click node_router "https://github.com/thefullgc/opensuperagent/blob/main/src/router/loop.ts"
click node_worker "https://github.com/thefullgc/opensuperagent/blob/main/src/worker/loop.ts"
click node_sessions "https://github.com/thefullgc/opensuperagent/blob/main/src/session/manager.ts"
click node_pizza "https://github.com/thefullgc/opensuperagent/blob/main/src/session/pizza-agent.ts"
click node_execution "https://github.com/thefullgc/opensuperagent/blob/main/src/execution/runner.ts"
click node_supervisor "https://github.com/thefullgc/opensuperagent/blob/main/src/supervisor/index.ts"
click node_watchdog "https://github.com/thefullgc/opensuperagent/blob/main/src/watchdog/index.ts"
click node_llm "https://github.com/thefullgc/opensuperagent/blob/main/src/llm/client.ts"
click node_channels "https://github.com/thefullgc/opensuperagent/blob/main/src/channels/adapters/index.ts"
click node_delivery "https://github.com/thefullgc/opensuperagent/blob/main/src/delivery/index.ts"
click node_settings "https://github.com/thefullgc/opensuperagent/blob/main/src/settings/store.ts"
click node_store "https://github.com/thefullgc/opensuperagent/blob/main/src/storage/index.ts"
click node_database "https://github.com/thefullgc/opensuperagent/blob/main/src/storage/db.ts"
click node_events "https://github.com/thefullgc/opensuperagent/blob/main/src/events/bus.ts"
click node_workers "https://github.com/thefullgc/opensuperagent/blob/main/src/worker/definition.ts"
click node_catalog "https://github.com/thefullgc/opensuperagent/blob/main/src/catalog/import.ts"

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_webapp,node_webapi,node_server toneBlue
class node_ingress,node_app toneAmber
class node_router,node_worker,node_sessions,node_pizza,node_execution,node_supervisor,node_watchdog,node_workers,node_catalog toneMint
class node_settings,node_store,node_database,node_events toneRose
class node_llm,node_channels,node_delivery,node_user toneIndigo
```

## Components

### Console and API

- [Web Console](https://github.com/thefullgc/opensuperagent/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Web API Client](https://github.com/thefullgc/opensuperagent/blob/main/web/src/api.ts): `web/src/api.ts`
- [HTTP API](https://github.com/thefullgc/opensuperagent/blob/main/src/api/server.ts): `src/api/server.ts`

### Request Runtime

- [Message Ingress](https://github.com/thefullgc/opensuperagent/blob/main/src/ingress/index.ts): `src/ingress/index.ts`
- [Application Runtime](https://github.com/thefullgc/opensuperagent/blob/main/src/app.ts): `src/app.ts`

### Agent Execution

- [Request Router](https://github.com/thefullgc/opensuperagent/blob/main/src/router/loop.ts): `src/router/loop.ts`
- [Worker Loop](https://github.com/thefullgc/opensuperagent/blob/main/src/worker/loop.ts): `src/worker/loop.ts`
- [Session Manager](https://github.com/thefullgc/opensuperagent/blob/main/src/session/manager.ts): `src/session/manager.ts`
- [Agent Runtime](https://github.com/thefullgc/opensuperagent/blob/main/src/session/pizza-agent.ts): `src/session/pizza-agent.ts`
- [Operation Runner](https://github.com/thefullgc/opensuperagent/blob/main/src/execution/runner.ts): `src/execution/runner.ts`
- [Task Supervisor](https://github.com/thefullgc/opensuperagent/blob/main/src/supervisor/index.ts): `src/supervisor/index.ts`
- [Runtime Watchdog](https://github.com/thefullgc/opensuperagent/blob/main/src/watchdog/index.ts): `src/watchdog/index.ts`
- [Worker Definitions](https://github.com/thefullgc/opensuperagent/blob/main/src/worker/definition.ts): `src/worker/definition.ts`
- [Skill Catalog](https://github.com/thefullgc/opensuperagent/blob/main/src/catalog/import.ts): `src/catalog/import.ts`

### State and Delivery

- [Runtime Settings](https://github.com/thefullgc/opensuperagent/blob/main/src/settings/store.ts): `src/settings/store.ts`
- [Domain Store](https://github.com/thefullgc/opensuperagent/blob/main/src/storage/index.ts): `src/storage/index.ts`
- [SQLite State](https://github.com/thefullgc/opensuperagent/blob/main/src/storage/db.ts): `src/storage/db.ts`
- [Event Bus](https://github.com/thefullgc/opensuperagent/blob/main/src/events/bus.ts): `src/events/bus.ts`

### Channels and Models

- [Model Client](https://github.com/thefullgc/opensuperagent/blob/main/src/llm/client.ts): `src/llm/client.ts`
- [Channel Adapters](https://github.com/thefullgc/opensuperagent/blob/main/src/channels/adapters/index.ts): `src/channels/adapters/index.ts`
- [Delivery Service](https://github.com/thefullgc/opensuperagent/blob/main/src/delivery/index.ts): `src/delivery/index.ts`

### Other components

- **Operator**

## Connections

- Operator → Web Console: submits requests (evidence: `README.md`)
- Web Console → Web API Client: calls API (evidence: `web/src/App.tsx`)
- Web API Client → HTTP API: sends HTTP requests (evidence: `web/src/api.ts`)
- HTTP API → Application Runtime: uses runtime (evidence: `src/api/server.ts`)
- Application Runtime → Message Ingress: initializes (evidence: `src/app.ts`)
- Application Runtime → Domain Store: opens state (evidence: `src/app.ts`)
- Application Runtime → Delivery Service: constructs (evidence: `src/app.ts`)
- Application Runtime → Channel Adapters: configures adapters (evidence: `src/app.ts`)
- Application Runtime → Session Manager: coordinates (evidence: `src/app.ts`)
- Application Runtime → Request Router: uses router (evidence: `src/app.ts`)
- Application Runtime → Worker Loop: starts worker loop (evidence: `src/app.ts`)
- Application Runtime → Task Supervisor: starts supervisor (evidence: `src/app.ts`)
- Application Runtime → Runtime Watchdog: starts watchdog (evidence: `src/app.ts`)
- Application Runtime → Event Bus: emits events (evidence: `src/app.ts`)
- Session Manager → Domain Store: reads and writes (evidence: `src/session/manager.ts`)
- Session Manager → Agent Runtime: creates facade
- Worker Loop → Session Manager: uses sessions (evidence: `src/worker/loop.ts`)
- Worker Loop → Domain Store: reads and writes (evidence: `src/worker/loop.ts`)
- Operation Runner → Domain Store: records operations (evidence: `src/execution/runner.ts`)
- Task Supervisor → Session Manager: coordinates sessions (evidence: `src/supervisor/index.ts`)
- Runtime Watchdog → Session Manager: checks sessions (evidence: `src/watchdog/index.ts`)
- Runtime Watchdog → Event Bus: uses event bus (evidence: `src/watchdog/index.ts`)
- Domain Store → SQLite State: opens database (evidence: `src/storage/index.ts`)
- Delivery Service → Domain Store: queues and updates (evidence: `src/delivery/index.ts`)
- Channel Adapters → Runtime Settings: reads adapter config
- HTTP API → Runtime Settings: uses settings (evidence: `src/api/server.ts`)
- Request Router → Model Client: requests model decisions
- Worker Loop → Model Client: runs agent turns
- Operator → Channel Adapters: sends messages (evidence: `README.md`)
- Worker Loop → Worker Definitions: uses definitions
- Request Router → Skill Catalog: accesses skills
