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.3.tar.gz (38.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.3-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: loopgym-0.1.3.tar.gz
  • Upload date:
  • Size: 38.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.3.tar.gz
Algorithm Hash digest
SHA256 53fb9c596e7350fbe15fdaf1387a1eb005ed3050df0775aecb405935f7e7d9e4
MD5 bcd727721a8378e56bda6b250343d2c2
BLAKE2b-256 2c982018efc65617753f0a8c6166963daec2bab74df17a6a944065ae0874b9de

See more details on using hashes here.

File details

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

File metadata

  • Download URL: loopgym-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 36.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 25150413f738811f373244fd9bd97769ceebae7c886a226ed2c5eb09beb37257
MD5 ecc87f54704c671e2803a634180427bd
BLAKE2b-256 29bf94c225bf7a19f06019b382d394160fedbb724e905444ca2e58ce4714e75c

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