NetRL Documentation
NetRL is a Python library that wraps Gymnasium environments with realistic communication-channel models. Instead of receiving observations directly, an RL agent or central node receives them through a simulated wireless link — complete with packet loss, propagation delay, retransmissions, and medium contention. The agent sees a sliding-window buffer of past observations rather than the raw current state.
import gymnasium as gym
from netrl import NetworkedEnv, NetworkConfig
env = NetworkedEnv(
gym.make("CartPole-v1"),
NetworkConfig(loss_bad=0.3, delay_steps=2, buffer_size=10),
)
obs, info = env.reset()
# obs["observations"].shape == (10, 4) ← sliding window
# obs["recv_mask"].shape == (10,) ← delivery flags
Get running in five minutes with a single-observer networked environment.
Step-by-step guides for single-observer, multi-view, channel selection, and writing custom channel backends.
Complete class and function reference auto-generated from source.
Architecture overview, ns-3 protocol spec, and troubleshooting.
Channel backends
Backend |
Class |
Description |
|---|---|---|
Gilbert–Elliott (default) |
Two-state Markov loss model, C++ core, no external dependencies. |
|
802.11a WiFi ⚡ (fast) |
Same CSMA/CA physics as below but runs in-process via a pybind11
C++ extension — no subprocess, no pipe IPC. Built automatically by
|
|
802.11a WiFi |
CSMA/CA MAC, log-distance path loss, via ns-3 subprocess. |
|
5G mmWave |
28 GHz mmWave EPC (3GPP TR 38.901), via ns-3-mmwave subprocess. |
|
5G NR (5G-LENA) |
NR with configurable numerology and beamforming, via 5G-LENA. |
|
Multi-UE WiFi |
N UEs sharing one 802.11a infrastructure BSS; realistic contention. |
Contents
Getting Started
Guides
API Reference
Reference