loopgym 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- loopgym-0.1.0/.github/workflows/publish.yml +33 -0
- loopgym-0.1.0/.github/workflows/test.yml +39 -0
- loopgym-0.1.0/.gitignore +16 -0
- loopgym-0.1.0/CONTRIBUTING.md +28 -0
- loopgym-0.1.0/LICENSE +21 -0
- loopgym-0.1.0/PKG-INFO +188 -0
- loopgym-0.1.0/PLAN.md +62 -0
- loopgym-0.1.0/PUBLISHING.md +43 -0
- loopgym-0.1.0/README.md +165 -0
- loopgym-0.1.0/SECURITY.md +15 -0
- loopgym-0.1.0/STATUS.md +29 -0
- loopgym-0.1.0/SYNC.md +35 -0
- loopgym-0.1.0/docs/api.md +160 -0
- loopgym-0.1.0/envs/loopbench/code-repair-v1/spec.yaml +128 -0
- loopgym-0.1.0/envs/loopbench/code-repair-v1/tasks.json +29 -0
- loopgym-0.1.0/envs/loopbench/multi-agent-debate-v1/spec.yaml +138 -0
- loopgym-0.1.0/envs/loopbench/multi-agent-debate-v1/tasks.json +29 -0
- loopgym-0.1.0/envs/loopbench/research-synthesis-v1/spec.yaml +133 -0
- loopgym-0.1.0/envs/loopbench/research-synthesis-v1/tasks.json +29 -0
- loopgym-0.1.0/examples/minimal-loop.yaml +156 -0
- loopgym-0.1.0/examples/quickstart.py +53 -0
- loopgym-0.1.0/loopgym/__init__.py +7 -0
- loopgym-0.1.0/loopgym/cli.py +47 -0
- loopgym-0.1.0/loopgym/envs/__init__.py +8 -0
- loopgym-0.1.0/loopgym/envs/base.py +63 -0
- loopgym-0.1.0/loopgym/envs/live.py +80 -0
- loopgym-0.1.0/loopgym/envs/replay.py +197 -0
- loopgym-0.1.0/loopgym/envs/sim.py +183 -0
- loopgym-0.1.0/loopgym/evaluators/__init__.py +6 -0
- loopgym-0.1.0/loopgym/evaluators/deterministic.py +41 -0
- loopgym-0.1.0/loopgym/evaluators/rubric.py +45 -0
- loopgym-0.1.0/loopgym/registry.py +122 -0
- loopgym-0.1.0/loopgym/runtime/__init__.py +19 -0
- loopgym-0.1.0/loopgym/runtime/compiler.py +100 -0
- loopgym-0.1.0/loopgym/runtime/loop_runtime.py +292 -0
- loopgym-0.1.0/pyproject.toml +48 -0
- loopgym-0.1.0/scripts/prepare-commit-msg +7 -0
- loopgym-0.1.0/tests/test_sim_env.py +89 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
|
|
21
|
+
- name: Install build tools
|
|
22
|
+
run: pip install hatchling build
|
|
23
|
+
|
|
24
|
+
- name: Build package
|
|
25
|
+
run: python -m build
|
|
26
|
+
|
|
27
|
+
# Uses PYPI_API_TOKEN when set; otherwise OIDC trusted publishing.
|
|
28
|
+
- name: Publish to PyPI
|
|
29
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
30
|
+
with:
|
|
31
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
32
|
+
skip-existing: true
|
|
33
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: test-loopgym
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
repository: KanakMalpani/Loop-Core-Engineering
|
|
18
|
+
path: deps/loop-core
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
|
|
24
|
+
- name: Install loopgym
|
|
25
|
+
run: pip install -e ".[dev]"
|
|
26
|
+
|
|
27
|
+
- name: Validate bundled LSS specs (Loop Core Engineering)
|
|
28
|
+
run: |
|
|
29
|
+
pip install jsonschema pyyaml
|
|
30
|
+
CORE="deps/loop-core"
|
|
31
|
+
for spec in envs/loopbench/*/spec.yaml examples/minimal-loop.yaml; do
|
|
32
|
+
python "$CORE/tools/validate_lss.py" "$spec" --schema "$CORE/specs/lss-1.0.schema.json"
|
|
33
|
+
done
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
run: pytest tests/ -q
|
|
37
|
+
|
|
38
|
+
- name: Quickstart smoke test
|
|
39
|
+
run: python examples/quickstart.py
|
loopgym-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Contributing to LoopGym
|
|
2
|
+
|
|
3
|
+
## What belongs here
|
|
4
|
+
|
|
5
|
+
- Environment implementations (SimEnv, LiveEnv, ReplayEnv)
|
|
6
|
+
- LSS compiler / loop runtime
|
|
7
|
+
- Env registry and bundled LoopBench env fixtures
|
|
8
|
+
- Evaluators and CLI
|
|
9
|
+
|
|
10
|
+
## What does not belong here
|
|
11
|
+
|
|
12
|
+
- LSS schema changes — [Loop Core Engineering](https://github.com/KanakMalpani/Loop-Core-Engineering)
|
|
13
|
+
- Benchmark task definitions / LES scoring — [LoopBench](https://github.com/KanakMalpani/LoopBench)
|
|
14
|
+
- Dataset records — [LoopNet](https://github.com/KanakMalpani/loopnet)
|
|
15
|
+
|
|
16
|
+
## Before opening a PR
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install -e ".[dev]"
|
|
20
|
+
pytest tests/ -q
|
|
21
|
+
python examples/quickstart.py
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
CI validates bundled LSS specs against [Loop Core Engineering](https://github.com/KanakMalpani/Loop-Core-Engineering).
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
MIT — see [LICENSE](LICENSE).
|
loopgym-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 KanakMalpani
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
loopgym-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: loopgym
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: OpenAI Gym equivalent for loops — create, run, benchmark, compare, evolve
|
|
5
|
+
Project-URL: Homepage, https://github.com/KanakMalpani/LoopGym
|
|
6
|
+
Project-URL: Repository, https://github.com/KanakMalpani/LoopGym
|
|
7
|
+
Project-URL: Issues, https://github.com/KanakMalpani/LoopGym/issues
|
|
8
|
+
Project-URL: Documentation, https://github.com/KanakMalpani/LoopGym/blob/main/docs/api.md
|
|
9
|
+
Project-URL: Loop Core Engineering, https://github.com/KanakMalpani/Loop-Core-Engineering
|
|
10
|
+
Author: Kanak Malpani
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agents,loop-engineering,loopgym,reinforcement-learning
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Requires-Dist: pyyaml>=6.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
21
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<strong>LoopGym</strong><br>
|
|
26
|
+
<em>OpenAI Gym for self-improving loops.</em>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<p align="center">
|
|
30
|
+
<a href="https://github.com/KanakMalpani/LoopGym/actions/workflows/test.yml"><img src="https://github.com/KanakMalpani/LoopGym/actions/workflows/test.yml/badge.svg" alt="CI"></a>
|
|
31
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="MIT"></a>
|
|
32
|
+
<img src="https://img.shields.io/badge/python-3.12+-blue.svg" alt="Python 3.12+">
|
|
33
|
+
<a href="https://github.com/KanakMalpani/Loop-Core-Engineering"><img src="https://img.shields.io/badge/LSS-1.0.0-green.svg" alt="LSS 1.0"></a>
|
|
34
|
+
<img src="https://img.shields.io/badge/envs-5-blue.svg" alt="5 environments">
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
If **LSS** is how you *declare* a loop, **LoopGym** is how you *run* it.
|
|
40
|
+
|
|
41
|
+
LoopGym compiles [LSS 1.0](https://github.com/KanakMalpani/Loop-Core-Engineering) YAML into executable environments — with deterministic simulation for CI, live model backends for production eval, and trajectory replay from [LoopNet](https://github.com/KanakMalpani/loopnet). One API. Three backends. Zero vendor lock-in on the spec.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import loopgym as lg
|
|
45
|
+
|
|
46
|
+
env = lg.make("loopbench/code-repair-v1")
|
|
47
|
+
obs = env.reset(task_id="cr-001")
|
|
48
|
+
while not env.done:
|
|
49
|
+
obs, reward, done, info = env.step(agent.action(obs))
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
<p align="center">
|
|
53
|
+
<a href="#-install--run"><strong>Install & run →</strong></a> ·
|
|
54
|
+
<a href="docs/api.md">API reference</a> ·
|
|
55
|
+
<a href="examples/quickstart.py">Quickstart script</a>
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Why LoopGym
|
|
61
|
+
|
|
62
|
+
| Problem | LoopGym answer |
|
|
63
|
+
|---------|----------------|
|
|
64
|
+
| Every benchmark rolls its own runner | Shared `loopgym.make(env_id)` registry |
|
|
65
|
+
| CI can't afford API keys | **SimEnv** — deterministic, free, fast |
|
|
66
|
+
| Production eval needs real models | **LiveEnv** — pluggable backends |
|
|
67
|
+
| Historical analysis burns budget | **ReplayEnv** — LoopNet trajectories, no LLM calls |
|
|
68
|
+
|
|
69
|
+
[LoopBench](https://github.com/KanakMalpani/LoopBench) defines tasks and scores them; LoopGym executes. Clean separation, like Gym vs. benchmark suites in RL.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Architecture
|
|
74
|
+
|
|
75
|
+
```mermaid
|
|
76
|
+
flowchart TB
|
|
77
|
+
LSS[LSS YAML spec]
|
|
78
|
+
COMP[LoopGym compiler]
|
|
79
|
+
SIM[SimEnv]
|
|
80
|
+
LIVE[LiveEnv]
|
|
81
|
+
REPLAY[ReplayEnv]
|
|
82
|
+
BENCH[LoopBench runner]
|
|
83
|
+
|
|
84
|
+
LSS --> COMP
|
|
85
|
+
COMP --> SIM
|
|
86
|
+
COMP --> LIVE
|
|
87
|
+
COMP --> REPLAY
|
|
88
|
+
SIM --> BENCH
|
|
89
|
+
LIVE --> BENCH
|
|
90
|
+
REPLAY --> BENCH
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## ⚡ Install & run
|
|
96
|
+
|
|
97
|
+
**One-liner (GitHub):**
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install git+https://github.com/KanakMalpani/LoopGym.git
|
|
101
|
+
python -c "import loopgym as lg; env = lg.make('loopbench/code-repair-v1'); print(env.reset(task_id='cr-001'))"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Developer setup:**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
git clone https://github.com/KanakMalpani/LoopGym.git && cd LoopGym
|
|
108
|
+
pip install -e ".[dev]"
|
|
109
|
+
python examples/quickstart.py
|
|
110
|
+
pytest tests/ -q
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**PyPI** (after first release — [PUBLISHING.md](PUBLISHING.md)):
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pip install loopgym
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Environments
|
|
122
|
+
|
|
123
|
+
| Env ID | Backend | Use case |
|
|
124
|
+
|--------|---------|----------|
|
|
125
|
+
| `loopbench/code-repair-v1` | SimEnv | Verify-driven code repair |
|
|
126
|
+
| `loopbench/research-synthesis-v1` | SimEnv | Research brief synthesis |
|
|
127
|
+
| `loopbench/multi-agent-debate-v1` | SimEnv | Multi-agent review / debate |
|
|
128
|
+
| `replay/loopnet-v1` | ReplayEnv | Replay [LoopNet](https://github.com/KanakMalpani/loopnet) trajectories |
|
|
129
|
+
| `sim/mock-llm-v1` | SimEnv | Generic mock-LLM sandbox |
|
|
130
|
+
|
|
131
|
+
Bundled LSS specs live under [`envs/loopbench/`](envs/loopbench/). All validated against [Loop Core Engineering](https://github.com/KanakMalpani/Loop-Core-Engineering) in CI.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## LoopNet replay (optional)
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
git clone https://github.com/KanakMalpani/loopnet.git ../loopnet
|
|
139
|
+
# or: export LOOPNET_SEED_PATH=/path/to/records.jsonl
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
env = lg.make("replay/loopnet-v1")
|
|
144
|
+
env.reset(record_id="ln-00042")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Ecosystem
|
|
150
|
+
|
|
151
|
+
| Repository | Role |
|
|
152
|
+
|------------|------|
|
|
153
|
+
| [Loop Core Engineering](https://github.com/KanakMalpani/Loop-Core-Engineering) | LSS / LES authority |
|
|
154
|
+
| [LoopNet](https://github.com/KanakMalpani/loopnet) | Trajectory corpus |
|
|
155
|
+
| **LoopGym** | Runtime (this repo) |
|
|
156
|
+
| [LoopBench](https://github.com/KanakMalpani/LoopBench) | Benchmark orchestration |
|
|
157
|
+
|
|
158
|
+
Full stack map: [ECOSYSTEM.md](https://github.com/KanakMalpani/Loop-Core-Engineering/blob/main/ECOSYSTEM.md)
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Project layout
|
|
163
|
+
|
|
164
|
+
| Path | Purpose |
|
|
165
|
+
|------|---------|
|
|
166
|
+
| [`loopgym/`](loopgym/) | Registry, envs, runtime, evaluators |
|
|
167
|
+
| [`envs/loopbench/`](envs/loopbench/) | Task fixtures + LSS specs |
|
|
168
|
+
| [`docs/api.md`](docs/api.md) | API reference |
|
|
169
|
+
| [`examples/quickstart.py`](examples/quickstart.py) | Onboarding smoke test |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Citation
|
|
174
|
+
|
|
175
|
+
```bibtex
|
|
176
|
+
@software{loopgym2026,
|
|
177
|
+
title={LoopGym: OpenAI Gym for LSS-Defined Agent Loops},
|
|
178
|
+
author={Malpani, Kanak},
|
|
179
|
+
year={2026},
|
|
180
|
+
url={https://github.com/KanakMalpani/LoopGym}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
<p align="center">
|
|
187
|
+
<sub>MIT · v0.1 · <a href="CONTRIBUTING.md">Contributing</a> · <a href="SECURITY.md">Security</a> · <a href="PUBLISHING.md">PyPI</a></sub>
|
|
188
|
+
</p>
|
loopgym-0.1.0/PLAN.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# 05 — loopgym
|
|
2
|
+
|
|
3
|
+
## One-line purpose
|
|
4
|
+
|
|
5
|
+
**LoopGym** — OpenAI Gym equivalent for loops: create, run, benchmark, compare, evolve, visualize.
|
|
6
|
+
|
|
7
|
+
## Why this repo exists
|
|
8
|
+
|
|
9
|
+
Adoption follows **runnable code**. LoopGym is the reference runtime that compiles LSS → executable loop environments.
|
|
10
|
+
|
|
11
|
+
## Scope (in scope)
|
|
12
|
+
|
|
13
|
+
- `loopgym.make(env_id)` API
|
|
14
|
+
- Env backends:
|
|
15
|
+
- **SimEnv** — mock LLM + mock oracles (no API keys)
|
|
16
|
+
- **ReplayEnv** — replay LoopNet trajectories
|
|
17
|
+
- **LiveEnv** — real LLM APIs (optional, user keys)
|
|
18
|
+
- LSS compiler → runtime graph
|
|
19
|
+
- Evaluator plugins (command, rubric, deterministic)
|
|
20
|
+
- Evolution module (optional v0.2): mutate LSS hyperparams
|
|
21
|
+
- Integration hooks for LangGraph, generic Python
|
|
22
|
+
|
|
23
|
+
## Scope (out of scope)
|
|
24
|
+
|
|
25
|
+
- Official leaderboard hosting → `06-loopbench`
|
|
26
|
+
- Dataset curation → `04-loopnet`
|
|
27
|
+
|
|
28
|
+
## Deliverables v0.1
|
|
29
|
+
|
|
30
|
+
- [x] `loopgym/` Python package
|
|
31
|
+
- [x] `envs/loopbench/` stub envs (3 tasks)
|
|
32
|
+
- [x] `examples/quickstart.py`
|
|
33
|
+
- [x] `docs/api.md`
|
|
34
|
+
- [ ] PyPI publish workflow (optional)
|
|
35
|
+
|
|
36
|
+
## API sketch
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import loopgym as lg
|
|
40
|
+
|
|
41
|
+
env = lg.make("loopbench/code-repair-v1", spec_path="my-loop.yaml")
|
|
42
|
+
obs = env.reset(task_id="cr-001")
|
|
43
|
+
while not env.done:
|
|
44
|
+
obs, reward, done, info = env.step(agent.action(obs))
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Dependencies
|
|
48
|
+
|
|
49
|
+
- **01-loop-engineering-core** — LSS schema
|
|
50
|
+
- **04-loopnet** — ReplayEnv data (optional v0.1)
|
|
51
|
+
|
|
52
|
+
## Success criteria
|
|
53
|
+
|
|
54
|
+
`quickstart.py` runs with MockLLM; same LSS runs on 3 seeds with reproducible trajectories in SimEnv.
|
|
55
|
+
|
|
56
|
+
## Agent instructions
|
|
57
|
+
|
|
58
|
+
Extract and generalize `implementations/generic/loop_runtime.py` from `Loop Engineering` repo; don't fork forever — migrate to this repo as canonical runtime.
|
|
59
|
+
|
|
60
|
+
## Status
|
|
61
|
+
|
|
62
|
+
✅ v0.1 shipped (2026-06-13)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Publishing LoopGym to PyPI
|
|
2
|
+
|
|
3
|
+
## One-time setup
|
|
4
|
+
|
|
5
|
+
1. Create a project at [pypi.org](https://pypi.org/) named **`loopgym`** (register the name before first publish).
|
|
6
|
+
2. **Preferred:** configure [trusted publishing](https://docs.pypi.org/trusted-publishers/) on the PyPI project:
|
|
7
|
+
- **PyPI project name:** `loopgym`
|
|
8
|
+
- **Owner:** `KanakMalpani`
|
|
9
|
+
- **Repository name:** `LoopGym`
|
|
10
|
+
- **Workflow name:** `publish.yml`
|
|
11
|
+
- **Environment name:** *(leave blank)*
|
|
12
|
+
|
|
13
|
+
Linking GitHub under your PyPI account is not enough — each project needs its own trusted publisher entry.
|
|
14
|
+
|
|
15
|
+
3. **Fallback:** add **`PYPI_API_TOKEN`** (upload scope) to Settings → Secrets → Actions on this repo.
|
|
16
|
+
|
|
17
|
+
## Publish
|
|
18
|
+
|
|
19
|
+
Create a GitHub Release (tag `v0.1.0` → publishes `0.1.0`):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git tag v0.1.0
|
|
23
|
+
git push origin v0.1.0
|
|
24
|
+
gh release create v0.1.0 --title "v0.1.0" --notes "Initial public release"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or run **Actions → Publish to PyPI → Run workflow** manually.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install loopgym
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Verify locally before release
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install build
|
|
39
|
+
python -m build
|
|
40
|
+
pip install dist/loopgym-*.whl
|
|
41
|
+
loopgym --help
|
|
42
|
+
pytest tests/ -q
|
|
43
|
+
```
|
loopgym-0.1.0/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<strong>LoopGym</strong><br>
|
|
3
|
+
<em>OpenAI Gym for self-improving loops.</em>
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://github.com/KanakMalpani/LoopGym/actions/workflows/test.yml"><img src="https://github.com/KanakMalpani/LoopGym/actions/workflows/test.yml/badge.svg" alt="CI"></a>
|
|
8
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="MIT"></a>
|
|
9
|
+
<img src="https://img.shields.io/badge/python-3.12+-blue.svg" alt="Python 3.12+">
|
|
10
|
+
<a href="https://github.com/KanakMalpani/Loop-Core-Engineering"><img src="https://img.shields.io/badge/LSS-1.0.0-green.svg" alt="LSS 1.0"></a>
|
|
11
|
+
<img src="https://img.shields.io/badge/envs-5-blue.svg" alt="5 environments">
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
If **LSS** is how you *declare* a loop, **LoopGym** is how you *run* it.
|
|
17
|
+
|
|
18
|
+
LoopGym compiles [LSS 1.0](https://github.com/KanakMalpani/Loop-Core-Engineering) YAML into executable environments — with deterministic simulation for CI, live model backends for production eval, and trajectory replay from [LoopNet](https://github.com/KanakMalpani/loopnet). One API. Three backends. Zero vendor lock-in on the spec.
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
import loopgym as lg
|
|
22
|
+
|
|
23
|
+
env = lg.make("loopbench/code-repair-v1")
|
|
24
|
+
obs = env.reset(task_id="cr-001")
|
|
25
|
+
while not env.done:
|
|
26
|
+
obs, reward, done, info = env.step(agent.action(obs))
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
<p align="center">
|
|
30
|
+
<a href="#-install--run"><strong>Install & run →</strong></a> ·
|
|
31
|
+
<a href="docs/api.md">API reference</a> ·
|
|
32
|
+
<a href="examples/quickstart.py">Quickstart script</a>
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Why LoopGym
|
|
38
|
+
|
|
39
|
+
| Problem | LoopGym answer |
|
|
40
|
+
|---------|----------------|
|
|
41
|
+
| Every benchmark rolls its own runner | Shared `loopgym.make(env_id)` registry |
|
|
42
|
+
| CI can't afford API keys | **SimEnv** — deterministic, free, fast |
|
|
43
|
+
| Production eval needs real models | **LiveEnv** — pluggable backends |
|
|
44
|
+
| Historical analysis burns budget | **ReplayEnv** — LoopNet trajectories, no LLM calls |
|
|
45
|
+
|
|
46
|
+
[LoopBench](https://github.com/KanakMalpani/LoopBench) defines tasks and scores them; LoopGym executes. Clean separation, like Gym vs. benchmark suites in RL.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Architecture
|
|
51
|
+
|
|
52
|
+
```mermaid
|
|
53
|
+
flowchart TB
|
|
54
|
+
LSS[LSS YAML spec]
|
|
55
|
+
COMP[LoopGym compiler]
|
|
56
|
+
SIM[SimEnv]
|
|
57
|
+
LIVE[LiveEnv]
|
|
58
|
+
REPLAY[ReplayEnv]
|
|
59
|
+
BENCH[LoopBench runner]
|
|
60
|
+
|
|
61
|
+
LSS --> COMP
|
|
62
|
+
COMP --> SIM
|
|
63
|
+
COMP --> LIVE
|
|
64
|
+
COMP --> REPLAY
|
|
65
|
+
SIM --> BENCH
|
|
66
|
+
LIVE --> BENCH
|
|
67
|
+
REPLAY --> BENCH
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## ⚡ Install & run
|
|
73
|
+
|
|
74
|
+
**One-liner (GitHub):**
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install git+https://github.com/KanakMalpani/LoopGym.git
|
|
78
|
+
python -c "import loopgym as lg; env = lg.make('loopbench/code-repair-v1'); print(env.reset(task_id='cr-001'))"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Developer setup:**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/KanakMalpani/LoopGym.git && cd LoopGym
|
|
85
|
+
pip install -e ".[dev]"
|
|
86
|
+
python examples/quickstart.py
|
|
87
|
+
pytest tests/ -q
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**PyPI** (after first release — [PUBLISHING.md](PUBLISHING.md)):
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install loopgym
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Environments
|
|
99
|
+
|
|
100
|
+
| Env ID | Backend | Use case |
|
|
101
|
+
|--------|---------|----------|
|
|
102
|
+
| `loopbench/code-repair-v1` | SimEnv | Verify-driven code repair |
|
|
103
|
+
| `loopbench/research-synthesis-v1` | SimEnv | Research brief synthesis |
|
|
104
|
+
| `loopbench/multi-agent-debate-v1` | SimEnv | Multi-agent review / debate |
|
|
105
|
+
| `replay/loopnet-v1` | ReplayEnv | Replay [LoopNet](https://github.com/KanakMalpani/loopnet) trajectories |
|
|
106
|
+
| `sim/mock-llm-v1` | SimEnv | Generic mock-LLM sandbox |
|
|
107
|
+
|
|
108
|
+
Bundled LSS specs live under [`envs/loopbench/`](envs/loopbench/). All validated against [Loop Core Engineering](https://github.com/KanakMalpani/Loop-Core-Engineering) in CI.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## LoopNet replay (optional)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git clone https://github.com/KanakMalpani/loopnet.git ../loopnet
|
|
116
|
+
# or: export LOOPNET_SEED_PATH=/path/to/records.jsonl
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
env = lg.make("replay/loopnet-v1")
|
|
121
|
+
env.reset(record_id="ln-00042")
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Ecosystem
|
|
127
|
+
|
|
128
|
+
| Repository | Role |
|
|
129
|
+
|------------|------|
|
|
130
|
+
| [Loop Core Engineering](https://github.com/KanakMalpani/Loop-Core-Engineering) | LSS / LES authority |
|
|
131
|
+
| [LoopNet](https://github.com/KanakMalpani/loopnet) | Trajectory corpus |
|
|
132
|
+
| **LoopGym** | Runtime (this repo) |
|
|
133
|
+
| [LoopBench](https://github.com/KanakMalpani/LoopBench) | Benchmark orchestration |
|
|
134
|
+
|
|
135
|
+
Full stack map: [ECOSYSTEM.md](https://github.com/KanakMalpani/Loop-Core-Engineering/blob/main/ECOSYSTEM.md)
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Project layout
|
|
140
|
+
|
|
141
|
+
| Path | Purpose |
|
|
142
|
+
|------|---------|
|
|
143
|
+
| [`loopgym/`](loopgym/) | Registry, envs, runtime, evaluators |
|
|
144
|
+
| [`envs/loopbench/`](envs/loopbench/) | Task fixtures + LSS specs |
|
|
145
|
+
| [`docs/api.md`](docs/api.md) | API reference |
|
|
146
|
+
| [`examples/quickstart.py`](examples/quickstart.py) | Onboarding smoke test |
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Citation
|
|
151
|
+
|
|
152
|
+
```bibtex
|
|
153
|
+
@software{loopgym2026,
|
|
154
|
+
title={LoopGym: OpenAI Gym for LSS-Defined Agent Loops},
|
|
155
|
+
author={Malpani, Kanak},
|
|
156
|
+
year={2026},
|
|
157
|
+
url={https://github.com/KanakMalpani/LoopGym}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
<p align="center">
|
|
164
|
+
<sub>MIT · v0.1 · <a href="CONTRIBUTING.md">Contributing</a> · <a href="SECURITY.md">Security</a> · <a href="PUBLISHING.md">PyPI</a></sub>
|
|
165
|
+
</p>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
|---------|-----------|
|
|
7
|
+
| 0.1.x | Yes |
|
|
8
|
+
|
|
9
|
+
## Reporting
|
|
10
|
+
|
|
11
|
+
Report privately via [GitHub Security Advisories](https://github.com/KanakMalpani/LoopGym/security/advisories/new).
|
|
12
|
+
|
|
13
|
+
## LiveEnv
|
|
14
|
+
|
|
15
|
+
`LiveEnv` executes real model API calls. Never commit API keys; use environment variables. SimEnv is the default for CI and untrusted specs.
|
loopgym-0.1.0/STATUS.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Status
|
|
2
|
+
|
|
3
|
+
| Field | Value |
|
|
4
|
+
|-------|-------|
|
|
5
|
+
| **Phase** | v0.1 shipped |
|
|
6
|
+
| **Symbol** | ✅ |
|
|
7
|
+
| **Started** | 2026-06-13 |
|
|
8
|
+
| **Shipped** | 2026-06-13 |
|
|
9
|
+
| **Owner** | — |
|
|
10
|
+
| **Blockers** | — |
|
|
11
|
+
| **Notes** | Published at https://github.com/KanakMalpani/LoopGym |
|
|
12
|
+
|
|
13
|
+
## Completion checklist
|
|
14
|
+
|
|
15
|
+
- [x] `loopgym/` Python package
|
|
16
|
+
- [x] `envs/loopbench/` stub envs (3 tasks)
|
|
17
|
+
- [x] `examples/quickstart.py`
|
|
18
|
+
- [x] `docs/api.md`
|
|
19
|
+
- [x] ReplayEnv ↔ LoopNet seed integration
|
|
20
|
+
- [x] CI: test workflow + LSS validation
|
|
21
|
+
- [x] `SYNC.md` — canonical source policy
|
|
22
|
+
- [ ] PyPI publish (`pip install loopgym` — pending trusted publisher or token on PyPI)
|
|
23
|
+
|
|
24
|
+
## Links
|
|
25
|
+
|
|
26
|
+
- Parent workspace: [../README.md](../README.md)
|
|
27
|
+
- Core specs: [../01-loop-engineering-core/](../01-loop-engineering-core/)
|
|
28
|
+
- Agent brief: [../AGENT-BRIEF.md](../AGENT-BRIEF.md)
|
|
29
|
+
- Discipline repo (source runtime): https://github.com/KanakMalpani/Loop-Engineering
|
loopgym-0.1.0/SYNC.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Sync policy — LoopGym
|
|
2
|
+
|
|
3
|
+
**Runtime layer for Loop Engineering.**
|
|
4
|
+
|
|
5
|
+
| Artifact | Canonical source | This repo |
|
|
6
|
+
|----------|------------------|-----------|
|
|
7
|
+
| LSS / LES specs | [Loop Core Engineering](https://github.com/KanakMalpani/Loop-Core-Engineering) | pin `lss@1.0.0`, `les@1.0.0` |
|
|
8
|
+
| LoopNet records | [LoopNet](https://github.com/KanakMalpani/loopnet) | ReplayEnv reads seed JSONL |
|
|
9
|
+
| Env IDs | Loop Core Engineering `specs/loop-ids.md` | registry in `loopgym/registry.py` |
|
|
10
|
+
| Benchmark tasks | [LoopBench](https://github.com/KanakMalpani/LoopBench) | bundled fixtures under `envs/loopbench/` |
|
|
11
|
+
|
|
12
|
+
**Repository:** https://github.com/KanakMalpani/LoopGym
|
|
13
|
+
|
|
14
|
+
## Validation before release
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pytest tests/ -q
|
|
18
|
+
python examples/quickstart.py
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Validate bundled specs against Loop Core Engineering in CI.
|
|
22
|
+
|
|
23
|
+
## Do not duplicate
|
|
24
|
+
|
|
25
|
+
- LSS JSON Schema — checkout Loop Core Engineering in CI
|
|
26
|
+
- LoopBench task YAML — reference env IDs only
|
|
27
|
+
- LES observed scoring — belongs in LoopBench
|
|
28
|
+
|
|
29
|
+
## CI dependency order
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Loop Core Engineering (schema)
|
|
33
|
+
LoopGym (this repo)
|
|
34
|
+
LoopBench (downstream)
|
|
35
|
+
```
|