# mudler/localagi architecture

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

- Interactive diagram: https://gitdiagram.com/mudler/localagi
- Repository: https://github.com/mudler/localagi

## Overview

LocalAGI is a self-hosted platform for configuring local AI agents, interacting with them through chat and APIs, and extending them with actions, connectors, skills, scheduled work, and knowledge collections. The main user journey is: configure an agent in the web UI, persist and start it in the agent pool, send it a request, and receive streamed results. The graph preserves README-documented features whose implementation was not sampled; those links are documented or marked unverified rather than implying source inspection.

Main entry points: [`core/agent/agent.go`](https://github.com/mudler/localagi/blob/main/core/agent/agent.go) (Agent execution), [`webui/react-ui/src/pages/AgentsList.jsx`](https://github.com/mudler/localagi/blob/main/webui/react-ui/src/pages/AgentsList.jsx) (Agent management), [`webui/react-ui/src/hooks/useChat.js`](https://github.com/mudler/localagi/blob/main/webui/react-ui/src/hooks/useChat.js) (Chat and stream), [`webui/react-ui/src/App.jsx`](https://github.com/mudler/localagi/blob/main/webui/react-ui/src/App.jsx) (UI shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_ui_shell["UI shell<br/>[App.jsx]"]
  node_ui_management["Agent management<br/>[AgentsList.jsx]"]
  node_ui_chat["Chat and stream<br/>[useChat.js]"]
  node_ui_knowledge["Knowledge UI<br/>[Knowledge.jsx]"]
  node_ui_skills["Skills UI<br/>[Skills.jsx]"]
  node_ui_observe["Agent status UI<br/>[AgentStatus.jsx]"]
end

subgraph group_runtime["Agent runtime"]
  node_agent_pool["Agent pool<br/>[pool.go]"]
  node_agent["Agent execution<br/>[agent.go]"]
  node_llm["LLM client<br/>[client.go]"]
end

subgraph group_extensions["Agent capabilities"]
  node_actions["Action registry<br/>[actions.go]"]
  node_connectors["Chat connectors<br/>[connectors.go]"]
  node_skills["Skills service<br/>[service.go]"]
  node_scheduler["Scheduled tasks<br/>[scheduler.go]"]
end

subgraph group_state["State and knowledge"]
  node_collections_api["Collections API"]
  node_rag["Knowledge adapter<br/>[rag_provider.go]"]
  node_rag_client["RAG HTTP client<br/>[client.go]"]
end

subgraph group_interfaces["External interfaces"]
  node_webui["Web server<br/>[app.go]"]
  node_routes["HTTP routes<br/>[routes.go]"]
  node_responses["Responses API<br/>[app.go]"]
  node_sse["Event stream<br/>[sse.go]"]
end

node_operator(("User"))
node_user_services(("Messaging platforms"))
node_external_models(("Model service"))

node_operator -->|"uses"| node_ui_shell
node_ui_shell -->|"routes to"| node_ui_management
node_ui_shell -.->|"hosts"| node_ui_chat
node_ui_management -.->|"configures agents"| node_webui
node_ui_chat -.->|"sends chat"| node_webui
node_ui_chat -->|"opens stream"| node_sse
node_webui -->|"registers routes"| node_routes
node_routes -->|"routes requests"| node_responses
node_responses -->|"accesses agents"| node_agent_pool
node_agent_pool -->|"starts agent"| node_agent
node_agent -->|"calls model"| node_llm
node_agent -->|"executes tools"| node_actions
node_agent -->|"schedules tasks"| node_scheduler
node_agent -->|"uses skills"| node_skills
node_agent -.->|"queries knowledge"| node_rag
node_rag -.->|"adapts collections"| node_collections_api
node_collections_api -.->|"uses remote backend"| node_rag_client
node_agent -->|"publishes updates"| node_sse
node_sse -->|"streams events"| node_ui_chat
node_ui_management -.->|"manages knowledge"| node_ui_knowledge
node_ui_management -.->|"manages skills"| node_ui_skills
node_ui_management -.->|"views status"| node_ui_observe
node_connectors -.->|"delivers messages"| node_agent
node_user_services -.->|"sends messages"| node_connectors
node_llm -.->|"requests inference"| node_external_models

click node_webui "https://github.com/mudler/localagi/blob/main/webui/app.go"
click node_routes "https://github.com/mudler/localagi/blob/main/webui/routes.go"
click node_ui_shell "https://github.com/mudler/localagi/blob/main/webui/react-ui/src/App.jsx"
click node_ui_management "https://github.com/mudler/localagi/blob/main/webui/react-ui/src/pages/AgentsList.jsx"
click node_ui_chat "https://github.com/mudler/localagi/blob/main/webui/react-ui/src/hooks/useChat.js"
click node_ui_knowledge "https://github.com/mudler/localagi/blob/main/webui/react-ui/src/pages/Knowledge.jsx"
click node_ui_skills "https://github.com/mudler/localagi/blob/main/webui/react-ui/src/pages/Skills.jsx"
click node_ui_observe "https://github.com/mudler/localagi/blob/main/webui/react-ui/src/pages/AgentStatus.jsx"
click node_agent_pool "https://github.com/mudler/localagi/blob/main/core/state/pool.go"
click node_agent "https://github.com/mudler/localagi/blob/main/core/agent/agent.go"
click node_responses "https://github.com/mudler/localagi/blob/main/webui/app.go"
click node_sse "https://github.com/mudler/localagi/blob/main/core/sse/sse.go"
click node_actions "https://github.com/mudler/localagi/blob/main/services/actions.go"
click node_connectors "https://github.com/mudler/localagi/blob/main/services/connectors.go"
click node_skills "https://github.com/mudler/localagi/blob/main/services/skills/service.go"
click node_scheduler "https://github.com/mudler/localagi/blob/main/core/scheduler/scheduler.go"
click node_collections_api "https://github.com/mudler/localagi/blob/main/webui/collections_handlers.go"
click node_rag "https://github.com/mudler/localagi/blob/main/webui/collections/rag_provider.go"
click node_rag_client "https://github.com/mudler/localagi/blob/main/pkg/localrag/client.go"
click node_llm "https://github.com/mudler/localagi/blob/main/pkg/llm/client.go"

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_ui_shell,node_ui_management,node_ui_chat,node_ui_knowledge,node_ui_skills,node_ui_observe,node_operator toneBlue
class node_agent_pool,node_agent,node_llm toneAmber
class node_actions,node_connectors,node_skills,node_scheduler toneMint
class node_collections_api,node_rag,node_rag_client toneRose
class node_webui,node_routes,node_responses,node_sse,node_user_services,node_external_models toneIndigo
```

## Components

### Web interface

- [UI shell](https://github.com/mudler/localagi/blob/main/webui/react-ui/src/App.jsx): `webui/react-ui/src/App.jsx`
- [Agent management](https://github.com/mudler/localagi/blob/main/webui/react-ui/src/pages/AgentsList.jsx): `webui/react-ui/src/pages/AgentsList.jsx`
- [Chat and stream](https://github.com/mudler/localagi/blob/main/webui/react-ui/src/hooks/useChat.js): `webui/react-ui/src/hooks/useChat.js`
- [Knowledge UI](https://github.com/mudler/localagi/blob/main/webui/react-ui/src/pages/Knowledge.jsx): `webui/react-ui/src/pages/Knowledge.jsx`
- [Skills UI](https://github.com/mudler/localagi/blob/main/webui/react-ui/src/pages/Skills.jsx): `webui/react-ui/src/pages/Skills.jsx`
- [Agent status UI](https://github.com/mudler/localagi/blob/main/webui/react-ui/src/pages/AgentStatus.jsx): `webui/react-ui/src/pages/AgentStatus.jsx`

### Agent runtime

- [Agent pool](https://github.com/mudler/localagi/blob/main/core/state/pool.go): `core/state/pool.go`
- [Agent execution](https://github.com/mudler/localagi/blob/main/core/agent/agent.go): `core/agent/agent.go`
- [LLM client](https://github.com/mudler/localagi/blob/main/pkg/llm/client.go): `pkg/llm/client.go`

### Agent capabilities

- [Action registry](https://github.com/mudler/localagi/blob/main/services/actions.go): `services/actions.go`
- [Chat connectors](https://github.com/mudler/localagi/blob/main/services/connectors.go): `services/connectors.go`
- [Skills service](https://github.com/mudler/localagi/blob/main/services/skills/service.go): `services/skills/service.go`
- [Scheduled tasks](https://github.com/mudler/localagi/blob/main/core/scheduler/scheduler.go): `core/scheduler/scheduler.go`

### State and knowledge

- [Collections API](https://github.com/mudler/localagi/blob/main/webui/collections_handlers.go): `webui/collections_handlers.go`
- [Knowledge adapter](https://github.com/mudler/localagi/blob/main/webui/collections/rag_provider.go): `webui/collections/rag_provider.go`
- [RAG HTTP client](https://github.com/mudler/localagi/blob/main/pkg/localrag/client.go): `pkg/localrag/client.go`

### External interfaces

- [Web server](https://github.com/mudler/localagi/blob/main/webui/app.go): `webui/app.go`
- [HTTP routes](https://github.com/mudler/localagi/blob/main/webui/routes.go): `webui/routes.go`
- [Responses API](https://github.com/mudler/localagi/blob/main/webui/app.go): `webui/app.go`
- [Event stream](https://github.com/mudler/localagi/blob/main/core/sse/sse.go): `core/sse/sse.go`

### Other components

- **User**
- **Messaging platforms**
- **Model service**

## Connections

- User → UI shell: uses
- UI shell → Agent management: routes to (evidence: `webui/react-ui/src/router.jsx`)
- UI shell → Chat and stream: hosts
- Agent management → Web server: configures agents
- Chat and stream → Web server: sends chat
- Chat and stream → Event stream: opens stream
- Web server → HTTP routes: registers routes (evidence: `webui/routes.go`)
- HTTP routes → Responses API: routes requests (evidence: `webui/routes.go`)
- Responses API → Agent pool: accesses agents (evidence: `webui/app.go`)
- Agent pool → Agent execution: starts agent (evidence: `core/state/pool.go`)
- Agent execution → LLM client: calls model (evidence: `core/agent/agent.go`)
- Agent execution → Action registry: executes tools (evidence: `core/agent/agent.go`)
- Agent execution → Scheduled tasks: schedules tasks (evidence: `core/agent/agent.go`)
- Agent execution → Skills service: uses skills (evidence: `services/skills/service.go`)
- Agent execution → Knowledge adapter: queries knowledge
- Knowledge adapter → Collections API: adapts collections
- Collections API → RAG HTTP client: uses remote backend
- Agent execution → Event stream: publishes updates
- Event stream → Chat and stream: streams events
- Agent management → Knowledge UI: manages knowledge
- Agent management → Skills UI: manages skills
- Agent management → Agent status UI: views status
- Chat connectors → Agent execution: delivers messages
- Messaging platforms → Chat connectors: sends messages
- LLM client → Model service: requests inference
