# rai-opensource/exploy architecture

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

- Interactive diagram: https://gitdiagram.com/rai-opensource/exploy
- Repository: https://github.com/rai-opensource/exploy

## Overview

Exploy exports reinforcement-learning environments and policies into ONNX graphs that include observation and action processing, then provides a C++ controller for deployment. The principal workflow is environment adaptation and graph export, followed by controller initialization, robot-state input collection, inference, and command output. The graph preserves both framework adapters and deployment interfaces. Several exporter and framework links are documented by the README or SOURCE INDEX; unsampled code is represented only where those references or the README support it.

Main entry points: [`control/src/controller.cpp`](https://github.com/rai-opensource/exploy/blob/main/control/src/controller.cpp) (ONNX Controller), [`python/exploy/exporter/core/context_manager.py`](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/context_manager.py) (Export Context), [`python/exploy/exporter/core/exportable_environment.py`](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/exportable_environment.py) (Exportable Environment), [`python/exploy/exporter/core/exporter.py`](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/exporter.py) (ONNX Exporter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_export["Policy Export"]
  node_environment["Exportable Environment"]
  node_export_context["Export Context<br/>[context_manager.py]"]
  node_export_components["Graph Components<br/>[components.py]"]
  node_derived_tensors["Derived Tensors<br/>[derived_tensors.py]"]
  node_tensor_proxy["Tensor Proxy<br/>[tensor_proxy.py]"]
  node_actor["Exportable Actor<br/>[actor.py]"]
  node_evaluator["Policy Evaluator<br/>[evaluator.py]"]
  node_session["ONNX Session<br/>[session_wrapper.py]"]
  node_onnx_export["ONNX Exporter<br/>[exporter.py]"]
end

subgraph group_frameworks["Framework Adapters"]
  node_isaac_adapter["IsaacLab Adapter<br/>[env.py]"]
  node_isaac_inputs["IsaacLab Inputs<br/>[inputs.py]"]
  node_isaac_data["IsaacLab Entity Data"]
  node_mjlab_adapter["MjLab Adapter<br/>[env.py]"]
  node_mjlab_inputs["MjLab Inputs<br/>[inputs.py]"]
  node_mjlab_data["MjLab Entity Data<br/>[entity_data.py]"]
end

subgraph group_deploy["C++ Deployment"]
  node_controller["ONNX Controller<br/>[controller.cpp]"]
  node_runtime["ONNX Runtime<br/>[onnx_runtime.cpp]"]
  node_context["Model Context<br/>[context.cpp]"]
  node_matcher["Tensor Matchers<br/>[matcher.cpp]"]
  node_components["Control Components<br/>[components.cpp]"]
  node_worker["Execution Worker<br/>[worker.cpp]"]
end

subgraph group_interfaces["Robot Interfaces"]
  node_robot_state["Robot State API"]
  node_command["Command API"]
  node_data_collection["Data Collection API"]
end

node_robot(("Robot Hardware"))
node_onnx_model["ONNX Policy Model"]

node_isaac_adapter -->|"adapts"| node_environment
node_mjlab_adapter -->|"adapts"| node_environment
node_isaac_inputs -->|"registers inputs"| node_export_context
node_mjlab_inputs -->|"registers inputs"| node_export_context
node_isaac_data -->|"uses tensors"| node_tensor_proxy
node_mjlab_data -->|"uses tensors"| node_tensor_proxy
node_isaac_adapter -->|"uses"| node_derived_tensors
node_mjlab_adapter -->|"uses"| node_derived_tensors
node_environment -->|"uses context"| node_export_context
node_export_context -->|"manages"| node_export_components
node_evaluator -->|"reads context"| node_export_context
node_evaluator -->|"runs inference"| node_session
node_session -->|"wraps actor"| node_actor
node_onnx_export -->|"exports"| node_onnx_model
node_environment -.->|"exports graph"| node_onnx_export
node_onnx_export -->|"produces"| node_onnx_model
node_onnx_model -->|"loads policy"| node_controller
node_controller -->|"initializes and evaluates"| node_runtime
node_controller -->|"creates context"| node_context
node_context -->|"matches tensors"| node_matcher
node_context -->|"builds components"| node_components
node_controller -->|"sets callbacks"| node_worker
node_worker -->|"reads state"| node_robot_state
node_worker -->|"invokes callbacks"| node_controller
node_components -->|"reads observations"| node_robot_state
node_components -->|"writes commands"| node_command
node_controller -->|"registers model data"| node_data_collection
node_robot -.->|"provides state"| node_robot_state
node_command -.->|"dispatches commands"| node_robot

click node_environment "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/exportable_environment.py"
click node_export_context "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/context_manager.py"
click node_export_components "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/components.py"
click node_derived_tensors "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/derived_tensors.py"
click node_tensor_proxy "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/tensor_proxy.py"
click node_actor "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/actor.py"
click node_evaluator "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/evaluator.py"
click node_session "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/session_wrapper.py"
click node_onnx_export "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/exporter.py"
click node_isaac_adapter "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/isaaclab/env.py"
click node_isaac_inputs "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/isaaclab/inputs.py"
click node_isaac_data "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/isaaclab/articulation_data.py"
click node_mjlab_adapter "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/mjlab/env.py"
click node_mjlab_inputs "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/mjlab/inputs.py"
click node_mjlab_data "https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/mjlab/entity_data.py"
click node_controller "https://github.com/rai-opensource/exploy/blob/main/control/src/controller.cpp"
click node_runtime "https://github.com/rai-opensource/exploy/blob/main/control/src/onnx_runtime.cpp"
click node_context "https://github.com/rai-opensource/exploy/blob/main/control/src/context.cpp"
click node_matcher "https://github.com/rai-opensource/exploy/blob/main/control/src/matcher.cpp"
click node_components "https://github.com/rai-opensource/exploy/blob/main/control/src/components.cpp"
click node_worker "https://github.com/rai-opensource/exploy/blob/main/control/src/worker.cpp"
click node_robot_state "https://github.com/rai-opensource/exploy/blob/main/control/include/exploy/state_interface.hpp"
click node_command "https://github.com/rai-opensource/exploy/blob/main/control/include/exploy/command_interface.hpp"
click node_data_collection "https://github.com/rai-opensource/exploy/blob/main/control/include/exploy/data_collection_interface.hpp"

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_environment,node_export_context,node_export_components,node_derived_tensors,node_tensor_proxy,node_actor,node_evaluator,node_session,node_onnx_export toneBlue
class node_isaac_adapter,node_isaac_inputs,node_isaac_data,node_mjlab_adapter,node_mjlab_inputs,node_mjlab_data toneAmber
class node_controller,node_runtime,node_context,node_matcher,node_components,node_worker toneMint
class node_robot_state,node_command,node_data_collection toneRose
class node_robot,node_onnx_model toneIndigo
```

## Components

### Policy Export

- [Exportable Environment](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/exportable_environment.py): `python/exploy/exporter/core/exportable_environment.py`
- [Export Context](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/context_manager.py): `python/exploy/exporter/core/context_manager.py`
- [Graph Components](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/components.py): `python/exploy/exporter/core/components.py`
- [Derived Tensors](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/derived_tensors.py): `python/exploy/exporter/core/derived_tensors.py`
- [Tensor Proxy](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/tensor_proxy.py): `python/exploy/exporter/core/tensor_proxy.py`
- [Exportable Actor](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/actor.py): `python/exploy/exporter/core/actor.py`
- [Policy Evaluator](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/evaluator.py): `python/exploy/exporter/core/evaluator.py`
- [ONNX Session](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/session_wrapper.py): `python/exploy/exporter/core/session_wrapper.py`
- [ONNX Exporter](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/core/exporter.py): `python/exploy/exporter/core/exporter.py`

### Framework Adapters

- [IsaacLab Adapter](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/isaaclab/env.py): `python/exploy/exporter/frameworks/isaaclab/env.py`
- [IsaacLab Inputs](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/isaaclab/inputs.py): `python/exploy/exporter/frameworks/isaaclab/inputs.py`
- [IsaacLab Entity Data](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/isaaclab/articulation_data.py): `python/exploy/exporter/frameworks/isaaclab/articulation_data.py`
- [MjLab Adapter](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/mjlab/env.py): `python/exploy/exporter/frameworks/mjlab/env.py`
- [MjLab Inputs](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/mjlab/inputs.py): `python/exploy/exporter/frameworks/mjlab/inputs.py`
- [MjLab Entity Data](https://github.com/rai-opensource/exploy/blob/main/python/exploy/exporter/frameworks/mjlab/entity_data.py): `python/exploy/exporter/frameworks/mjlab/entity_data.py`

### C++ Deployment

- [ONNX Controller](https://github.com/rai-opensource/exploy/blob/main/control/src/controller.cpp): `control/src/controller.cpp`
- [ONNX Runtime](https://github.com/rai-opensource/exploy/blob/main/control/src/onnx_runtime.cpp): `control/src/onnx_runtime.cpp`
- [Model Context](https://github.com/rai-opensource/exploy/blob/main/control/src/context.cpp): `control/src/context.cpp`
- [Tensor Matchers](https://github.com/rai-opensource/exploy/blob/main/control/src/matcher.cpp): `control/src/matcher.cpp`
- [Control Components](https://github.com/rai-opensource/exploy/blob/main/control/src/components.cpp): `control/src/components.cpp`
- [Execution Worker](https://github.com/rai-opensource/exploy/blob/main/control/src/worker.cpp): `control/src/worker.cpp`

### Robot Interfaces

- [Robot State API](https://github.com/rai-opensource/exploy/blob/main/control/include/exploy/state_interface.hpp): `control/include/exploy/state_interface.hpp`
- [Command API](https://github.com/rai-opensource/exploy/blob/main/control/include/exploy/command_interface.hpp): `control/include/exploy/command_interface.hpp`
- [Data Collection API](https://github.com/rai-opensource/exploy/blob/main/control/include/exploy/data_collection_interface.hpp): `control/include/exploy/data_collection_interface.hpp`

### Other components

- **Robot Hardware**
- **ONNX Policy Model**

## Connections

- IsaacLab Adapter → Exportable Environment: adapts
- MjLab Adapter → Exportable Environment: adapts (evidence: `python/exploy/exporter/frameworks/mjlab/env.py`)
- IsaacLab Inputs → Export Context: registers inputs (evidence: `python/exploy/exporter/frameworks/isaaclab/inputs.py`)
- MjLab Inputs → Export Context: registers inputs (evidence: `python/exploy/exporter/frameworks/mjlab/inputs.py`)
- IsaacLab Entity Data → Tensor Proxy: uses tensors (evidence: `python/exploy/exporter/frameworks/isaaclab/articulation_data.py`)
- MjLab Entity Data → Tensor Proxy: uses tensors (evidence: `python/exploy/exporter/frameworks/mjlab/entity_data.py`)
- IsaacLab Adapter → Derived Tensors: uses
- MjLab Adapter → Derived Tensors: uses (evidence: `python/exploy/exporter/frameworks/mjlab/env.py`)
- Exportable Environment → Export Context: uses context (evidence: `python/exploy/exporter/core/exportable_environment.py`)
- Export Context → Graph Components: manages (evidence: `python/exploy/exporter/core/context_manager.py`)
- Policy Evaluator → Export Context: reads context (evidence: `python/exploy/exporter/core/evaluator.py`)
- Policy Evaluator → ONNX Session: runs inference (evidence: `python/exploy/exporter/core/evaluator.py`)
- ONNX Session → Exportable Actor: wraps actor (evidence: `python/exploy/exporter/core/session_wrapper.py`)
- ONNX Exporter → ONNX Policy Model: exports
- Exportable Environment → ONNX Exporter: exports graph
- ONNX Exporter → ONNX Policy Model: produces
- ONNX Policy Model → ONNX Controller: loads policy
- ONNX Controller → ONNX Runtime: initializes and evaluates (evidence: `control/src/controller.cpp`)
- ONNX Controller → Model Context: creates context (evidence: `control/src/controller.cpp`)
- Model Context → Tensor Matchers: matches tensors
- Model Context → Control Components: builds components (evidence: `control/src/context.cpp`)
- ONNX Controller → Execution Worker: sets callbacks (evidence: `control/src/controller.cpp`)
- Execution Worker → Robot State API: reads state
- Execution Worker → ONNX Controller: invokes callbacks (evidence: `control/src/controller.cpp`)
- Control Components → Robot State API: reads observations
- Control Components → Command API: writes commands
- ONNX Controller → Data Collection API: registers model data (evidence: `control/src/controller.cpp`)
- Robot Hardware → Robot State API: provides state
- Command API → Robot Hardware: dispatches commands
