# runtm-ai/runtm architecture

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

- Interactive diagram: https://gitdiagram.com/runtm-ai/runtm
- Repository: https://github.com/runtm-ai/runtm

## Overview

Runtm provides local, isolated workspaces for coding agents and a hosted deployment control plane. The main workflow is to start a sandbox, let an agent build in it, and deploy the result to a live URL; users can then inspect logs and iterate. The graph also includes the documented hosted API/worker deployment path, agent adapters, and shared telemetry. Some deployment internals are unsampled, so those links are marked unverified rather than presented as confirmed calls.

Main entry points: [`packages/api/runtm_api/main.py`](https://github.com/runtm-ai/runtm/blob/main/packages/api/runtm_api/main.py) (API Application), [`packages/cli/runtm_cli/commands/session.py`](https://github.com/runtm-ai/runtm/blob/main/packages/cli/runtm_cli/commands/session.py) (Session Commands), [`packages/cli/runtm_cli/commands/deploy.py`](https://github.com/runtm-ai/runtm/blob/main/packages/cli/runtm_cli/commands/deploy.py) (Deploy Commands), [`packages/worker/runtm_worker/main.py`](https://github.com/runtm-ai/runtm/blob/main/packages/worker/runtm_worker/main.py) (Deployment Worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["User CLIs"]
  node_python_cli["Python CLI<br/>[main.py]"]
  node_session_commands["Session Commands<br/>[session.py]"]
  node_deploy_commands["Deploy Commands<br/>[deploy.py]"]
  node_go_cli["Agent API CLI<br/>[session.go]"]
end

subgraph group_sandbox["Local Agent Sessions"]
  node_sandbox_provider["Local Sandbox<br/>[local.py]"]
  node_sandbox_state[("Session State<br/>[state.py]")]
  node_agent_runner["Agent Runner<br/>[runner.py]"]
  node_agent_adapters["Agent Adapters<br/>[base.py]"]
end

subgraph group_control["Hosted Control Plane"]
  node_api_app["API Application<br/>[main.py]"]
  node_deployment_routes["Deployment Routes<br/>[deployments.py]"]
  node_api_repository["API Repository<br/>[repository.py]"]
  node_api_database[("API Database<br/>[models.py]")]
end

subgraph group_deploy["Deployment Runtime"]
  node_worker["Deployment Worker<br/>[main.py]"]
  node_deployment_job["Deployment Job<br/>[deploy.py]"]
  node_image_builder["Docker Builder<br/>[docker.py]"]
  node_fly_provider["Fly Provider<br/>[fly.py]"]
end

subgraph group_shared["Shared Capabilities"]
  node_shared_types["Domain Types<br/>[types.py]"]
  node_telemetry["Telemetry Service<br/>[service.py]"]
end

node_user(("Developer"))
node_live_service(("Live Service"))

node_user -->|"runs commands"| node_python_cli
node_python_cli -->|"dispatches sessions"| node_session_commands
node_session_commands -->|"creates sandbox"| node_sandbox_provider
node_session_commands -.->|"records session"| node_sandbox_state
node_session_commands -.->|"runs agent"| node_agent_runner
node_agent_runner -.->|"uses adapter"| node_agent_adapters
node_user -->|"drives hosted API"| node_go_cli
node_user -->|"requests deploy"| node_deploy_commands
node_deploy_commands -.->|"calls hosted API"| node_api_app
node_api_app -->|"includes routes"| node_deployment_routes
node_deployment_routes -.->|"persists deployment"| node_api_repository
node_api_repository -->|"uses models"| node_api_database
node_api_app -.->|"queues deployment"| node_worker
node_worker -->|"processes job"| node_deployment_job
node_deployment_job -.->|"builds image"| node_image_builder
node_deployment_job -.->|"deploys workload"| node_fly_provider
node_fly_provider -->|"provisions endpoint"| node_live_service
node_deploy_commands -->|"deploys to URL"| node_live_service
node_api_app -->|"loads configuration types"| node_shared_types
node_worker -->|"uses limits"| node_shared_types
node_api_app -.->|"exports telemetry"| node_telemetry

click node_python_cli "https://github.com/runtm-ai/runtm/blob/main/packages/cli/runtm_cli/main.py"
click node_session_commands "https://github.com/runtm-ai/runtm/blob/main/packages/cli/runtm_cli/commands/session.py"
click node_deploy_commands "https://github.com/runtm-ai/runtm/blob/main/packages/cli/runtm_cli/commands/deploy.py"
click node_go_cli "https://github.com/runtm-ai/runtm/blob/main/packages/agent/internal/cmd/session.go"
click node_sandbox_provider "https://github.com/runtm-ai/runtm/blob/main/packages/sandbox/runtm_sandbox/providers/local.py"
click node_sandbox_state "https://github.com/runtm-ai/runtm/blob/main/packages/sandbox/runtm_sandbox/state.py"
click node_agent_runner "https://github.com/runtm-ai/runtm/blob/main/packages/agents/runtm_agents/runner.py"
click node_agent_adapters "https://github.com/runtm-ai/runtm/blob/main/packages/agents/runtm_agents/adapters/base.py"
click node_api_app "https://github.com/runtm-ai/runtm/blob/main/packages/api/runtm_api/main.py"
click node_deployment_routes "https://github.com/runtm-ai/runtm/blob/main/packages/api/runtm_api/routes/deployments.py"
click node_api_repository "https://github.com/runtm-ai/runtm/blob/main/packages/api/runtm_api/db/repository.py"
click node_api_database "https://github.com/runtm-ai/runtm/blob/main/packages/api/runtm_api/db/models.py"
click node_worker "https://github.com/runtm-ai/runtm/blob/main/packages/worker/runtm_worker/main.py"
click node_deployment_job "https://github.com/runtm-ai/runtm/blob/main/packages/worker/runtm_worker/jobs/deploy.py"
click node_image_builder "https://github.com/runtm-ai/runtm/blob/main/packages/worker/runtm_worker/builder/docker.py"
click node_fly_provider "https://github.com/runtm-ai/runtm/blob/main/packages/worker/runtm_worker/providers/fly.py"
click node_shared_types "https://github.com/runtm-ai/runtm/blob/main/packages/shared/runtm_shared/types.py"
click node_telemetry "https://github.com/runtm-ai/runtm/blob/main/packages/shared/runtm_shared/telemetry/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_python_cli,node_session_commands,node_deploy_commands,node_go_cli toneBlue
class node_sandbox_provider,node_sandbox_state,node_agent_runner,node_agent_adapters toneAmber
class node_api_app,node_deployment_routes,node_api_repository,node_api_database toneMint
class node_worker,node_deployment_job,node_image_builder,node_fly_provider toneRose
class node_shared_types,node_telemetry,node_user,node_live_service toneIndigo
```

## Components

### User CLIs

- [Python CLI](https://github.com/runtm-ai/runtm/blob/main/packages/cli/runtm_cli/main.py): `packages/cli/runtm_cli/main.py`
- [Session Commands](https://github.com/runtm-ai/runtm/blob/main/packages/cli/runtm_cli/commands/session.py): `packages/cli/runtm_cli/commands/session.py`
- [Deploy Commands](https://github.com/runtm-ai/runtm/blob/main/packages/cli/runtm_cli/commands/deploy.py): `packages/cli/runtm_cli/commands/deploy.py`
- [Agent API CLI](https://github.com/runtm-ai/runtm/blob/main/packages/agent/internal/cmd/session.go): `packages/agent/internal/cmd/session.go`

### Local Agent Sessions

- [Local Sandbox](https://github.com/runtm-ai/runtm/blob/main/packages/sandbox/runtm_sandbox/providers/local.py): `packages/sandbox/runtm_sandbox/providers/local.py`
- [Session State](https://github.com/runtm-ai/runtm/blob/main/packages/sandbox/runtm_sandbox/state.py): `packages/sandbox/runtm_sandbox/state.py`
- [Agent Runner](https://github.com/runtm-ai/runtm/blob/main/packages/agents/runtm_agents/runner.py): `packages/agents/runtm_agents/runner.py`
- [Agent Adapters](https://github.com/runtm-ai/runtm/blob/main/packages/agents/runtm_agents/adapters/base.py): `packages/agents/runtm_agents/adapters/base.py`

### Hosted Control Plane

- [API Application](https://github.com/runtm-ai/runtm/blob/main/packages/api/runtm_api/main.py): `packages/api/runtm_api/main.py`
- [Deployment Routes](https://github.com/runtm-ai/runtm/blob/main/packages/api/runtm_api/routes/deployments.py): `packages/api/runtm_api/routes/deployments.py`
- [API Repository](https://github.com/runtm-ai/runtm/blob/main/packages/api/runtm_api/db/repository.py): `packages/api/runtm_api/db/repository.py`
- [API Database](https://github.com/runtm-ai/runtm/blob/main/packages/api/runtm_api/db/models.py): `packages/api/runtm_api/db/models.py`

### Deployment Runtime

- [Deployment Worker](https://github.com/runtm-ai/runtm/blob/main/packages/worker/runtm_worker/main.py): `packages/worker/runtm_worker/main.py`
- [Deployment Job](https://github.com/runtm-ai/runtm/blob/main/packages/worker/runtm_worker/jobs/deploy.py): `packages/worker/runtm_worker/jobs/deploy.py`
- [Docker Builder](https://github.com/runtm-ai/runtm/blob/main/packages/worker/runtm_worker/builder/docker.py): `packages/worker/runtm_worker/builder/docker.py`
- [Fly Provider](https://github.com/runtm-ai/runtm/blob/main/packages/worker/runtm_worker/providers/fly.py): `packages/worker/runtm_worker/providers/fly.py`

### Shared Capabilities

- [Domain Types](https://github.com/runtm-ai/runtm/blob/main/packages/shared/runtm_shared/types.py): `packages/shared/runtm_shared/types.py`
- [Telemetry Service](https://github.com/runtm-ai/runtm/blob/main/packages/shared/runtm_shared/telemetry/service.py): `packages/shared/runtm_shared/telemetry/service.py`

### Other components

- **Developer**
- **Live Service**

## Connections

- Developer → Python CLI: runs commands (evidence: `README.md`)
- Python CLI → Session Commands: dispatches sessions (evidence: `packages/cli/runtm_cli/main.py`)
- Session Commands → Local Sandbox: creates sandbox (evidence: `packages/cli/runtm_cli/commands/session.py`)
- Session Commands → Session State: records session (evidence: `packages/cli/runtm_cli/commands/session.py`)
- Session Commands → Agent Runner: runs agent
- Agent Runner → Agent Adapters: uses adapter
- Developer → Agent API CLI: drives hosted API (evidence: `README.md`)
- Developer → Deploy Commands: requests deploy (evidence: `README.md`)
- Deploy Commands → API Application: calls hosted API
- API Application → Deployment Routes: includes routes (evidence: `packages/api/runtm_api/main.py`)
- Deployment Routes → API Repository: persists deployment
- API Repository → API Database: uses models (evidence: `packages/api/runtm_api/db/repository.py`)
- API Application → Deployment Worker: queues deployment
- Deployment Worker → Deployment Job: processes job (evidence: `packages/worker/runtm_worker/main.py`)
- Deployment Job → Docker Builder: builds image
- Deployment Job → Fly Provider: deploys workload
- Fly Provider → Live Service: provisions endpoint (evidence: `README.md`)
- Deploy Commands → Live Service: deploys to URL (evidence: `README.md`)
- API Application → Domain Types: loads configuration types
- Deployment Worker → Domain Types: uses limits (evidence: `packages/worker/runtm_worker/main.py`)
- API Application → Telemetry Service: exports telemetry
