# paddlepaddle/parl architecture

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

- Interactive diagram: https://gitdiagram.com/paddlepaddle/parl
- Repository: https://github.com/paddlepaddle/parl

## Overview

PARL is a reinforcement-learning framework: users define models, algorithms, and agents, then train agents against environments; its algorithm catalog spans multiple backends. The README also documents optional distributed execution through remote actors, and the tree includes a Waymax autonomous-driving training application and a C++ evolution-strategies kit. Core abstraction and remote relationships below follow README statements; implementation links are limited to relationships visible in the supplied excerpts or SOURCE INDEX, so unsampled subsystems are shown without speculative call chains.

Main entry points: [`parl/core`](https://github.com/paddlepaddle/parl/tree/develop/parl/core) (Algorithm abstractions), [`parl/remote/worker.py`](https://github.com/paddlepaddle/parl/blob/develop/parl/remote/worker.py) (Cluster worker), [`evo_kit/paddle/src/es_agent.cc`](https://github.com/paddlepaddle/parl/blob/develop/evo_kit/paddle/src/es_agent.cc) (Evolution agents), [`waymax_rl/train.py`](https://github.com/paddlepaddle/parl/blob/develop/waymax_rl/train.py) (Waymax training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_framework["RL framework"]
  node_agent["Agent abstractions"]
  node_algorithm["Algorithm abstractions"]
  node_model["Model abstractions<br/>[model_base.py]"]
  node_fluid_model["Fluid model<br/>[model.py]"]
  node_backend_agents["Backend agents<br/>[agent.py]"]
  node_fluid_layers["Fluid layers<br/>[layer_wrappers.py]"]
end

subgraph group_algorithms["Algorithm catalog"]
  node_fluid_algos["Fluid algorithms"]
  node_paddle_algos["Paddle algorithms"]
  node_torch_algos["Torch algorithms"]
end

subgraph group_environments["Environments"]
  node_env["RL environments"]
end

subgraph group_distributed["Distributed training"]
  node_remote_api["Remote API"]
  node_remote_client["Cluster client<br/>[client.py]"]
  node_remote_worker["Cluster worker<br/>[worker.py]"]
  node_worker_manager["Resource manager<br/>[worker_manager.py]"]
  node_heartbeat["Heartbeat service"]
end

subgraph group_specialized["Specialized training"]
  node_evo_sampling["ES sampling"]
  node_evo_optimizer["ES optimizers"]
  node_evo_agent["Evolution agents<br/>[es_agent.cc]"]
  node_waymax_train["Waymax training<br/>[train.py]"]
  node_waymax_env["Waymax vector env<br/>[env_wrapper.py]"]
  node_waymax_runner["Runner builder<br/>[build_runner.py]"]
end

node_user(("Developer"))

node_user -->|"defines agent"| node_agent
node_env -->|"supplies experience"| node_agent
node_agent -->|"bridges data"| node_algorithm
node_algorithm -->|"updates parameters"| node_model
node_fluid_model -->|"uses layers"| node_fluid_layers
node_fluid_algos -.->|"backend algorithms"| node_algorithm
node_paddle_algos -.->|"backend algorithms"| node_algorithm
node_torch_algos -.->|"backend algorithms"| node_algorithm
node_user -->|"decorates class"| node_remote_api
node_remote_api -.->|"connects client"| node_remote_client
node_remote_client -.->|"submits jobs"| node_remote_worker
node_remote_worker -->|"reports resources"| node_worker_manager
node_remote_worker -.->|"starts heartbeat"| node_heartbeat
node_waymax_train -->|"builds runner"| node_waymax_runner
node_waymax_train -->|"configures environment"| node_waymax_env
node_evo_agent -->|"uses sampler"| node_evo_sampling
node_evo_agent -->|"uses optimizer"| node_evo_optimizer

click node_env "https://github.com/paddlepaddle/parl/tree/develop/parl/env"
click node_agent "https://github.com/paddlepaddle/parl/tree/develop/parl/core"
click node_algorithm "https://github.com/paddlepaddle/parl/tree/develop/parl/core"
click node_model "https://github.com/paddlepaddle/parl/blob/develop/parl/core/model_base.py"
click node_fluid_model "https://github.com/paddlepaddle/parl/blob/develop/parl/core/fluid/model.py"
click node_backend_agents "https://github.com/paddlepaddle/parl/blob/develop/parl/core/paddle/agent.py"
click node_fluid_layers "https://github.com/paddlepaddle/parl/blob/develop/parl/core/fluid/layers/layer_wrappers.py"
click node_fluid_algos "https://github.com/paddlepaddle/parl/tree/develop/parl/algorithms/fluid"
click node_paddle_algos "https://github.com/paddlepaddle/parl/tree/develop/parl/algorithms/paddle"
click node_torch_algos "https://github.com/paddlepaddle/parl/tree/develop/parl/algorithms/torch"
click node_remote_api "https://github.com/paddlepaddle/parl/blob/develop/parl/remote/remote_decorator.py"
click node_remote_client "https://github.com/paddlepaddle/parl/blob/develop/parl/remote/client.py"
click node_remote_worker "https://github.com/paddlepaddle/parl/blob/develop/parl/remote/worker.py"
click node_worker_manager "https://github.com/paddlepaddle/parl/blob/develop/parl/remote/worker_manager.py"
click node_heartbeat "https://github.com/paddlepaddle/parl/blob/develop/parl/remote/grpc_heartbeat/heartbeat_server.py"
click node_evo_sampling "https://github.com/paddlepaddle/parl/blob/develop/evo_kit/core/src/cached_gaussian_sampling.cc"
click node_evo_optimizer "https://github.com/paddlepaddle/parl/blob/develop/evo_kit/core/src/optimizer_factory.cc"
click node_evo_agent "https://github.com/paddlepaddle/parl/blob/develop/evo_kit/paddle/src/es_agent.cc"
click node_waymax_train "https://github.com/paddlepaddle/parl/blob/develop/waymax_rl/train.py"
click node_waymax_env "https://github.com/paddlepaddle/parl/blob/develop/waymax_rl/utils/env_wrapper.py"
click node_waymax_runner "https://github.com/paddlepaddle/parl/blob/develop/waymax_rl/utils/build_runner.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_agent,node_algorithm,node_model,node_fluid_model,node_backend_agents,node_fluid_layers toneBlue
class node_fluid_algos,node_paddle_algos,node_torch_algos toneAmber
class node_env toneMint
class node_remote_api,node_remote_client,node_remote_worker,node_worker_manager,node_heartbeat toneRose
class node_evo_sampling,node_evo_optimizer,node_evo_agent,node_waymax_train,node_waymax_env,node_waymax_runner,node_user toneIndigo
```

## Components

### RL framework

- [Agent abstractions](https://github.com/paddlepaddle/parl/tree/develop/parl/core): `parl/core`
- [Algorithm abstractions](https://github.com/paddlepaddle/parl/tree/develop/parl/core): `parl/core`
- [Model abstractions](https://github.com/paddlepaddle/parl/blob/develop/parl/core/model_base.py): `parl/core/model_base.py`
- [Fluid model](https://github.com/paddlepaddle/parl/blob/develop/parl/core/fluid/model.py): `parl/core/fluid/model.py`
- [Backend agents](https://github.com/paddlepaddle/parl/blob/develop/parl/core/paddle/agent.py): `parl/core/paddle/agent.py`
- [Fluid layers](https://github.com/paddlepaddle/parl/blob/develop/parl/core/fluid/layers/layer_wrappers.py): `parl/core/fluid/layers/layer_wrappers.py`

### Algorithm catalog

- [Fluid algorithms](https://github.com/paddlepaddle/parl/tree/develop/parl/algorithms/fluid): `parl/algorithms/fluid`
- [Paddle algorithms](https://github.com/paddlepaddle/parl/tree/develop/parl/algorithms/paddle): `parl/algorithms/paddle`
- [Torch algorithms](https://github.com/paddlepaddle/parl/tree/develop/parl/algorithms/torch): `parl/algorithms/torch`

### Environments

- [RL environments](https://github.com/paddlepaddle/parl/tree/develop/parl/env): `parl/env`

### Distributed training

- [Remote API](https://github.com/paddlepaddle/parl/blob/develop/parl/remote/remote_decorator.py): `parl/remote/remote_decorator.py`
- [Cluster client](https://github.com/paddlepaddle/parl/blob/develop/parl/remote/client.py): `parl/remote/client.py`
- [Cluster worker](https://github.com/paddlepaddle/parl/blob/develop/parl/remote/worker.py): `parl/remote/worker.py`
- [Resource manager](https://github.com/paddlepaddle/parl/blob/develop/parl/remote/worker_manager.py): `parl/remote/worker_manager.py`
- [Heartbeat service](https://github.com/paddlepaddle/parl/blob/develop/parl/remote/grpc_heartbeat/heartbeat_server.py): `parl/remote/grpc_heartbeat/heartbeat_server.py`

### Specialized training

- [ES sampling](https://github.com/paddlepaddle/parl/blob/develop/evo_kit/core/src/cached_gaussian_sampling.cc): `evo_kit/core/src/cached_gaussian_sampling.cc`
- [ES optimizers](https://github.com/paddlepaddle/parl/blob/develop/evo_kit/core/src/optimizer_factory.cc): `evo_kit/core/src/optimizer_factory.cc`
- [Evolution agents](https://github.com/paddlepaddle/parl/blob/develop/evo_kit/paddle/src/es_agent.cc): `evo_kit/paddle/src/es_agent.cc`
- [Waymax training](https://github.com/paddlepaddle/parl/blob/develop/waymax_rl/train.py): `waymax_rl/train.py`
- [Waymax vector env](https://github.com/paddlepaddle/parl/blob/develop/waymax_rl/utils/env_wrapper.py): `waymax_rl/utils/env_wrapper.py`
- [Runner builder](https://github.com/paddlepaddle/parl/blob/develop/waymax_rl/utils/build_runner.py): `waymax_rl/utils/build_runner.py`

### Other components

- **Developer**

## Connections

- Developer → Agent abstractions: defines agent (evidence: `README.md`)
- RL environments → Agent abstractions: supplies experience (evidence: `README.md`)
- Agent abstractions → Algorithm abstractions: bridges data (evidence: `README.md`)
- Algorithm abstractions → Model abstractions: updates parameters (evidence: `README.md`)
- Fluid model → Fluid layers: uses layers (evidence: `parl/core/fluid/model.py`)
- Fluid algorithms → Algorithm abstractions: backend algorithms
- Paddle algorithms → Algorithm abstractions: backend algorithms (evidence: `parl/algorithms/paddle/cql.py`)
- Torch algorithms → Algorithm abstractions: backend algorithms (evidence: `parl/algorithms/torch/mappo.py`)
- Developer → Remote API: decorates class (evidence: `README.md`)
- Remote API → Cluster client: connects client
- Cluster client → Cluster worker: submits jobs
- Cluster worker → Resource manager: reports resources (evidence: `parl/remote/worker.py`)
- Cluster worker → Heartbeat service: starts heartbeat
- Waymax training → Runner builder: builds runner (evidence: `waymax_rl/train.py`)
- Waymax training → Waymax vector env: configures environment (evidence: `waymax_rl/train.py`)
- Evolution agents → ES sampling: uses sampler
- Evolution agents → ES optimizers: uses optimizer
