These docs describe unreleased changes on main. See the latest release.

Native Languages

Use RLMesh from Rust, C, and C++: what each API offers, how stable it is, and how the pieces fit together.

RLMesh’s primary interface is the Python package. The same runtime is also available natively, for simulators, robot stacks, and inference services that are not written in Python:

Language What you get Status
Rust the rlmesh crate: traits, option structs, Result, sync and async calls Early access · Preview
C rlmesh.h: a C11 ABI with opaque handles and status codes Early access · Experimental
C++ rlmesh.hpp: a header-only C++17 layer with RAII and exceptions Early access · Experimental

Every language can play either role. A C++ simulator can serve an environment that a Python model evaluates, and a Rust model can drive an environment served from Python, C, or C++. The boundary between them is the RLMesh wire protocol, so the two sides never share a process, a build, or a language.

One vocabulary, every language

RLMesh aims to feel familiar whichever language you write in. The nouns and constructs are the same everywhere: an Env you serve with an EnvServer, Spaces and Values for what flows between the two sides, a Model wrapping your policy, run for whole episodes and a Session for driving steps by hand, and RemoteEnv / RemoteModel for endpoints that are already running. Option names, defaults, and error classes carry over too, so what you learn on one page applies on the others.

Each language then follows its own conventions instead of imitating another one, and adds helpers that make sense only there:

Concept Rust C C++
An environment impl Env for MyEnv RLMeshEnvVtable + rlmesh_env_new any class with reset / step and spaces
A policy impl Policy or a closure RLMeshModelVtable + rlmesh_model_new any class with predict, or a lambda
Options structs with Default structs initialized with RLMESH_*_INIT structs with chainable with_* setters
Failure Result<T, rlmesh::Error> RLMeshStatus + rlmesh_last_error_*() exceptions (rlmesh::ValueError, …)
Cleanup Drop, or close() to see errors rlmesh_*_free on every handle you own RAII, or close() to see errors
Timeouts std::time::Duration double seconds with a has_* flag std::chrono::duration<double>
Language extras _async twins, rlmesh::ext rlmesh_ext_*, sized structs rlmesh::ext, std::optional, tuples

Status and stability

The native APIs are early access, and these pages describe the development branch of the RLMesh repository: they are not yet in a tagged release.

  • The Rust crate is Preview. It is intended to become stable; until then a minor release may change it, with a migration note in the changelog.
  • The C and C++ headers are Experimental. The C ABI is versioned by its own generation number, RLMESH_ABI_VERSION (currently 5), which changes only on a binary-incompatible change and is independent of the package version.

See Compatibility for what each stability level promises.

Where to go next

  • Rust: install the crate, serve an environment, and run a model in a few dozen lines.
  • C: build or download the library and follow the handle, status, and ownership rules.
  • C++: include one header and write environments and policies as ordinary classes.
  • The generated references list every item: Rust API, C API, and C++ API.