# zju-real/hugagentos architecture

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

- Interactive diagram: https://gitdiagram.com/zju-real/hugagentos
- Repository: https://github.com/zju-real/hugagentos

## Overview

HugAgentOS is a self-hosted durable agent harness: users submit work through web or messaging interfaces, the server continues it in the background, and users receive results or approval requests. The map follows that workflow through the API, agent runtime, sandbox, and persistent state, while retaining documented capabilities for personal agents, memory, knowledge, integrations, and desktop/hybrid use. Relationships involving unsampled subsystems are included only where the README documents them; source-level links are limited to indexed or excerpted evidence.

Main entry points: [`src/backend/core/agent_runtime/runner.py`](https://github.com/zju-real/hugagentos/blob/main/src/backend/core/agent_runtime/runner.py) (Agent runtime), [`src/frontend/src/hooks/useAppController.ts`](https://github.com/zju-real/hugagentos/blob/main/src/frontend/src/hooks/useAppController.ts) (Web application), [`src/backend/personal_agent/memory/dreaming/pipeline.py`](https://github.com/zju-real/hugagentos/blob/main/src/backend/personal_agent/memory/dreaming/pipeline.py) (Personal agent), [`src/backend/api/app.py`](https://github.com/zju-real/hugagentos/blob/main/src/backend/api/app.py) (Backend API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web["Web application"]
  node_frontend_api["Frontend API client<br/>[api.ts]"]
  node_chat_storage[("Chat browser storage<br/>[storage.ts]")]
  node_channels["Messaging channels<br/>[manager.py]"]
  node_desktop["Desktop and hybrid<br/>[hybrid.rs]"]
end

subgraph group_execution["Agent execution"]
  node_backend_api["Backend API<br/>[app.py]"]
  node_agent_runtime["Agent runtime<br/>[runner.py]"]
  node_durable_jobs["Background jobs<br/>[jobs.py]"]
  node_sandbox["Persistent sandbox"]
  node_approvals["Human approvals<br/>[tool_approval.py]"]
end

subgraph group_capabilities["Agent capabilities"]
  node_personal_agent["Personal agent<br/>[pipeline.py]"]
  node_memory["Memory pipeline<br/>[pipeline.py]"]
  node_wiki["Knowledge wiki<br/>[pipeline.py]"]
  node_skills["Skills and tools<br/>[management.py]"]
  node_evolution["Approved evolution"]
end

subgraph group_platform["Platform and state"]
  node_settings["Application settings<br/>[settings.py]"]
  node_database[("Application database<br/>[engine.py]")]
  node_models[("Evolution records<br/>[evolution.py]")]
  node_logging["Structured logging<br/>[logging.py]"]
end

node_user(("User"))

node_user -->|"submits task"| node_web
node_web -->|"calls API"| node_frontend_api
node_frontend_api -->|"sends requests"| node_backend_api
node_user -->|"hands off task"| node_channels
node_channels -->|"routes messages"| node_personal_agent
node_backend_api -->|"starts background work"| node_durable_jobs
node_durable_jobs -->|"runs task"| node_agent_runtime
node_agent_runtime -->|"works in sandbox"| node_sandbox
node_agent_runtime -->|"requests approval"| node_approvals
node_approvals -->|"awaits decision"| node_user
node_agent_runtime -->|"uses memory"| node_memory
node_personal_agent -->|"uses permanent computer"| node_sandbox
node_personal_agent -->|"organizes memory"| node_memory
node_memory -->|"builds memory wiki"| node_wiki
node_agent_runtime -->|"uses skills and tools"| node_skills
node_agent_runtime -->|"supports self-evolution"| node_evolution
node_user -->|"connects local device"| node_desktop
node_desktop -->|"hybrid operation"| node_backend_api
node_web -->|"persists chat state"| node_chat_storage
node_settings -->|"configures database"| node_database
node_database -->|"loads model metadata"| node_models

click node_web "https://github.com/zju-real/hugagentos/blob/main/src/frontend/src/hooks/useAppController.ts"
click node_frontend_api "https://github.com/zju-real/hugagentos/blob/main/src/frontend/src/api.ts"
click node_chat_storage "https://github.com/zju-real/hugagentos/blob/main/src/frontend/src/storage.ts"
click node_backend_api "https://github.com/zju-real/hugagentos/blob/main/src/backend/api/app.py"
click node_agent_runtime "https://github.com/zju-real/hugagentos/blob/main/src/backend/core/agent_runtime/runner.py"
click node_durable_jobs "https://github.com/zju-real/hugagentos/blob/main/src/backend/api/routes/v1/jobs.py"
click node_sandbox "https://github.com/zju-real/hugagentos/blob/main/docker/opensandbox-server/opensandbox_mount_worker.py"
click node_approvals "https://github.com/zju-real/hugagentos/blob/main/src/backend/api/routes/v1/tool_approval.py"
click node_channels "https://github.com/zju-real/hugagentos/blob/main/src/backend/integrations/channels/manager.py"
click node_personal_agent "https://github.com/zju-real/hugagentos/blob/main/src/backend/personal_agent/memory/dreaming/pipeline.py"
click node_memory "https://github.com/zju-real/hugagentos/blob/main/src/backend/core/memory/pipeline.py"
click node_wiki "https://github.com/zju-real/hugagentos/blob/main/src/backend/features/knowledge/wiki/pipeline.py"
click node_skills "https://github.com/zju-real/hugagentos/blob/main/src/backend/core/capabilities/skills/management.py"
click node_evolution "https://github.com/zju-real/hugagentos/blob/main/src/backend/core/evolution/generators/skill_candidate_engine.py"
click node_desktop "https://github.com/zju-real/hugagentos/blob/main/desktop/src-tauri/src/hybrid.rs"
click node_settings "https://github.com/zju-real/hugagentos/blob/main/src/backend/core/config/settings.py"
click node_database "https://github.com/zju-real/hugagentos/blob/main/src/backend/core/db/engine.py"
click node_models "https://github.com/zju-real/hugagentos/blob/main/src/backend/core/db/models/evolution.py"
click node_logging "https://github.com/zju-real/hugagentos/blob/main/src/backend/core/infra/logging.py"

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_web,node_frontend_api,node_chat_storage,node_channels,node_desktop,node_user toneBlue
class node_backend_api,node_agent_runtime,node_durable_jobs,node_sandbox,node_approvals toneAmber
class node_personal_agent,node_memory,node_wiki,node_skills,node_evolution toneMint
class node_settings,node_database,node_models,node_logging toneRose
```

## Components

### User experience

- [Web application](https://github.com/zju-real/hugagentos/blob/main/src/frontend/src/hooks/useAppController.ts): `src/frontend/src/hooks/useAppController.ts`
- [Frontend API client](https://github.com/zju-real/hugagentos/blob/main/src/frontend/src/api.ts): `src/frontend/src/api.ts`
- [Chat browser storage](https://github.com/zju-real/hugagentos/blob/main/src/frontend/src/storage.ts): `src/frontend/src/storage.ts`
- [Messaging channels](https://github.com/zju-real/hugagentos/blob/main/src/backend/integrations/channels/manager.py): `src/backend/integrations/channels/manager.py`
- [Desktop and hybrid](https://github.com/zju-real/hugagentos/blob/main/desktop/src-tauri/src/hybrid.rs): `desktop/src-tauri/src/hybrid.rs`

### Agent execution

- [Backend API](https://github.com/zju-real/hugagentos/blob/main/src/backend/api/app.py): `src/backend/api/app.py`
- [Agent runtime](https://github.com/zju-real/hugagentos/blob/main/src/backend/core/agent_runtime/runner.py): `src/backend/core/agent_runtime/runner.py`
- [Background jobs](https://github.com/zju-real/hugagentos/blob/main/src/backend/api/routes/v1/jobs.py): `src/backend/api/routes/v1/jobs.py`
- [Persistent sandbox](https://github.com/zju-real/hugagentos/blob/main/docker/opensandbox-server/opensandbox_mount_worker.py): `docker/opensandbox-server/opensandbox_mount_worker.py`
- [Human approvals](https://github.com/zju-real/hugagentos/blob/main/src/backend/api/routes/v1/tool_approval.py): `src/backend/api/routes/v1/tool_approval.py`

### Agent capabilities

- [Personal agent](https://github.com/zju-real/hugagentos/blob/main/src/backend/personal_agent/memory/dreaming/pipeline.py): `src/backend/personal_agent/memory/dreaming/pipeline.py`
- [Memory pipeline](https://github.com/zju-real/hugagentos/blob/main/src/backend/core/memory/pipeline.py): `src/backend/core/memory/pipeline.py`
- [Knowledge wiki](https://github.com/zju-real/hugagentos/blob/main/src/backend/features/knowledge/wiki/pipeline.py): `src/backend/features/knowledge/wiki/pipeline.py`
- [Skills and tools](https://github.com/zju-real/hugagentos/blob/main/src/backend/core/capabilities/skills/management.py): `src/backend/core/capabilities/skills/management.py`
- [Approved evolution](https://github.com/zju-real/hugagentos/blob/main/src/backend/core/evolution/generators/skill_candidate_engine.py): `src/backend/core/evolution/generators/skill_candidate_engine.py`

### Platform and state

- [Application settings](https://github.com/zju-real/hugagentos/blob/main/src/backend/core/config/settings.py): `src/backend/core/config/settings.py`
- [Application database](https://github.com/zju-real/hugagentos/blob/main/src/backend/core/db/engine.py): `src/backend/core/db/engine.py`
- [Evolution records](https://github.com/zju-real/hugagentos/blob/main/src/backend/core/db/models/evolution.py): `src/backend/core/db/models/evolution.py`
- [Structured logging](https://github.com/zju-real/hugagentos/blob/main/src/backend/core/infra/logging.py): `src/backend/core/infra/logging.py`

### Other components

- **User**

## Connections

- User → Web application: submits task (evidence: `README.md`)
- Web application → Frontend API client: calls API (evidence: `src/frontend/src/hooks/useAppController.ts`)
- Frontend API client → Backend API: sends requests (evidence: `src/frontend/src/api.ts`)
- User → Messaging channels: hands off task (evidence: `README.md`)
- Messaging channels → Personal agent: routes messages (evidence: `README.md`)
- Backend API → Background jobs: starts background work (evidence: `README.md`)
- Background jobs → Agent runtime: runs task (evidence: `README.md`)
- Agent runtime → Persistent sandbox: works in sandbox (evidence: `README.md`)
- Agent runtime → Human approvals: requests approval (evidence: `README.md`)
- Human approvals → User: awaits decision (evidence: `README.md`)
- Agent runtime → Memory pipeline: uses memory (evidence: `README.md`)
- Personal agent → Persistent sandbox: uses permanent computer (evidence: `README.md`)
- Personal agent → Memory pipeline: organizes memory (evidence: `README.md`)
- Memory pipeline → Knowledge wiki: builds memory wiki (evidence: `README.md`)
- Agent runtime → Skills and tools: uses skills and tools (evidence: `README.md`)
- Agent runtime → Approved evolution: supports self-evolution (evidence: `README.md`)
- User → Desktop and hybrid: connects local device (evidence: `README.md`)
- Desktop and hybrid → Backend API: hybrid operation (evidence: `README.md`)
- Web application → Chat browser storage: persists chat state (evidence: `src/frontend/src/hooks/useAppController.ts`)
- Application settings → Application database: configures database (evidence: `src/backend/core/db/engine.py`)
- Application database → Evolution records: loads model metadata (evidence: `src/backend/core/db/engine.py`)
