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_data_routers, 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 higher-level workspace facade that
re-exports this runtime under a single namespace (relayrl::agent,
relayrl::types, relayrl::algorithms, relayrl::utils). Prefer depending
on relayrl once published unless you specifically need the runtime crate
directly.
[]
= "0.5.0-rc.1"
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. Client
network transport (ZMQ/NATS) is experimental. Server-backed
inference/training runtimes are not shipped in this branch. 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 -> actors/data routers -> data sinks.
Module structure
network: the runtime.network::client: the multi-actor client runtime (rewritten in v0.5.0). The publicagentmodule holds theRelayRLAgentfacade,AgentBuilderconstruction API, and theActorInfoactor handle; the internalruntimeholdscontrol(coordinator, lifecycle, scaling, state),data::router(message routing), anddata(file sinks plus experimental transport sinks).- Server runtime is not shipped;
training-server/inference-serverfeature flags are reserved/no-op in this branch.
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-rc.1"
= { = "1", = ["full"] }
Build the agent, start the runtime, create actors, request actions, and shut
down. The example is no_run because it expects a model directory and config
on disk:
use *;
use ModelModule;
use DeviceType;
use ;
use PathBuf;
async
Feature flags
client(default): core client runtime.logging-init: 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 client network transports.inference-server/training-server: reserved/no-op feature flags; no server runtime ships in this branch.
Current support
- Supported: the local/default client runtime, including local inference and actor lifecycle management, live router scaling, local Arrow/CSV trajectory writing, in-memory trajectory retrieval, parallelized environment batching, and PPO training rollouts.
- Experimental: client ZMQ/NATS transport paths, even when their feature flags are enabled.
- Not shipped: server-backed inference or training runtimes.
Release Notes / 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.