# rllm-org/rllm architecture

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

- Interactive diagram: https://gitdiagram.com/rllm-org/rllm
- Repository: https://github.com/rllm-org/rllm

## Overview

rLLM is a framework for training and evaluating language agents with reinforcement learning. A user supplies an agent flow, task data, and an evaluator; workflow engines run rollouts, the model gateway captures model-call traces, and evaluation produces rewards. Training transforms rollout data for advantage computation and delegates policy updates to configurable backends. The README documents this overall pipeline and highlights harness, sandbox, benchmark, and training-method options. Some capability nodes are based on README claims and the file tree; unsampled source limits the detail of their connections.

Main entry points: [`rllm/workflows/workflow.py`](https://github.com/rllm-org/rllm/blob/main/rllm/workflows/workflow.py) (Workflows), [`rllm/engine/agentflow_engine.py`](https://github.com/rllm-org/rllm/blob/main/rllm/engine/agentflow_engine.py) (Agent Flow Engine), [`rllm/trainer/unified_trainer.py`](https://github.com/rllm-org/rllm/blob/main/rllm/trainer/unified_trainer.py) (Unified Trainer), [`rllm/engine/unified_workflow_engine.py`](https://github.com/rllm-org/rllm/blob/main/rllm/engine/unified_workflow_engine.py) (Workflow Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_execution["Agent Execution"]
  node_harnesses["Agent Harnesses<br/>[cli_harness.py]"]
  node_sandbox["Sandbox Backends"]
  node_workflows["Workflows<br/>[workflow.py]"]
  node_workflow_engine["Workflow Engine"]
  node_agentflow["Agent Flow Engine"]
  node_rollout["Rollout Engines<br/>[rollout_engine.py]"]
  node_tools["Tools and Parsers<br/>[tool_base.py]"]
end

subgraph group_capture["Trace and Evaluation"]
  node_gateway_manager["Gateway Lifecycle<br/>[manager.py]"]
  node_gateway["Model Gateway<br/>[proxy.py]"]
  node_trace["Trace Conversion<br/>[trace_converter.py]"]
  node_episodes["Episodes and Logging<br/>[episode_logger.py]"]
  node_evaluation["Evaluation and Rewards<br/>[runner.py]"]
end

subgraph group_training["Training"]
  node_transforms["Training Transforms<br/>[transform.py]"]
  node_trainer["Unified Trainer<br/>[unified_trainer.py]"]
  node_algorithms["RL Algorithms<br/>[rl_algo.py]"]
  node_backends["Training Backends"]
end

subgraph group_integration["Data and Integrations"]
  node_cli["CLI<br/>[main.py]"]
  node_datasets["Tasks and Benchmarks<br/>[loader.py]"]
end

node_user(("User"))
node_model_provider{{"Model Provider"}}

node_user -->|"runs commands"| node_cli
node_user -->|"supplies agent"| node_agentflow
node_cli -->|"selects benchmark"| node_datasets
node_datasets -.->|"provides tasks"| node_workflow_engine
node_harnesses -.->|"runs within"| node_workflows
node_sandbox -.->|"hosts rollouts"| node_workflows
node_workflow_engine -->|"executes"| node_workflows
node_agentflow -->|"runs flow"| node_workflows
node_workflows -->|"requests model output"| node_rollout
node_rollout -->|"uses tool parser"| node_tools
node_agentflow -->|"starts trace gateway"| node_gateway_manager
node_gateway_manager -->|"configures service"| node_gateway
node_model_provider -.->|"serves model calls"| node_gateway
node_gateway -->|"captures traces"| node_trace
node_trace -->|"structures episodes"| node_episodes
node_agentflow -->|"enriches episode"| node_episodes
node_episodes -.->|"provides rollout"| node_evaluation
node_evaluation -->|"computes rewards"| node_trainer
node_trainer -->|"collects rollouts"| node_workflow_engine
node_trainer -->|"prepares trajectories"| node_transforms
node_transforms -->|"groups for advantages"| node_algorithms
node_trainer -->|"delegates updates"| node_backends
node_backends -.->|"updates model"| node_model_provider

click node_cli "https://github.com/rllm-org/rllm/blob/main/rllm/cli/main.py"
click node_datasets "https://github.com/rllm-org/rllm/blob/main/rllm/tasks/loader.py"
click node_harnesses "https://github.com/rllm-org/rllm/blob/main/rllm/harnesses/cli_harness.py"
click node_sandbox "https://github.com/rllm-org/rllm/tree/main/rllm/sandbox/backends"
click node_workflows "https://github.com/rllm-org/rllm/blob/main/rllm/workflows/workflow.py"
click node_workflow_engine "https://github.com/rllm-org/rllm/blob/main/rllm/engine/unified_workflow_engine.py"
click node_agentflow "https://github.com/rllm-org/rllm/blob/main/rllm/engine/agentflow_engine.py"
click node_rollout "https://github.com/rllm-org/rllm/blob/main/rllm/engine/rollout/rollout_engine.py"
click node_tools "https://github.com/rllm-org/rllm/blob/main/rllm/tools/tool_base.py"
click node_gateway_manager "https://github.com/rllm-org/rllm/blob/main/rllm/gateway/manager.py"
click node_gateway "https://github.com/rllm-org/rllm/blob/main/rllm-model-gateway/src/rllm_model_gateway/proxy.py"
click node_trace "https://github.com/rllm-org/rllm/blob/main/rllm/engine/trace_converter.py"
click node_episodes "https://github.com/rllm-org/rllm/blob/main/rllm/utils/episode_logger.py"
click node_evaluation "https://github.com/rllm-org/rllm/blob/main/rllm/eval/runner.py"
click node_transforms "https://github.com/rllm-org/rllm/blob/main/rllm/trainer/verl/transform.py"
click node_trainer "https://github.com/rllm-org/rllm/blob/main/rllm/trainer/unified_trainer.py"
click node_algorithms "https://github.com/rllm-org/rllm/blob/main/rllm/trainer/algorithms/rl_algo.py"
click node_backends "https://github.com/rllm-org/rllm/blob/main/rllm/trainer/backend_protocol.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_harnesses,node_sandbox,node_workflows,node_workflow_engine,node_agentflow,node_rollout,node_tools,node_user toneBlue
class node_gateway_manager,node_gateway,node_trace,node_episodes,node_evaluation toneAmber
class node_transforms,node_trainer,node_algorithms,node_backends toneMint
class node_cli,node_datasets toneRose
class node_model_provider toneIndigo
```

## Components

### Agent Execution

- [Agent Harnesses](https://github.com/rllm-org/rllm/blob/main/rllm/harnesses/cli_harness.py): `rllm/harnesses/cli_harness.py`
- [Sandbox Backends](https://github.com/rllm-org/rllm/tree/main/rllm/sandbox/backends): `rllm/sandbox/backends`
- [Workflows](https://github.com/rllm-org/rllm/blob/main/rllm/workflows/workflow.py): `rllm/workflows/workflow.py`
- [Workflow Engine](https://github.com/rllm-org/rllm/blob/main/rllm/engine/unified_workflow_engine.py): `rllm/engine/unified_workflow_engine.py`
- [Agent Flow Engine](https://github.com/rllm-org/rllm/blob/main/rllm/engine/agentflow_engine.py): `rllm/engine/agentflow_engine.py`
- [Rollout Engines](https://github.com/rllm-org/rllm/blob/main/rllm/engine/rollout/rollout_engine.py): `rllm/engine/rollout/rollout_engine.py`
- [Tools and Parsers](https://github.com/rllm-org/rllm/blob/main/rllm/tools/tool_base.py): `rllm/tools/tool_base.py`

### Trace and Evaluation

- [Gateway Lifecycle](https://github.com/rllm-org/rllm/blob/main/rllm/gateway/manager.py): `rllm/gateway/manager.py`
- [Model Gateway](https://github.com/rllm-org/rllm/blob/main/rllm-model-gateway/src/rllm_model_gateway/proxy.py): `rllm-model-gateway/src/rllm_model_gateway/proxy.py`
- [Trace Conversion](https://github.com/rllm-org/rllm/blob/main/rllm/engine/trace_converter.py): `rllm/engine/trace_converter.py`
- [Episodes and Logging](https://github.com/rllm-org/rllm/blob/main/rllm/utils/episode_logger.py): `rllm/utils/episode_logger.py`
- [Evaluation and Rewards](https://github.com/rllm-org/rllm/blob/main/rllm/eval/runner.py): `rllm/eval/runner.py`

### Training

- [Training Transforms](https://github.com/rllm-org/rllm/blob/main/rllm/trainer/verl/transform.py): `rllm/trainer/verl/transform.py`
- [Unified Trainer](https://github.com/rllm-org/rllm/blob/main/rllm/trainer/unified_trainer.py): `rllm/trainer/unified_trainer.py`
- [RL Algorithms](https://github.com/rllm-org/rllm/blob/main/rllm/trainer/algorithms/rl_algo.py): `rllm/trainer/algorithms/rl_algo.py`
- [Training Backends](https://github.com/rllm-org/rllm/blob/main/rllm/trainer/backend_protocol.py): `rllm/trainer/backend_protocol.py`

### Data and Integrations

- [CLI](https://github.com/rllm-org/rllm/blob/main/rllm/cli/main.py): `rllm/cli/main.py`
- [Tasks and Benchmarks](https://github.com/rllm-org/rllm/blob/main/rllm/tasks/loader.py): `rllm/tasks/loader.py`

### Other components

- **User**
- **Model Provider**

## Connections

- User → CLI: runs commands (evidence: `README.md`)
- User → Agent Flow Engine: supplies agent (evidence: `README.md`)
- CLI → Tasks and Benchmarks: selects benchmark (evidence: `README.md`)
- Tasks and Benchmarks → Workflow Engine: provides tasks
- Agent Harnesses → Workflows: runs within
- Sandbox Backends → Workflows: hosts rollouts
- Workflow Engine → Workflows: executes (evidence: `rllm/engine/unified_workflow_engine.py`)
- Agent Flow Engine → Workflows: runs flow (evidence: `rllm/engine/agentflow_engine.py`)
- Workflows → Rollout Engines: requests model output (evidence: `rllm/workflows/workflow.py`)
- Rollout Engines → Tools and Parsers: uses tool parser (evidence: `rllm/engine/rollout/rollout_engine.py`)
- Agent Flow Engine → Gateway Lifecycle: starts trace gateway (evidence: `rllm/engine/agentflow_engine.py`)
- Gateway Lifecycle → Model Gateway: configures service (evidence: `rllm/gateway/manager.py`)
- Model Provider → Model Gateway: serves model calls
- Model Gateway → Trace Conversion: captures traces (evidence: `README.md`)
- Trace Conversion → Episodes and Logging: structures episodes (evidence: `rllm/engine/trace_converter.py`)
- Agent Flow Engine → Episodes and Logging: enriches episode (evidence: `rllm/engine/agentflow_engine.py`)
- Episodes and Logging → Evaluation and Rewards: provides rollout
- Evaluation and Rewards → Unified Trainer: computes rewards (evidence: `README.md`)
- Unified Trainer → Workflow Engine: collects rollouts (evidence: `rllm/trainer/unified_trainer.py`)
- Unified Trainer → Training Transforms: prepares trajectories (evidence: `rllm/trainer/unified_trainer.py`)
- Training Transforms → RL Algorithms: groups for advantages (evidence: `README.md`)
- Unified Trainer → Training Backends: delegates updates (evidence: `README.md`)
- Training Backends → Model Provider: updates model
