OpenAI Gym equivalent for loops — create, run, benchmark, compare, evolve
Project description
LoopGym
OpenAI Gym for self-improving loops.
If LSS is how you declare a loop, LoopGym is how you run it.
LoopGym compiles LSS 1.0 YAML into executable environments — with deterministic simulation for CI, live model backends for production eval, and trajectory replay from LoopNet. One API. Three backends. Zero vendor lock-in on the spec.
import loopgym as lg
env = lg.make("loopbench/code-repair-v1")
obs = env.reset(task_id="cr-001")
while not env.done:
obs, reward, done, info = env.step(agent.action(obs))
Install & run → · API reference · Quickstart script
Why LoopGym
| Problem | LoopGym answer |
|---|---|
| Every benchmark rolls its own runner | Shared loopgym.make(env_id) registry |
| CI can't afford API keys | SimEnv — deterministic, free, fast |
| Production eval needs real models | LiveEnv — pluggable backends |
| Historical analysis burns budget | ReplayEnv — LoopNet trajectories, no LLM calls |
LoopBench defines tasks and scores them; LoopGym executes. Clean separation, like Gym vs. benchmark suites in RL.
Architecture
flowchart TB
LSS[LSS YAML spec]
COMP[LoopGym compiler]
SIM[SimEnv]
LIVE[LiveEnv]
REPLAY[ReplayEnv]
BENCH[LoopBench runner]
LSS --> COMP
COMP --> SIM
COMP --> LIVE
COMP --> REPLAY
SIM --> BENCH
LIVE --> BENCH
REPLAY --> BENCH
⚡ Install & run
One-liner (GitHub):
pip install git+https://github.com/KanakMalpani/LoopGym.git
python -c "import loopgym as lg; env = lg.make('loopbench/code-repair-v1'); print(env.reset(task_id='cr-001'))"
Developer setup:
git clone https://github.com/KanakMalpani/LoopGym.git && cd LoopGym
pip install -e ".[dev]"
python examples/quickstart.py
pytest tests/ -q
PyPI (after first release — PUBLISHING.md):
pip install loopgym
Environments
| Env ID | Backend | Use case |
|---|---|---|
loopbench/code-repair-v1 |
SimEnv | Verify-driven code repair |
loopbench/research-synthesis-v1 |
SimEnv | Research brief synthesis |
loopbench/multi-agent-debate-v1 |
SimEnv | Multi-agent review / debate |
replay/loopnet-v1 |
ReplayEnv | Replay LoopNet trajectories |
sim/mock-llm-v1 |
SimEnv | Generic mock-LLM sandbox |
Bundled LSS specs live under envs/loopbench/. All validated against Loop Core Engineering in CI.
LoopNet replay (optional)
git clone https://github.com/KanakMalpani/loopnet.git ../loopnet
# or: export LOOPNET_SEED_PATH=/path/to/records.jsonl
env = lg.make("replay/loopnet-v1")
env.reset(record_id="ln-00042")
Ecosystem
| Repository | Role |
|---|---|
| Loop Core Engineering | LSS / LES authority |
| LoopNet | Trajectory corpus |
| LoopGym | Runtime (this repo) |
| LoopBench | Benchmark orchestration |
Full stack map: ECOSYSTEM.md
Project layout
| Path | Purpose |
|---|---|
loopgym/ |
Registry, envs, runtime, evaluators |
envs/loopbench/ |
Task fixtures + LSS specs |
docs/api.md |
API reference |
examples/quickstart.py |
Onboarding smoke test |
Citation
@software{loopgym2026,
title={LoopGym: OpenAI Gym for LSS-Defined Agent Loops},
author={Malpani, Kanak},
year={2026},
url={https://github.com/KanakMalpani/LoopGym}
}
MIT · v0.1 · Contributing · Security · PyPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loopgym-0.1.0.tar.gz.
File metadata
- Download URL: loopgym-0.1.0.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0dd9b96de8a1f6ed9183137ce52d1f15b3469fb8ca19d88498954edebf9ea07
|
|
| MD5 |
47c0cd60271936c482bf401195b5f258
|
|
| BLAKE2b-256 |
293ce77a3bc473cb9229d56c2f573187dfd501ab24c4a20b5d6ba5e910b19916
|
File details
Details for the file loopgym-0.1.0-py3-none-any.whl.
File metadata
- Download URL: loopgym-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7bd9e6781c084d91beb6b5ca10c386482bde02465a4ae71c9fcd0d7ec41eead
|
|
| MD5 |
d17d90584d8807eb096f931afb4250db
|
|
| BLAKE2b-256 |
12cb4f9e9ce98b59595aeca2f9211c8b8534c0754443cc41a7682df20e16ec0d
|