Skip to main content

OpenAI Gym equivalent for loops — create, run, benchmark, compare, evolve

Project description

LoopGym

Run any loop. Three ways. One API.

Compile LSS 1.0 YAML into executable environments — simulate for CI, call live models for production eval, or replay LoopNet trajectories without spending a token.


CI PyPI License: MIT Python 3.12+ LSS 1.0


pip install loopgym

Quickstart · API docs · PyPI · LoopBench · Observability


The idea in one picture

flowchart TB
  SPEC["Your LSS YAML"]
  MAKE["loopgym.make(env_id)"]

  SIM["SimEnv<br/><i>deterministic · free · CI-safe</i>"]
  LIVE["LiveEnv<br/><i>real models · production eval</i>"]
  REPLAY["ReplayEnv<br/><i>LoopNet trajectories · zero API cost</i>"]

  SPEC --> MAKE
  MAKE --> SIM
  MAKE --> LIVE
  MAKE --> REPLAY

LSS declares the loop. LoopGym runs it. LoopBench scores it. Clean separation — like Gym vs. benchmark suites in reinforcement learning.


Three backends, one line of code

import loopgym as lg

env = lg.make("loopbench/code-repair-v1")
obs = env.reset(task_id="cr-001")

while not env.done:
    action = your_agent.policy(obs)
    obs, reward, done, info = env.step(action)
Backend When to use API keys?
SimEnv CI, local dev, LoopBench v0.1 submissions No
LiveEnv Production eval with real LLMs OPENAI_API_KEY (pluggable)
ReplayEnv Analyze historical runs from LoopNet No

Try it in 60 seconds

pip install loopgym

python -c "
import loopgym as lg
env = lg.make('loopbench/code-repair-v1')
obs = env.reset(task_id='cr-001')
print('task:', obs.task_id, '| step:', obs.step)
"

Full quickstart:

git clone https://github.com/KanakMalpani/LoopGym.git && cd LoopGym
pip install -e ".[dev]"
python examples/quickstart.py
pytest tests/ -q

Validate and reproduce

Ran a replay or SimEnv episode? Follow REPRODUCE.md and post on Discussion #10. Export trajectories via loopnet COMMUNITY-SUBMISSION.


Environments (v0.1)

Env ID Backend Stress-tests
loopbench/code-repair-v1 Sim Verify-driven repair, iteration limits
loopbench/research-synthesis-v1 Sim Multi-step synthesis + rubric
loopbench/multi-agent-debate-v1 Sim Role-separated workers + evaluator
loopbench/composed-swarm-v1 Sim Composed parallel rehearsal (scenario-swarm-rehearsal) — LB-COMP-1
replay/loopnet-v1 Replay Full trajectories from LoopNet v0.2
sim/mock-llm-v1 Sim Generic sandbox for custom LSS specs

Bundled specs under envs/loopbench/ — validated against Loop Core Engineering in CI.


Who this is for

You want to… LoopGym gives you…
Benchmark your loop design Same env IDs LoopBench uses
Test without burning API budget SimEnv + ReplayEnv
Ship production eval pipelines LiveEnv with pluggable backends
Replay production-like runs ReplayEnv + LoopNet corpus
Trace iterations & LES loopotel LTF export

Observability

Trace loop iterations without raw chat logs (LTF 0.1):

pip install loopotel loopgym
python -c "
import loopgym as lg
from loopotel.integrations.loopgym import run_traced_episode
env = lg.make('loopbench/code-repair-v1')
result, trace = run_traced_episode(env, task_id='cr-001', seed=0, enabled=True)
print(result['success'], len(trace['spans']), 'spans')
"

Full stack walkthrough: LoopNet end-to-end tutorial.


Ecosystem

Repo Role
Loop Core Engineering LSS / LES authority
LoopNet Trajectory corpus
LoopGym Runtime (this repo)
LoopBench Public scoreboard
loop-observability LTF traces (loopotel)

Stack map: ECOSYSTEM.md


Citation

@software{loopgym2026,
  title={LoopGym: OpenAI Gym for LSS-Defined Agent Loops},
  author={Malpani, Kanak},
  year={2026},
  url={https://pypi.org/project/loopgym/}
}

MIT · v0.1 · Contributing · Security · Publishing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loopgym-0.1.1.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loopgym-0.1.1-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file loopgym-0.1.1.tar.gz.

File metadata

  • Download URL: loopgym-0.1.1.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for loopgym-0.1.1.tar.gz
Algorithm Hash digest
SHA256 95e5060d4689410246e606ffbd6ad56497bf3f850a7b1dfb0de268a37dab3442
MD5 c78eebbbefeeb4e89bcc3a903631498a
BLAKE2b-256 457dc3ee021a39be7d70ebbb6c139df20c13f560d37103eefe3a5f98dab254c6

See more details on using hashes here.

File details

Details for the file loopgym-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: loopgym-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for loopgym-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d9256016e0545edab097cd7af057a991c12321ec1acfce6495bbe527362a5c4c
MD5 70554efa14348419573cf32b85cd9f30
BLAKE2b-256 df067bdf75e2d3149732ba2dce5e13ea9ebe2805a28faaf12e666aed9429d5fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page