Async Gym Agents
Drop-in asynchronous data collection for Stable Baselines 3 agents.
Known framework callbacks are processed from complete episode batches when their timing permits. Off-policy checkpointing and unrecognized Stable Baselines callbacks retain their normal per-step behavior.
Usage
from functools import partial
import gymnasium as gym
from stable_baselines3 import TD3
from async_gym_agents.agents.async_agent import get_injected_agent
from async_gym_agents.envs.multi_env import IndexableMultiEnv
env = IndexableMultiEnv(
[partial(gym.make, "Pendulum-v1") for _ in range(8)]
)
model = get_injected_agent(TD3)(
"MlpPolicy",
env,
use_mp=False,
max_episodes_in_buffer=8,
)
model.learn(total_timesteps=10)
model.shutdown()
Workers send complete episodes, so on-policy rollouts may exceed n_steps by
the final episode. max_episodes_in_buffer limits buffered episodes across all
workers. queue_put_timeout defaults to None; set a finite timeout to allow
episode drops instead of waiting for buffer capacity.
Episodes are decoded in a background assembler. On-policy agents prepare the next rollout buffer, while off-policy agents prepare one episode ahead and keep replay-buffer insertion on the trainer thread.
On-policy episode packets retain both the environment reward and the time-limit-bootstrapped training reward. Stable Baselines callbacks, batched logging, and pruning receive the environment reward; rollout-buffer returns and advantages use the training reward. Off-policy episodes retain their existing single reward view.
Use get_profiler_report() to inspect trainer, worker, buffer, transport, and
policy statistics. transport.utilization is the current fraction of bounded
episode slots in use. Episode-send backpressure is reported once as
buffer.avg_push_wait_seconds; the buffer section does not contain historical
queue utilization or emptiness estimates.
Metadata
Release files for async-gym-agents 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| async_gym_agents-0.5.0.tar.gz | 33.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_gym_agents-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.3 kB
Release files / async_gym_agents-0.5.0.tar.gz
| Download URL | async_gym_agents-0.5.0.tar.gz |
|---|---|
| Size | 33.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a522da58a4fc90da455d8aa7c0b8fe98bf6afcc8dc734917ef86284412473bbc
|
|
BLAKE2b-256 checksum How to use checksums |
246e0fbb855548aff79def9ae24892488f34db48bc70a46c2cb16e719c4290ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.8 Windows/10
|
Release files / async_gym_agents-0.5.0-py3-none-any.whl
| Download URL | async_gym_agents-0.5.0-py3-none-any.whl |
|---|---|
| Size | 44.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11413942bbbcc56da2300c3bcdd62656b2f7411300e6b99f544ea9fdc0d8dca0
|
|
BLAKE2b-256 checksum How to use checksums |
894dad94de101e34b402801cfdaa24709b94866376d368a4641adbfcc8d16220
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.8 Windows/10
|