# meta-pytorch/openenv architecture

> Architecture diagram of the GitHub repository meta-pytorch/openenv, 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/meta-pytorch/openenv
- Repository: https://github.com/meta-pytorch/openenv

## Overview

OpenEnv is a framework for creating and interacting with isolated agentic execution environments through Gymnasium-style reset, step, and state operations. The main runtime flow is an agent client sending actions to a server, which delegates them to environment logic and returns observations; the shared server layer manages sessions and protocol handling. The repository also includes environment discovery/creation and a CLI for environment lifecycle tasks. The README documents provider and web-interface capabilities; source excerpts are incomplete, so uncertain implementation links are omitted.

Main entry points: [`src/openenv/core/env_server/http_server.py`](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/http_server.py) (HTTP and WS server), [`envs`](https://github.com/meta-pytorch/openenv/tree/main/envs) (Environment implementations), [`src/openenv/core`](https://github.com/meta-pytorch/openenv/tree/main/src/openenv/core) (Environment client), [`src/openenv/core/env_server/interfaces.py`](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/interfaces.py) (Environment logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Environment runtime"]
  node_client["Environment client"]
  node_server["HTTP and WS server<br/>[http_server.py]"]
  node_envlogic["Environment logic<br/>[interfaces.py]"]
  node_providers["Container providers"]
end

subgraph group_protocol["Protocols and interfaces"]
  node_models["Action and state types<br/>[types.py]"]
  node_serialization["Message serialization<br/>[serialization.py]"]
  node_mcp["MCP environment<br/>[mcp_environment.py]"]
  node_mcptypes["MCP messages<br/>[mcp_types.py]"]
  node_webui["Interactive web UI<br/>[web_interface.py]"]
end

subgraph group_authoring["Environment authoring"]
  node_envcatalog["Environment implementations"]
  node_kernel["Kernel benchmark"]
  node_pi["Pi environment<br/>[pi_environment.py]"]
  node_piui["Pi interactive UI<br/>[gradio_ui.py]"]
  node_thinkingbox["ThinkingBox environment"]
  node_calendar[("Calendar domain<br/>[event.py]")]
  node_carla_log["CARLA logging<br/>[logging.py]"]
end

subgraph group_tools["Discovery and CLI"]
  node_autodiscovery["Automatic discovery<br/>[_discovery.py]"]
  node_autoenv["Automatic environment client<br/>[auto_env.py]"]
  node_cli["OpenEnv CLI"]
  node_cli_entry["CLI entry point<br/>[__main__.py]"]
end

node_agent(("Agent application"))

node_agent -->|"uses"| node_client
node_client -->|"sends reset and steps"| node_server
node_server -->|"dispatches operations"| node_envlogic
node_envlogic -->|"uses types"| node_models
node_server -->|"serializes messages"| node_serialization
node_server -->|"supports MCP"| node_mcp
node_mcp -->|"uses messages"| node_mcptypes
node_server -->|"can expose UI"| node_webui
node_client -->|"starts local containers"| node_providers
node_server -->|"hosts environments"| node_envcatalog
node_envcatalog -->|"includes"| node_kernel
node_envcatalog -->|"includes"| node_pi
node_pi -->|"serves UI"| node_piui
node_envcatalog -->|"includes"| node_thinkingbox
node_envcatalog -->|"includes"| node_calendar
node_envcatalog -->|"includes"| node_carla_log
node_agent -.->|"discovers environments"| node_autodiscovery
node_autodiscovery -.->|"selects environment"| node_autoenv
node_cli_entry -.->|"dispatches commands"| node_cli
node_agent -->|"creates and deploys"| node_cli

click node_client "https://github.com/meta-pytorch/openenv/tree/main/src/openenv/core"
click node_server "https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/http_server.py"
click node_envlogic "https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/interfaces.py"
click node_models "https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/types.py"
click node_serialization "https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/serialization.py"
click node_mcp "https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/mcp_environment.py"
click node_mcptypes "https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/mcp_types.py"
click node_webui "https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/web_interface.py"
click node_envcatalog "https://github.com/meta-pytorch/openenv/tree/main/envs"
click node_kernel "https://github.com/meta-pytorch/openenv/blob/main/envs/kernrl/server/kernrl_environment.py"
click node_pi "https://github.com/meta-pytorch/openenv/blob/main/envs/pi_env/server/pi_environment.py"
click node_piui "https://github.com/meta-pytorch/openenv/blob/main/envs/pi_env/server/gradio_ui.py"
click node_thinkingbox "https://github.com/meta-pytorch/openenv/blob/main/envs/thinkingbox_env/server/thinkingbox_environment.py"
click node_calendar "https://github.com/meta-pytorch/openenv/blob/main/envs/calendar_env/server/database/models/event.py"
click node_carla_log "https://github.com/meta-pytorch/openenv/blob/main/envs/carla_env/server/logging.py"
click node_autodiscovery "https://github.com/meta-pytorch/openenv/blob/main/src/openenv/auto/_discovery.py"
click node_autoenv "https://github.com/meta-pytorch/openenv/blob/main/src/openenv/auto/auto_env.py"
click node_cli "https://github.com/meta-pytorch/openenv/tree/main/src/openenv/cli/commands"
click node_cli_entry "https://github.com/meta-pytorch/openenv/blob/main/src/openenv/cli/__main__.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_client,node_server,node_envlogic,node_providers toneBlue
class node_models,node_serialization,node_mcp,node_mcptypes,node_webui toneAmber
class node_envcatalog,node_kernel,node_pi,node_piui,node_thinkingbox,node_calendar,node_carla_log toneMint
class node_autodiscovery,node_autoenv,node_cli,node_cli_entry toneRose
class node_agent toneIndigo
```

## Components

### Environment runtime

- [Environment client](https://github.com/meta-pytorch/openenv/tree/main/src/openenv/core): `src/openenv/core`
- [HTTP and WS server](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/http_server.py): `src/openenv/core/env_server/http_server.py`
- [Environment logic](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/interfaces.py): `src/openenv/core/env_server/interfaces.py`
- **Container providers**

### Protocols and interfaces

- [Action and state types](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/types.py): `src/openenv/core/env_server/types.py`
- [Message serialization](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/serialization.py): `src/openenv/core/env_server/serialization.py`
- [MCP environment](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/mcp_environment.py): `src/openenv/core/env_server/mcp_environment.py`
- [MCP messages](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/mcp_types.py): `src/openenv/core/env_server/mcp_types.py`
- [Interactive web UI](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/core/env_server/web_interface.py): `src/openenv/core/env_server/web_interface.py`

### Environment authoring

- [Environment implementations](https://github.com/meta-pytorch/openenv/tree/main/envs): `envs`
- [Kernel benchmark](https://github.com/meta-pytorch/openenv/blob/main/envs/kernrl/server/kernrl_environment.py): `envs/kernrl/server/kernrl_environment.py`
- [Pi environment](https://github.com/meta-pytorch/openenv/blob/main/envs/pi_env/server/pi_environment.py): `envs/pi_env/server/pi_environment.py`
- [Pi interactive UI](https://github.com/meta-pytorch/openenv/blob/main/envs/pi_env/server/gradio_ui.py): `envs/pi_env/server/gradio_ui.py`
- [ThinkingBox environment](https://github.com/meta-pytorch/openenv/blob/main/envs/thinkingbox_env/server/thinkingbox_environment.py): `envs/thinkingbox_env/server/thinkingbox_environment.py`
- [Calendar domain](https://github.com/meta-pytorch/openenv/blob/main/envs/calendar_env/server/database/models/event.py): `envs/calendar_env/server/database/models/event.py`
- [CARLA logging](https://github.com/meta-pytorch/openenv/blob/main/envs/carla_env/server/logging.py): `envs/carla_env/server/logging.py`

### Discovery and CLI

- [Automatic discovery](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/auto/_discovery.py): `src/openenv/auto/_discovery.py`
- [Automatic environment client](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/auto/auto_env.py): `src/openenv/auto/auto_env.py`
- [OpenEnv CLI](https://github.com/meta-pytorch/openenv/tree/main/src/openenv/cli/commands): `src/openenv/cli/commands`
- [CLI entry point](https://github.com/meta-pytorch/openenv/blob/main/src/openenv/cli/__main__.py): `src/openenv/cli/__main__.py`

### Other components

- **Agent application**

## Connections

- Agent application → Environment client: uses
- Environment client → HTTP and WS server: sends reset and steps (evidence: `src/openenv/core/env_server/__init__.py`)
- HTTP and WS server → Environment logic: dispatches operations (evidence: `src/openenv/core/env_server/http_server.py`)
- Environment logic → Action and state types: uses types (evidence: `src/openenv/core/env_server/__init__.py`)
- HTTP and WS server → Message serialization: serializes messages (evidence: `src/openenv/core/env_server/http_server.py`)
- HTTP and WS server → MCP environment: supports MCP (evidence: `src/openenv/core/env_server/http_server.py`)
- MCP environment → MCP messages: uses messages (evidence: `src/openenv/core/env_server/__init__.py`)
- HTTP and WS server → Interactive web UI: can expose UI (evidence: `src/openenv/core/env_server/http_server.py`)
- Environment client → Container providers: starts local containers
- HTTP and WS server → Environment implementations: hosts environments (evidence: `src/openenv/core/env_server/http_server.py`)
- Environment implementations → Kernel benchmark: includes (evidence: `envs/kernrl/models.py`)
- Environment implementations → Pi environment: includes (evidence: `envs/pi_env/server/app.py`)
- Pi environment → Pi interactive UI: serves UI (evidence: `envs/pi_env/server/app.py`)
- Environment implementations → ThinkingBox environment: includes (evidence: `envs/thinkingbox_env/server/app.py`)
- Environment implementations → Calendar domain: includes (evidence: `envs/calendar_env/server/database/managers/event_manager.py`)
- Environment implementations → CARLA logging: includes (evidence: `envs/carla_env/server/logging.py`)
- Agent application → Automatic discovery: discovers environments
- Automatic discovery → Automatic environment client: selects environment
- CLI entry point → OpenEnv CLI: dispatches commands
- Agent application → OpenEnv CLI: creates and deploys
