# langbot-app/langbot architecture

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

- Interactive diagram: https://gitdiagram.com/langbot-app/langbot
- Repository: https://github.com/langbot-app/langbot

## Overview

LangBot is a platform for configuring and running AI-powered bots across instant-messaging services. The primary workflow is an incoming platform event, normalized by an adapter, processed through a configured pipeline and its AI/agent capabilities, then answered through the platform. The management API and web panel configure pipelines, integrations, and workspaces; monitoring surfaces runtime activity. The README documents broad provider, knowledge-base, plugin, and MCP capabilities. Some runtime wiring and those subsystems’ implementations were not sampled, so uncertain links are omitted.

Main entry points: [`src/langbot/pkg/pipeline/pipelinemgr.py`](https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/pipeline/pipelinemgr.py) (Pipeline runtime), [`src/langbot/pkg/api/http/controller`](https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/api/http/controller) (HTTP management API), [`src/langbot/pkg/platform/adapters`](https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/platform/adapters) (Platform adapters), [`src/langbot/pkg/entity/persistence/pipeline.py`](https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/entity/persistence/pipeline.py) (Pipeline records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_channels["Chat channels"]
  node_adapters["Platform adapters"]
end

subgraph group_runtime["Conversation runtime"]
  node_pipeline["Pipeline runtime<br/>[pipelinemgr.py]"]
  node_stages["Pipeline stages"]
  node_agent["Agent runner"]
  node_ai_services["AI and RAG integrations"]
end

subgraph group_management["Management and extensions"]
  node_plugins["Plugins and components<br/>[engine.py]"]
  node_mcp["MCP resources"]
  node_api["HTTP management API"]
  node_web["Web management panel"]
  node_workspace["Workspace services<br/>[space.py]"]
  node_monitor_ui["Monitoring panel"]
end

subgraph group_state["Persistence and monitoring"]
  node_database[("Application database<br/>[database.py]")]
  node_pipeline_records["Pipeline records<br/>[pipeline.py]"]
  node_monitoring["Monitoring"]
end

node_user(("Chat user"))
node_platform["IM platforms"]

node_user -->|"sends message"| node_platform
node_platform -->|"delivers event"| node_adapters
node_adapters -->|"dispatches query"| node_pipeline
node_pipeline -->|"runs stages"| node_stages
node_pipeline -->|"invokes runner"| node_agent
node_pipeline -.->|"uses AI services"| node_ai_services
node_pipeline -.->|"dispatches extensions"| node_plugins
node_pipeline -.->|"uses MCP"| node_mcp
node_pipeline -->|"sends response"| node_adapters
node_web -->|"calls management API"| node_api
node_api -->|"uses workspace services"| node_workspace
node_api -->|"manages pipelines"| node_pipeline_records
node_pipeline_records -->|"persists records"| node_database
node_pipeline -->|"records activity"| node_monitoring
node_monitor_ui -->|"loads monitoring"| node_api
node_monitoring -->|"stores metrics"| node_database

click node_adapters "https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/platform/adapters"
click node_pipeline "https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/pipeline/pipelinemgr.py"
click node_stages "https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/pipeline"
click node_agent "https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/agent/runner"
click node_ai_services "https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/api/http/controller/groups/knowledge"
click node_plugins "https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/discover/engine.py"
click node_mcp "https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/api/mcp"
click node_api "https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/api/http/controller"
click node_web "https://github.com/langbot-app/langbot/blob/master/web/src/app/home/pipelines/components/pipeline-form/PipelineFormComponent.tsx"
click node_workspace "https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/api/http/service/space.py"
click node_database "https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/persistence/database.py"
click node_pipeline_records "https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/entity/persistence/pipeline.py"
click node_monitoring "https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/pipeline/monitoring_helper.py"
click node_monitor_ui "https://github.com/langbot-app/langbot/blob/master/web/src/app/home/pipelines/components/monitoring-tab/PipelineMonitoringTab.tsx"

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_adapters,node_user toneBlue
class node_pipeline,node_stages,node_agent,node_ai_services toneAmber
class node_plugins,node_mcp,node_api,node_web,node_workspace,node_monitor_ui toneMint
class node_database,node_pipeline_records,node_monitoring toneRose
class node_platform toneIndigo
```

## Components

### Chat channels

- [Platform adapters](https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/platform/adapters): `src/langbot/pkg/platform/adapters`

### Conversation runtime

- [Pipeline runtime](https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/pipeline/pipelinemgr.py): `src/langbot/pkg/pipeline/pipelinemgr.py`
- [Pipeline stages](https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/pipeline): `src/langbot/pkg/pipeline`
- [Agent runner](https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/agent/runner): `src/langbot/pkg/agent/runner`
- [AI and RAG integrations](https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/api/http/controller/groups/knowledge): `src/langbot/pkg/api/http/controller/groups/knowledge`

### Management and extensions

- [Plugins and components](https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/discover/engine.py): `src/langbot/pkg/discover/engine.py`
- [MCP resources](https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/api/mcp): `src/langbot/pkg/api/mcp`
- [HTTP management API](https://github.com/langbot-app/langbot/tree/master/src/langbot/pkg/api/http/controller): `src/langbot/pkg/api/http/controller`
- [Web management panel](https://github.com/langbot-app/langbot/blob/master/web/src/app/home/pipelines/components/pipeline-form/PipelineFormComponent.tsx): `web/src/app/home/pipelines/components/pipeline-form/PipelineFormComponent.tsx`
- [Workspace services](https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/api/http/service/space.py): `src/langbot/pkg/api/http/service/space.py`
- [Monitoring panel](https://github.com/langbot-app/langbot/blob/master/web/src/app/home/pipelines/components/monitoring-tab/PipelineMonitoringTab.tsx): `web/src/app/home/pipelines/components/monitoring-tab/PipelineMonitoringTab.tsx`

### Persistence and monitoring

- [Application database](https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/persistence/database.py): `src/langbot/pkg/persistence/database.py`
- [Pipeline records](https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/entity/persistence/pipeline.py): `src/langbot/pkg/entity/persistence/pipeline.py`
- [Monitoring](https://github.com/langbot-app/langbot/blob/master/src/langbot/pkg/pipeline/monitoring_helper.py): `src/langbot/pkg/pipeline/monitoring_helper.py`

### Other components

- **Chat user**
- **IM platforms**

## Connections

- Chat user → IM platforms: sends message
- IM platforms → Platform adapters: delivers event
- Platform adapters → Pipeline runtime: dispatches query
- Pipeline runtime → Pipeline stages: runs stages
- Pipeline runtime → Agent runner: invokes runner
- Pipeline runtime → AI and RAG integrations: uses AI services
- Pipeline runtime → Plugins and components: dispatches extensions
- Pipeline runtime → MCP resources: uses MCP
- Pipeline runtime → Platform adapters: sends response
- Web management panel → HTTP management API: calls management API
- HTTP management API → Workspace services: uses workspace services
- HTTP management API → Pipeline records: manages pipelines
- Pipeline records → Application database: persists records
- Pipeline runtime → Monitoring: records activity
- Monitoring panel → HTTP management API: loads monitoring
- Monitoring → Application database: stores metrics
