RelayRL Framework
The multi-actor reinforcement learning client runtime that powers RelayRL.
This crate is the top-level runtime: it composes the data model from
relayrl_types and the learning logic from relayrl_algorithms into a
controllable, scalable client that runs many actors, performs local inference,
and streams trajectories to data sinks. It is:
-
Heterogeneous: each actor runs as its own task and (in
Independentmode) owns its own hot-swappable model, so different actors can serve different policies on different environments at the same time. -
Concurrent: the runtime is Tokio-based. Routers can be scaled live with
scale_throughput, and actors run concurrently with interior-mutable shared state, in parallel on a multi-threaded runtime. -
Layered: a small public API (
RelayRLAgent+AgentBuilder) sits over an internal coordination, routing, and data-sink stack, keeping the surface ergonomic while the runtime stays modular.
API Docs | relayrl crate | Changelog | Repository
Most users should use the relayrl crate
relayrl is the stable, higher-level facade that
re-exports the most recent release of this runtime under a single namespace
(relayrl::network, relayrl::types, relayrl::algorithms,
relayrl::utilities). Prefer depending on relayrl unless you specifically
need to depend on the runtime crate directly.
[]
= "0.5.0"
Overview
relayrl_framework is the runtime layer of the RelayRL stack. It pulls the rest
of the stack together:
relayrl_types: backend-agnostic tensors, actions, trajectories, on-disk record adapters (Arrow/CSV), and the codec pipeline.relayrl_algorithms: policy and value networks, rollout buffering, and the PPO family (PPO,IPPO,MAPPO).relayrl_env_trait: theEnvironment,ScalarEnvironment, andVectorEnvironmentcontracts the runtime drives.
The supported path in 0.5.0 is the local/default client runtime. Network
transport (ZMQ/NATS) and server-backed inference/training workflows are
implemented as experimental and remain experimental even when their feature
flags are enabled. See Feature flags and
Current support.
Architecture
The client runtime is layered, with a small public API over an internal, concurrency-oriented runtime:
Public API ......... RelayRLAgent + AgentBuilder
|
Coordination ....... ClientCoordinator (orchestrator)
| ScaleManager (router scaling)
| StateManager (actor state)
| LifecycleManager (config, shutdown)
|
Routing ............ RouterDispatcher + scalable Router workers
|
Actors ............. concurrent actors, local model inference, trajectory building
|
Data sinks ......... file sink (Arrow/CSV), transport sink (ZMQ/NATS, experimental)
The local/default control flow is:
AgentBuilder -> RelayRLAgent -> ClientCoordinator -> routers/actors -> data sinks.
Module structure
network: the runtime.network::client: the multi-actor client runtime (rewritten in v0.5.0). The publicagentmodule holds theRelayRLAgentfacade andAgentBuilderconstruction API; the internalruntimeholdscoordination(coordinator, lifecycle, scaling, state),router(message routing), anddata(file sinks plus experimental transport sinks).network::server: optional, experimental training/inference servers behind feature flags.
utilities: JSON configuration loading/builders, logging (log4rs), and metrics (Prometheus/OpenTelemetry).prelude: grouped re-exports spanning this crate plusrelayrl_types,relayrl_algorithms, andrelayrl_env_trait.
Quick start
Add relayrl_framework and a Burn backend to your Cargo.toml:
[]
= "0.5.0"
= "0.20.1"
= "0.20.1"
= { = "1", = ["full"] }
Build the agent, start the runtime, request actions, and shut down. The example
is no_run because it expects a model directory and config on disk:
use *;
use ModelModule;
use NdArray;
use ;
use PathBuf;
async
Feature flags
client(default): core client runtime.logging(default): log4rs logging.tch-backend: LibTorch (tch) backend support viarelayrl_types.metrics: Prometheus/OpenTelemetry metrics.profile: flamegraph and tokio-console profiling.zmq-transport/nats-transport: experimental network transports.inference-server/training-server: experimental server integrations.
Note that, unlike the relayrl crate, the framework's default feature set is
["client", "logging"] and does not enable metrics.
Current support
The supported 0.5.0 path is the local/default client runtime, including:
- local inference and actor lifecycle management
- live router scaling
- local Arrow/CSV trajectory writing and in-memory trajectory retrieval
- parallelized environment batching
- PPO training rollouts
Transport-backed workflows remain experimental even when the corresponding feature flags are enabled:
zmq-transportandnats-transport- server-backed inference or training workflows
Changelog
Contributing
Contributions are welcome. Please open issues or pull requests for bug reports, feature requests, or improvements.
License
This project is licensed under the Apache License 2.0.