# astrbotdevs/astrbot architecture

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

- Interactive diagram: https://gitdiagram.com/astrbotdevs/astrbot
- Repository: https://github.com/astrbotdevs/astrbot

## Overview

AstrBot is an extensible conversational-agent platform that connects messaging channels and Web Chat to AI providers, agent tools, plugins, and knowledge features. Its principal runtime path is incoming platform activity through the core event pipeline to an agent/provider response and back to the channel. The dashboard provides separate administration and ChatUI capabilities. The excerpts show lifecycle orchestration, platform management, and dashboard service wiring; several runtime links are documented only at the product level, so those are marked unverified.

Main entry points: [`astrbot/dashboard/services`](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/dashboard/services) (Dashboard services), [`astrbot/core/agent`](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/agent) (Agent runners), [`astrbot/core/core_lifecycle.py`](https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/core_lifecycle.py) (Core lifecycle), [`astrbot/core/pipeline`](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/pipeline) (Event pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_channels["Messaging channels"]
  node_platforms["Platform adapters"]
  node_platform_manager["Platform manager<br/>[manager.py]"]
  node_webchat["Web Chat adapter<br/>[webchat_adapter.py]"]
end

subgraph group_runtime["Core runtime"]
  node_lifecycle["Core lifecycle<br/>[core_lifecycle.py]"]
  node_pipeline["Event pipeline"]
  node_plugins["Plugin system"]
  node_builtin["Built-in bot<br/>[main.py]"]
end

subgraph group_intelligence["Agent capabilities"]
  node_providers["LLM providers"]
  node_agent["Agent runners"]
  node_tools["Agent tools"]
  node_computer["Sandboxed computer"]
  node_skills["Skills<br/>[skill_manager.py]"]
end

subgraph group_data["Knowledge and state"]
  node_knowledge["Knowledge base"]
  node_database[("Persistent database")]
  node_history["Conversation history"]
end

subgraph group_dashboard["Dashboard and ChatUI"]
  node_dashboard["Dashboard API<br/>[app.py]"]
  node_dashboard_services["Dashboard services"]
  node_chat_service["ChatUI service<br/>[chat_service.py]"]
end

node_user(("Chat user"))
node_web_user(("WebUI user"))

node_user -.->|"sends messages"| node_platforms
node_platforms -->|"registers adapters"| node_platform_manager
node_platform_manager -.->|"starts platforms"| node_lifecycle
node_webchat -->|"joins runtime"| node_platform_manager
node_lifecycle -->|"initializes pipeline"| node_pipeline
node_pipeline -.->|"dispatches events"| node_builtin
node_pipeline -.->|"dispatches handlers"| node_plugins
node_builtin -->|"records messages"| node_history
node_agent -.->|"requests completions"| node_providers
node_agent -.->|"invokes tools"| node_tools
node_tools -.->|"uses sandbox"| node_computer
node_agent -.->|"retrieves context"| node_knowledge
node_lifecycle -->|"initializes providers"| node_providers
node_knowledge -.->|"stores knowledge"| node_database
node_history -.->|"persists history"| node_database
node_web_user -.->|"uses dashboard"| node_dashboard
node_dashboard -->|"configures services"| node_dashboard_services
node_dashboard_services -.->|"routes chat"| node_chat_service
node_chat_service -.->|"runs chat agent"| node_agent
node_dashboard_services -.->|"manages knowledge"| node_knowledge
node_dashboard_services -.->|"manages extensions"| node_plugins

click node_platforms "https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/platform/sources"
click node_platform_manager "https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/platform/manager.py"
click node_webchat "https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/platform/sources/webchat/webchat_adapter.py"
click node_lifecycle "https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/core_lifecycle.py"
click node_pipeline "https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/pipeline"
click node_plugins "https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/star"
click node_builtin "https://github.com/astrbotdevs/astrbot/blob/master/astrbot/builtin_stars/astrbot/main.py"
click node_providers "https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/provider"
click node_agent "https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/agent"
click node_tools "https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/tools"
click node_computer "https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/computer"
click node_skills "https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/skills/skill_manager.py"
click node_knowledge "https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/knowledge_base"
click node_database "https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/db"
click node_history "https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/conversation_mgr.py"
click node_dashboard "https://github.com/astrbotdevs/astrbot/blob/master/astrbot/dashboard/api/app.py"
click node_dashboard_services "https://github.com/astrbotdevs/astrbot/tree/master/astrbot/dashboard/services"
click node_chat_service "https://github.com/astrbotdevs/astrbot/blob/master/astrbot/dashboard/services/chat_service.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_platforms,node_platform_manager,node_webchat,node_user,node_web_user toneBlue
class node_lifecycle,node_pipeline,node_plugins,node_builtin toneAmber
class node_providers,node_agent,node_tools,node_computer,node_skills toneMint
class node_knowledge,node_database,node_history toneRose
class node_dashboard,node_dashboard_services,node_chat_service toneIndigo
```

## Components

### Messaging channels

- [Platform adapters](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/platform/sources): `astrbot/core/platform/sources`
- [Platform manager](https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/platform/manager.py): `astrbot/core/platform/manager.py`
- [Web Chat adapter](https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/platform/sources/webchat/webchat_adapter.py): `astrbot/core/platform/sources/webchat/webchat_adapter.py`

### Core runtime

- [Core lifecycle](https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/core_lifecycle.py): `astrbot/core/core_lifecycle.py`
- [Event pipeline](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/pipeline): `astrbot/core/pipeline`
- [Plugin system](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/star): `astrbot/core/star`
- [Built-in bot](https://github.com/astrbotdevs/astrbot/blob/master/astrbot/builtin_stars/astrbot/main.py): `astrbot/builtin_stars/astrbot/main.py`

### Agent capabilities

- [LLM providers](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/provider): `astrbot/core/provider`
- [Agent runners](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/agent): `astrbot/core/agent`
- [Agent tools](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/tools): `astrbot/core/tools`
- [Sandboxed computer](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/computer): `astrbot/core/computer`
- [Skills](https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/skills/skill_manager.py): `astrbot/core/skills/skill_manager.py`

### Knowledge and state

- [Knowledge base](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/knowledge_base): `astrbot/core/knowledge_base`
- [Persistent database](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/core/db): `astrbot/core/db`
- [Conversation history](https://github.com/astrbotdevs/astrbot/blob/master/astrbot/core/conversation_mgr.py): `astrbot/core/conversation_mgr.py`

### Dashboard and ChatUI

- [Dashboard API](https://github.com/astrbotdevs/astrbot/blob/master/astrbot/dashboard/api/app.py): `astrbot/dashboard/api/app.py`
- [Dashboard services](https://github.com/astrbotdevs/astrbot/tree/master/astrbot/dashboard/services): `astrbot/dashboard/services`
- [ChatUI service](https://github.com/astrbotdevs/astrbot/blob/master/astrbot/dashboard/services/chat_service.py): `astrbot/dashboard/services/chat_service.py`

### Other components

- **Chat user**
- **WebUI user**

## Connections

- Chat user → Platform adapters: sends messages
- Platform adapters → Platform manager: registers adapters (evidence: `astrbot/core/platform/manager.py`)
- Platform manager → Core lifecycle: starts platforms (evidence: `astrbot/core/core_lifecycle.py`)
- Web Chat adapter → Platform manager: joins runtime (evidence: `astrbot/core/platform/manager.py`)
- Core lifecycle → Event pipeline: initializes pipeline (evidence: `astrbot/core/core_lifecycle.py`)
- Event pipeline → Built-in bot: dispatches events
- Event pipeline → Plugin system: dispatches handlers
- Built-in bot → Conversation history: records messages (evidence: `astrbot/builtin_stars/astrbot/main.py`)
- Agent runners → LLM providers: requests completions (evidence: `astrbot/core/provider/func_tool_manager.py`)
- Agent runners → Agent tools: invokes tools
- Agent tools → Sandboxed computer: uses sandbox
- Agent runners → Knowledge base: retrieves context
- Core lifecycle → LLM providers: initializes providers (evidence: `astrbot/core/core_lifecycle.py`)
- Knowledge base → Persistent database: stores knowledge (evidence: `astrbot/core/db/vec_db/faiss_impl/document_storage.py`)
- Conversation history → Persistent database: persists history
- WebUI user → Dashboard API: uses dashboard
- Dashboard API → Dashboard services: configures services (evidence: `astrbot/dashboard/api/app.py`)
- Dashboard services → ChatUI service: routes chat (evidence: `astrbot/dashboard/services/chat_service.py`)
- ChatUI service → Agent runners: runs chat agent (evidence: `astrbot/dashboard/services/chat_service.py`)
- Dashboard services → Knowledge base: manages knowledge
- Dashboard services → Plugin system: manages extensions (evidence: `astrbot/dashboard/services/config_service.py`)
