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.
Release files for async-gym-agents 0.4.1
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.4.1.tar.gz | 33.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_gym_agents-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.6 kB
Release files / async_gym_agents-0.4.1.tar.gz
| Download URL | async_gym_agents-0.4.1.tar.gz |
|---|---|
| Size | 33.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
970c866320c9d881e9c359545b1895b5e51b848734511d19819264953825c818
|
|
BLAKE2b-256 checksum How to use checksums |
f593554e4b27e682325bc6e6acae02ec473085c585b37dea14f7f6681cd8f8d9
|
| 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.4.1-py3-none-any.whl
| Download URL | async_gym_agents-0.4.1-py3-none-any.whl |
|---|---|
| Size | 44.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1a90df5b60af54244222fc3fae6c1ace7fd346c266affbd1862ebfaf14d9413
|
|
BLAKE2b-256 checksum How to use checksums |
a248f1a2a96aab6515c9b8b9c4989c8fb16d5e4b8e60ae0e3ba3fa170044b3f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.8 Windows/10
|