System Architecture¶
Four-Layer Architecture¶
Application Layer¶
The Application Layer is where users write RL applications. It provides:
Configuration files (YAML + Hydra) that declare all component settings and compose them into a single
MainConfig.Policy subclasses — users subclass
BasePolicyand implementconstruct_network,rollout_step, andtrain.Entry-point scripts that call the builder API to assemble the training pipeline.
Controller Layer¶
The Controller Layer implements the control plane: it decides what to do and when, but does not perform computation itself.
It is split into two hierarchical sublayers:
- Engine (coarse-grained orchestration)
Drives the top-level RL training loop, broken into four stages per iteration:
rollout— collect experience from the environment.update_dataset— transfer data from buffer to training workers.train— update policy weights.sync_weights— push updated weights to eval workers.
Built-in engines cover common paradigms:
SyncRLEngine— on-policy synchronous (PPO-style)AsyncRLEngine— off-policy asynchronous
See Engine for more details.
- WorkerGroup (fine-grained task dispatch)
Each component (Env, Policy, Buffer) is wrapped in a WorkerGroup that:
Exposes a batched interface to the Engine.
Internally routes requests across multiple Worker instances via a
BatchRouterandAsyncIOHandler.Handles load balancing, result aggregation, and node-affinity routing.
sequenceDiagram
participant E as Engine
participant PG as PolicyGroup (WorkerGroup)
participant EG as EnvGroup (WorkerGroup)
participant BG as BufferGroup (WorkerGroup)
loop Each Epoch
E-->>EG: rollout (schedule)
EG->>E: EnvRet (obs, reward, done)
E-->>PG: rollout_step (schedule)
PG->>E: PolicyResponse (actions, log_probs, values)
E-->>BG: store (schedule)
E-->>BG: sample (schedule)
BG->>E: BatchedData
E-->>PG: train (schedule)
E-->>PG: sync_weights (schedule)
end
Worker Layer¶
Workers execute actual computation and storage. Each type scales horizontally and independently:
Worker Type |
Scales With |
Responsibility |
|---|---|---|
Env Worker |
|
Runs simulator; executes |
Eval Policy Worker (Actor) |
|
Inference-only; serves |
Train Policy Worker (Learner) |
|
Holds optimizer; executes |
Buffer Worker |
|
Stores and samples experience; manages storage shards |
Runtime and Resource Layer¶
The Runtime and Resource Layer is the underlying infrastructure that abstracts distributed execution complexity and is fully transparent to upper-level applications. It comprises two components:
- Resource Manager (fine-grained resource orchestration)
Manages independent scaling across all Worker types. Users declare the number of each Worker type in the config; To optimize communication efficiency and hardware utilization, the Resource Manager provides placement strategies.
See Placement Strategy for configuration details.
- Runtime Adapter (unified sequential / parallel execution)
Decouples algorithm logic from the underlying runtime. All Workers can be configured to run as local processes for prototyping and debugging. Once validated, switching to distributed execution requires only a config change. no algorithm code modifications are needed.
See Also¶
To Learn More, see the following sections:
Engine — Engine API and configuration reference.
Data Buffer — Buffer types and configuration.
Policy & PolicyGroup — Policy and PolicyGroup.
Placement Strategy — GPU placement strategies.