Skip to main content

EntityGym for Rust

Crates.io PyPI MIT/Apache 2.0 Discord Docs Actions Status

EntityGym is a Python library that defines a novel entity-based abstraction for reinforcement learning environments which enables highly ergonomic and efficient training of deep reinforcement learning agents. This crate provides bindings that allows Rust programs to be used as EntityGym training environments, and to load and run neural networks agents trained with Entity Neural Network Trainer natively in pure Rust applications.

Overview

The core abstraction in entity-gym-rs is the Agent trait. It defines a high-level API for neural network agents which allows them to directly interact with Rust data structures. To use any of the Agent implementations provided by entity-gym-rs, you just need to derive the Action and Featurizable traits, which define what information the agent can observe and what actions it can take:

  • The Action trait allows a Rust type to be returned as an action by an Agent. This trait can be derived automatically for enums with only unit variants.
  • The Featurizable trait converts objects into a format that can be processed by neural networks. It can be derived for most fixed-size structs, and for enums with unit variants. Agents can observe collections containing any number of Featurizable objects.

Example

Basic example that demonstrates how to construct an observation and sample a random action from an Agent:

use entity_gym_rs::agent::{Agent, AgentOps, Obs, Action, Featurizable};

#[derive(Action, Debug)]
enum Move { Up, Down, Left, Right }

#[derive(Featurizable)]
struct Player { x: i32, y: i32 }

#[derive(Featurizable)]
struct Cake {
    x: i32,
    y: i32,
    size: u32,
}

fn main() {
    // Creates an agent that acts completely randomly.
    let mut agent = Agent::random();
    // Alternatively, load a trained neural network agent from a checkpoint.
    // let mut agent = Agent::load("agent");

    // Construct an observation with one `Player` entity and two `Cake entities.
    let obs = Obs::new(0.0)
        .entities([Player { x: 0, y: 0 }])
        .entities([
            Cake { x: 4, y: 0, size: 4 },
            Cake { x: 10, y: 42, size: 12 },
        ]);
    
    // To obtain an action from an agent, we simple call the `act` method
    // with the observation we constructed.
    let action = agent.act::<Move>(obs);
    println!("{:?}", action);
}

For a more complete example that includes training a neural network to play Snake, see examples/bevy_snake.

Docs

Release files for entity-gym-rs 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for entity-gym-rs 0.8.0
File Size Uploaded
entity_gym_rs-0.8.0.tar.gz 52.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for entity-gym-rs 0.8.0
File
entity_gym_rs-0.8.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl PyPy 3.9 PyPy 3.9 7.3 Linux glibc 2.17+ x86-64 Details
entity_gym_rs-0.8.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl PyPy 3.8 PyPy 3.8 7.3 Linux glibc 2.17+ x86-64 Details
entity_gym_rs-0.8.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl PyPy 3.7 PyPy 3.7 7.3 Linux glibc 2.17+ x86-64 Details
entity_gym_rs-0.8.0-cp311-none-win_amd64.whl CPython 3.11 none Windows x86-64 Details
entity_gym_rs-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
entity_gym_rs-0.8.0-cp311-cp311-macosx_10_7_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.7+ x86-64 Details
entity_gym_rs-0.8.0-cp310-none-win_amd64.whl CPython 3.10 none Windows x86-64 Details
entity_gym_rs-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
entity_gym_rs-0.8.0-cp310-cp310-macosx_10_7_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.7+ x86-64 Details
entity_gym_rs-0.8.0-cp39-none-win_amd64.whl CPython 3.9 none Windows x86-64 Details
entity_gym_rs-0.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
entity_gym_rs-0.8.0-cp39-cp39-macosx_10_7_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.7+ x86-64 Details
entity_gym_rs-0.8.0-cp38-none-win_amd64.whl CPython 3.8 none Windows x86-64 Details
entity_gym_rs-0.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
entity_gym_rs-0.8.0-cp38-cp38-macosx_10_7_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.7+ x86-64 Details
entity_gym_rs-0.8.0-cp37-none-win_amd64.whl CPython 3.7 none Windows x86-64 Details
entity_gym_rs-0.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
entity_gym_rs-0.8.0-cp37-cp37m-macosx_10_7_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 Details

Total release size: 7.5 MB

Release files / entity_gym_rs-0.8.0.tar.gz

Download URL entity_gym_rs-0.8.0.tar.gz
Size 52.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e5d6d95c286e078ac34427886b7c79926e75907c586444d3b0063c361d10667f
BLAKE2b-256 checksum
How to use checksums
f0fe6cf356a563a4f58eac180e92d2e43a0795d552f84c0170951e9670ace78a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL entity_gym_rs-0.8.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 448.0 kB
Tags Linux glibc 2.17+ x86-64 PyPy 3.9 PyPy 3.9 7.3
SHA-256 checksum
How to use checksums
4e6e9d31fdafda135dee05677346aa7dfd882c310e4f4240f575adeff4cf0aa4
BLAKE2b-256 checksum
How to use checksums
e5b8e38e310f2eb9263ef42a2266a54a237b4144b7c77d001cfa77079a238835
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL entity_gym_rs-0.8.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 448.3 kB
Tags Linux glibc 2.17+ x86-64 PyPy 3.8 PyPy 3.8 7.3
SHA-256 checksum
How to use checksums
f9d2b8db3b526db28fc540e0ab107b4a9bd667c07ff6af7cc158dd826aa9cb3a
BLAKE2b-256 checksum
How to use checksums
fc0b7979d0ee5b6907ae8ade5b0fd239527820818b9c1a2bfd91b2b88d1ecf5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL entity_gym_rs-0.8.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 452.2 kB
Tags Linux glibc 2.17+ x86-64 PyPy 3.7 PyPy 3.7 7.3
SHA-256 checksum
How to use checksums
43e35e71611b79ad7ed049cb4be0af7334bcb1d644e7220b7decdbd335d36bfa
BLAKE2b-256 checksum
How to use checksums
619e262dd1722d67810efffeb4bdc2fc91c801a305507a13800cfeb8468d9787
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp311-none-win_amd64.whl

Download URL entity_gym_rs-0.8.0-cp311-none-win_amd64.whl
Size 366.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
1a217322199ca13cf666e5b2d8b364eeda73cfe7e0b0129827afa957a5645fc0
BLAKE2b-256 checksum
How to use checksums
2bef3db210ba309d9edfd87a41e2a5b5f2aa3cff65355131f324c909c72719e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL entity_gym_rs-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 445.3 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f1d9c01788f5aacd2619ac0991e0ce0767b8915d842901e695cf808ccd1aff18
BLAKE2b-256 checksum
How to use checksums
50efece34666cdf4873690ab167c2f9da2e0ca1e6b89f9de947f8e48eda10bbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp311-cp311-macosx_10_7_x86_64.whl

Download URL entity_gym_rs-0.8.0-cp311-cp311-macosx_10_7_x86_64.whl
Size 407.0 kB
Tags CPython 3.11 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
156ab58cd68702a169706e988fcd109ec1f6a65e82b5e010d03b29b267cdf87c
BLAKE2b-256 checksum
How to use checksums
5987c32f66d5241e1db43b39a58180fefd4eac70421179f2de5ae13dc495b7a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp310-none-win_amd64.whl

Download URL entity_gym_rs-0.8.0-cp310-none-win_amd64.whl
Size 366.9 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
99454e3c836d7667be267332b0a6af5bb6029dd2b5687b6558d8915058414893
BLAKE2b-256 checksum
How to use checksums
ac4c7f2dc73ca034ee22cd93760913321996dac3709b012e0d00e6f98196a562
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL entity_gym_rs-0.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 445.3 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b1ba1d604bdeebef70e26deb482f2c6495a1ff99c9f6acad24f043aaa21ff83d
BLAKE2b-256 checksum
How to use checksums
6a210cff6b6818c8e78e322f5df1a12ab254f2e59d79ac3da4ed8e70261b2138
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp310-cp310-macosx_10_7_x86_64.whl

Download URL entity_gym_rs-0.8.0-cp310-cp310-macosx_10_7_x86_64.whl
Size 407.0 kB
Tags CPython 3.10 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
07a3e5d5f77d6381c8ad41aa0fe5e04da7a0f296532c59429bef8ab1e5453058
BLAKE2b-256 checksum
How to use checksums
3763fb7c002c51ee3184373a76dc84e3b7e31c6b1cd3e12ca172b0b863dc7e56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp39-none-win_amd64.whl

Download URL entity_gym_rs-0.8.0-cp39-none-win_amd64.whl
Size 366.9 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
3035cb090492560b1a1dc59bf7888c4627b2dd8554865a682651cf01332cf42a
BLAKE2b-256 checksum
How to use checksums
8e20f514f27062a50bc2687b9f47d9697b5472b37ef99849f88da50e37ef707d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL entity_gym_rs-0.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 445.7 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
24a95806e1fb6e314600e09edcf3009b2e56ccf2c8cb2494f1c89144db97528e
BLAKE2b-256 checksum
How to use checksums
8d6cbcc073ccca6101a961a84b09787c93abc0bc75c2964b7c92104b4c38925b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp39-cp39-macosx_10_7_x86_64.whl

Download URL entity_gym_rs-0.8.0-cp39-cp39-macosx_10_7_x86_64.whl
Size 407.0 kB
Tags CPython 3.9 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
ee384eaddf8007fee8f2a23f7600ac52f5624a39cce8970bb4b591b970cfd75e
BLAKE2b-256 checksum
How to use checksums
a49aa2816952d22d822de4d409d64f8c244a06bf3cb3162fc02f9a8b4c04a18e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp38-none-win_amd64.whl

Download URL entity_gym_rs-0.8.0-cp38-none-win_amd64.whl
Size 366.5 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
19f9f53c4ee350a40d326392cdf79a218613a065736f17e063fb9578616ab796
BLAKE2b-256 checksum
How to use checksums
5d0fc3f2c511cb4087d032de36d0ce6e7613a1f54e7632eb650e5c6b720878ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL entity_gym_rs-0.8.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 445.1 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
dd6819dca7007295f46c1dc99f5644abb2ba52d204ad81ef34c9ebcebb56138e
BLAKE2b-256 checksum
How to use checksums
90ca52dd31f354367860a0119420239863a541d9738cc142e63acbfb1b16bf7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp38-cp38-macosx_10_7_x86_64.whl

Download URL entity_gym_rs-0.8.0-cp38-cp38-macosx_10_7_x86_64.whl
Size 407.2 kB
Tags CPython 3.8 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
3f325cf64169ea85e3b3b3e2666526ee22078dd4f40da6967ca398ecfd81765f
BLAKE2b-256 checksum
How to use checksums
8ddf78c9621e2d5c3ab14dde923bdd7d3e67ec60c90708670999c242588ed91e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp37-none-win_amd64.whl

Download URL entity_gym_rs-0.8.0-cp37-none-win_amd64.whl
Size 366.4 kB
Tags CPython 3.7 Windows x86-64
SHA-256 checksum
How to use checksums
956c9a07427427a377e6ad4f344f9915638155cf64e6cdb337d3f3127d1dafc3
BLAKE2b-256 checksum
How to use checksums
d2e9fed70a3481f54e023069ecaad83976aa7505a72d8032b22c77419ad8fef7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL entity_gym_rs-0.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 445.4 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
18d8252861aaf38fc8b4fb030eee9090773b6aa8959cfae72c8cbb31a1e0127c
BLAKE2b-256 checksum
How to use checksums
5eac1a0185a516001e8b291ff4528b9e3a26843edab62a556fd3cf171ee40ef0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release files / entity_gym_rs-0.8.0-cp37-cp37m-macosx_10_7_x86_64.whl

Download URL entity_gym_rs-0.8.0-cp37-cp37m-macosx_10_7_x86_64.whl
Size 407.4 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
ac9a06b2ba2b956e7d34a043957432966812d1698665728be9630f6108fdad30
BLAKE2b-256 checksum
How to use checksums
8ed63a4492fc61e0873374a786577cd38c0b42850e430d1d528384962e3f5348
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/0.13.7

Release history Release notifications | RSS feed

This release

0.8.0 This release

19 release files

0.7.0

17 release files

0.5.0

17 release files

0.4.4

17 release files

0.4.3

14 release files

0.4.2

14 release files

0.4.1

14 release files

0.4.0

14 release files

0.3.6

14 release files

0.3.5

14 release files

0.3.4

14 release files

0.3.3

14 release files

0.3.1

14 release files

0.3.0

14 release files

0.2.0

14 release files

0.1.3

14 release files

0.1.2

4 release files

0.1.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page