# litellm-labs/litellm-agent-control-plane architecture

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

- Interactive diagram: https://gitdiagram.com/litellm-labs/litellm-agent-control-plane
- Repository: https://github.com/litellm-labs/litellm-agent-control-plane

## Overview

LiteLLM Agent Control Plane provides one UI and API for creating and running agents on multiple runtimes. The main workflow is to configure an agent and its tools or skills, choose a runtime, then run it through a persistent session and inspect the result. The repository also exposes management for schedules, memory, rules, approvals, files, channels, and MCP servers. The excerpts show top-level routing and session persistence; several domain links are documented or indicated by routes, but their handler internals were not sampled.

Main entry points: [`src/http/managed_agents/routes.rs`](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/routes.rs) (Agent routes), [`src/http/routes.rs`](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/routes.rs) (HTTP routing), [`src/http/sessions.rs`](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/sessions.rs) (Session handling), [`src/db/managed_agents/mod.rs`](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/db/managed_agents/mod.rs) (Managed-agent database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_dashboard["Control UI<br/>[page.tsx]"]
end

subgraph group_gateway["Gateway API"]
  node_entry["Service startup<br/>[main.rs]"]
  node_routes["HTTP routing<br/>[routes.rs]"]
  node_mcp["MCP services<br/>[tools.rs]"]
end

subgraph group_management["Agent management"]
  node_managed_routes["Agent routes<br/>[routes.rs]"]
  node_agent_registry["Agent registry<br/>[create.rs]"]
  node_routines["Schedules<br/>[trigger.rs]"]
  node_rules["Rules<br/>[create.rs]"]
  node_skills["Skills<br/>[create.rs]"]
  node_memory["Agent memory<br/>[store.rs]"]
  node_files["Agent files<br/>[upsert.rs]"]
  node_inbox["Inbox approvals<br/>[approvals.rs]"]
  node_channels["Chat channels<br/>[events.rs]"]
end

subgraph group_execution["Runtime execution"]
  node_sessions["Session handling<br/>[sessions.rs]"]
  node_session_storage["Session persistence<br/>[storage.rs]"]
  node_sdk_client["Agent SDK<br/>[client.rs]"]
  node_provider_routing["Provider routing<br/>[routing.rs]"]
  node_provider_runtime["Runtime adapters<br/>[runtime.rs]"]
  node_opencode["OpenCode template<br/>[app.mjs]"]
end

subgraph group_state["State and integrations"]
  node_db[("Managed-agent database<br/>[mod.rs]")]
  node_file_repository[("File repository<br/>[repository.rs]")]
  node_message_repository[("Message repository<br/>[mod.rs]")]
  node_mcp_upstream["MCP upstreams<br/>[upstream.rs]"]
end

node_user(("Developer"))
node_runtime_service["Agent runtime"]

node_user -->|"configures agents"| node_dashboard
node_dashboard -.->|"sends API requests"| node_routes
node_entry -->|"serves routes"| node_routes
node_routes -->|"mounts routes"| node_managed_routes
node_managed_routes -->|"routes registry calls"| node_agent_registry
node_managed_routes -->|"routes schedule calls"| node_routines
node_managed_routes -->|"routes rule calls"| node_rules
node_managed_routes -->|"routes skill calls"| node_skills
node_managed_routes -->|"routes memory calls"| node_memory
node_managed_routes -->|"routes file calls"| node_files
node_managed_routes -->|"routes inbox calls"| node_inbox
node_managed_routes -->|"routes channel events"| node_channels
node_routes -->|"routes session calls"| node_sessions
node_sessions -.->|"persists session data"| node_session_storage
node_session_storage -->|"appends messages"| node_message_repository
node_session_storage -->|"reads session records"| node_db
node_agent_registry -.->|"stores agent records"| node_db
node_routines -.->|"stores schedules"| node_db
node_files -.->|"persists files"| node_file_repository
node_file_repository -->|"writes file rows"| node_db
node_user -.->|"runs an agent"| node_sessions
node_sessions -.->|"invokes runtime"| node_sdk_client
node_sdk_client -->|"selects provider"| node_provider_routing
node_provider_routing -->|"dispatches requests"| node_provider_runtime
node_provider_runtime -.->|"calls runtime"| node_runtime_service
node_runtime_service -.->|"returns run events"| node_sessions
node_opencode -.->|"serves runtime API"| node_runtime_service
node_routes -->|"mounts MCP routes"| node_mcp
node_mcp -.->|"proxies tool calls"| node_mcp_upstream
node_user -.->|"discovers tools"| node_mcp

click node_dashboard "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/ui/src/app/agents/new/page.tsx"
click node_entry "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/main.rs"
click node_routes "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/routes.rs"
click node_managed_routes "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/routes.rs"
click node_agent_registry "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/registry/create.rs"
click node_routines "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/routines/trigger.rs"
click node_rules "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/rules/create.rs"
click node_skills "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/skills/create.rs"
click node_memory "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/memory/store.rs"
click node_files "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/files/upsert.rs"
click node_inbox "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/inbox/approvals.rs"
click node_channels "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/slack/events.rs"
click node_sessions "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/sessions.rs"
click node_session_storage "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/sessions/storage.rs"
click node_sdk_client "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/sdk/agents/client.rs"
click node_provider_routing "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/sdk/routing.rs"
click node_provider_runtime "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/sdk/providers/base/runtime.rs"
click node_opencode "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/templates/opencode/src/app.mjs"
click node_mcp "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/mcp_registry/tools.rs"
click node_db "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/db/managed_agents/mod.rs"
click node_file_repository "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/db/managed_agents/files/repository.rs"
click node_message_repository "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/db/managed_agents/messages/mod.rs"
click node_mcp_upstream "https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/mcp/upstream.rs"

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_dashboard toneBlue
class node_entry,node_routes,node_mcp toneAmber
class node_managed_routes,node_agent_registry,node_routines,node_rules,node_skills,node_memory,node_files,node_inbox,node_channels toneMint
class node_sessions,node_session_storage,node_sdk_client,node_provider_routing,node_provider_runtime,node_opencode toneRose
class node_db,node_file_repository,node_message_repository,node_mcp_upstream,node_user,node_runtime_service toneIndigo
```

## Components

### User interface

- [Control UI](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/ui/src/app/agents/new/page.tsx): `src/ui/src/app/agents/new/page.tsx`

### Gateway API

- [Service startup](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/main.rs): `src/main.rs`
- [HTTP routing](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/routes.rs): `src/http/routes.rs`
- [MCP services](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/mcp_registry/tools.rs): `src/http/mcp_registry/tools.rs`

### Agent management

- [Agent routes](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/routes.rs): `src/http/managed_agents/routes.rs`
- [Agent registry](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/registry/create.rs): `src/http/managed_agents/registry/create.rs`
- [Schedules](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/routines/trigger.rs): `src/http/managed_agents/routines/trigger.rs`
- [Rules](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/rules/create.rs): `src/http/managed_agents/rules/create.rs`
- [Skills](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/skills/create.rs): `src/http/managed_agents/skills/create.rs`
- [Agent memory](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/memory/store.rs): `src/http/managed_agents/memory/store.rs`
- [Agent files](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/files/upsert.rs): `src/http/managed_agents/files/upsert.rs`
- [Inbox approvals](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/inbox/approvals.rs): `src/http/managed_agents/inbox/approvals.rs`
- [Chat channels](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/managed_agents/slack/events.rs): `src/http/managed_agents/slack/events.rs`

### Runtime execution

- [Session handling](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/sessions.rs): `src/http/sessions.rs`
- [Session persistence](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/http/sessions/storage.rs): `src/http/sessions/storage.rs`
- [Agent SDK](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/sdk/agents/client.rs): `src/sdk/agents/client.rs`
- [Provider routing](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/sdk/routing.rs): `src/sdk/routing.rs`
- [Runtime adapters](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/sdk/providers/base/runtime.rs): `src/sdk/providers/base/runtime.rs`
- [OpenCode template](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/templates/opencode/src/app.mjs): `templates/opencode/src/app.mjs`

### State and integrations

- [Managed-agent database](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/db/managed_agents/mod.rs): `src/db/managed_agents/mod.rs`
- [File repository](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/db/managed_agents/files/repository.rs): `src/db/managed_agents/files/repository.rs`
- [Message repository](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/db/managed_agents/messages/mod.rs): `src/db/managed_agents/messages/mod.rs`
- [MCP upstreams](https://github.com/litellm-labs/litellm-agent-control-plane/blob/main/src/mcp/upstream.rs): `src/mcp/upstream.rs`

### Other components

- **Developer**
- **Agent runtime**

## Connections

- Developer → Control UI: configures agents
- Control UI → HTTP routing: sends API requests
- Service startup → HTTP routing: serves routes (evidence: `src/main.rs`)
- HTTP routing → Agent routes: mounts routes (evidence: `src/http/routes.rs`)
- Agent routes → Agent registry: routes registry calls (evidence: `src/http/managed_agents/routes.rs`)
- Agent routes → Schedules: routes schedule calls (evidence: `src/http/managed_agents/routes.rs`)
- Agent routes → Rules: routes rule calls (evidence: `src/http/managed_agents/routes.rs`)
- Agent routes → Skills: routes skill calls (evidence: `src/http/managed_agents/routes.rs`)
- Agent routes → Agent memory: routes memory calls (evidence: `src/http/managed_agents/routes.rs`)
- Agent routes → Agent files: routes file calls (evidence: `src/http/managed_agents/routes.rs`)
- Agent routes → Inbox approvals: routes inbox calls (evidence: `src/http/managed_agents/routes.rs`)
- Agent routes → Chat channels: routes channel events (evidence: `src/http/managed_agents/routes.rs`)
- HTTP routing → Session handling: routes session calls (evidence: `src/http/routes.rs`)
- Session handling → Session persistence: persists session data
- Session persistence → Message repository: appends messages (evidence: `src/http/sessions/storage.rs`)
- Session persistence → Managed-agent database: reads session records (evidence: `src/http/sessions/storage.rs`)
- Agent registry → Managed-agent database: stores agent records
- Schedules → Managed-agent database: stores schedules
- Agent files → File repository: persists files
- File repository → Managed-agent database: writes file rows (evidence: `src/db/managed_agents/files/repository.rs`)
- Developer → Session handling: runs an agent
- Session handling → Agent SDK: invokes runtime
- Agent SDK → Provider routing: selects provider (evidence: `src/sdk/agents/client.rs`)
- Provider routing → Runtime adapters: dispatches requests (evidence: `src/sdk/routing.rs`)
- Runtime adapters → Agent runtime: calls runtime
- Agent runtime → Session handling: returns run events
- OpenCode template → Agent runtime: serves runtime API
- HTTP routing → MCP services: mounts MCP routes (evidence: `src/http/routes.rs`)
- MCP services → MCP upstreams: proxies tool calls
- Developer → MCP services: discovers tools
