An open API service indexing awesome lists of open source software.

https://github.com/jrcalgo/relayrl

A MultiAgent Reinforcement Learning Framework primarily for Rust workflows
https://github.com/jrcalgo/relayrl

cli deep-learning distributed-system framework monorepo offline-training online-training python-bindings reinforcement-learning tensor-types

Last synced: about 2 months ago
JSON representation

A MultiAgent Reinforcement Learning Framework primarily for Rust workflows

Awesome Lists containing this project

README

          

# RelayRL

**Multi-Agent Reinforcement Learning Framework**

[![Rust](https://img.shields.io/badge/Rust-2024-orange?logo=rust)](https://www.rust-lang.org/)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[![Status](https://img.shields.io/badge/Status-Beta-orange.svg)]()

*A Rust-native framework for scalable deep reinforcement learning experiments*

---

## Overview

RelayRL is a **monorepo** containing a suite of Rust crates designed for distributed multi-agent reinforcement learning. Built with a Rust-first philosophy, the framework prioritizes performance, type safety, and scalability while maintaining an ergonomic API for single- and multi-agent learning environments.

### Key Highlights

- **Pure Rust Core** — No Python dependencies in the framework layer
- **Multi-Actor Native** — Concurrent actor execution with router-based message dispatching
- **Backend Agnostic** — Generic tensor interface via Burn (supports `NdArray`, `Tch` for CPU/CUDA/MPS)
- **Modular Architecture** — Decoupled layers for client, server, transport, and data handling
- **Robust Error Handling** — Proper error propagation instead of panics

## Crates

| Crate | Version | Description |
|-------|---------|-------------|
| [`relayrl_framework`](crates/relayrl_framework/) | `0.5.0-beta` | Core library with the local/default client runtime plus experimental server/transport scaffolding |
| [`relayrl_types`](crates/relayrl_types/) | `0.5.4` | Data types, tensor containers, inference models, and codec pipeline (compression, encryption, integrity) |
| [`relayrl_algorithms`](crates/relayrl_algorithms/) | `0.1.0` | Deep RL algorithms (PPO, REINFORCE, etc.) |
| [`relayrl_env_trait`](crates/relayrl_env_trait/) | `1.0.0` | Stable trait impl. for integrating environment logic |
| [`relayrl_python`](crates/relayrl_python/) | `0.1.0` | Python bindings via PyO3 — *scaffolding only* |
| [`relayrl_cli`](crates/relayrl_cli/) | `0.1.0` | Command-line interface with gRPC — *scaffolding only* |

## Platform Support

| Platform | Status |
|----------|--------|
| macOS (Apple Silicon) | Tested |
| Linux (Ubuntu) | Tested |
| Windows 10 (x86_64) | Tested |
| Windows 11 (x86_64) | Not tested (yet) |

## Quick Start

### Prerequisites

- Rust 2024 edition (`rustup update`)
- For GPU support: CUDA toolkit or MPS-compatible macOS

### Installation

In your Cargo.toml:
```toml
relayrl_framework = "0.5.0-beta"
```

### Basic Usage

```rust
use relayrl_framework::prelude::network::{AgentBuilder, RelayRLAgentActors};
use relayrl_framework::prelude::types::model::ModelModule;
use relayrl_framework::prelude::types::tensor::relayrl::DeviceType;
use burn_ndarray::NdArray;
use burn_tensor::{Tensor, Float};

#[tokio::main]
async fn main() -> Result<(), Box> {
// Build agent with 4 concurrent actors
let default_model = ModelModule::::load_from_path("model_dir")?;
let (mut agent, params) = AgentBuilder::::builder()
.actor_count(4)
.default_model(default_model)
.build().await?;

// Start the agent runtime
agent.start(params).await?;

// Request actions from actors
let obs = Tensor::::zeros([1, 4], &Default::default());
let ids = agent.get_actor_ids()?;
let actions = agent.request_action(ids, obs, None, 1.0).await?;

// Graceful shutdown
agent.shutdown().await?;
Ok(())
}
```

### 0.5.0-beta Scope

The supported beta path is the local/default client runtime:

- local inference
- actor lifecycle management
- router scaling
- local trajectory writing

The following surfaces remain experimental in `0.5.0-beta`, even when the feature flags are available:

- `zmq-transport`
- `nats-transport`
- server-backed inference or training workflows
- server crates and scaffolding

For more usage details, see the [Framework README](crates/relayrl_framework/README.md) and the [Client Guide](CLIENT_GUIDE.md).

## Framework Roadmap

### Near Term
- **v0.5.x** — Local/default client runtime beta polish, comprehensive testing, transport-backed flows remain experimental
- **v0.6.0** — Training Server for Online client workflows, algorithm integration

### Medium Term
- **v0.7.0** — Inference Server for remote inference capabilities for clients
- **v0.8.0** — Full system integration, performance optimizations, API stabilization

### Long Term
- **v0.9.0 / v1.0.0** — Production stability guarantees
- `relayrl_algorithms` — Complete RL algorithm implementations
- `relayrl_cli` — Language-agnostic deployable gRPC interface

## Contributing

Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) before submitting PRs.

## License

Licensed under [Apache License 2.0](LICENSE).