ADAPT, the Adversarial DSA Tutor, is an OpenEnv-compliant RLVR environment for training code-generation agents on small DSA tasks. The agent receives a problem prompt, examples, and visible tests, then submits Python code. The environment runs the code against visible and hidden tests and returns reward, pass-rate metrics, execution status, and feedback.
This repo now focuses on the environment layer only. Verifier work and training scripts are owned separately.
Why This Environment
The hackathon asks for OpenEnv environments that can improve LLM behavior through verifiable interaction. ADAPT targets a simple but useful skill loop:
agent writes code -> environment executes it -> hidden tests and reward signals score it -> trainer improves the agent
The differentiator is curriculum-ready DSA practice: each episode carries a problem id and difficulty tier so training can track per-tier success instead of only aggregate reward.
OpenEnv Interface
The environment uses the latest OpenEnv API shape:
step(action) accepts an AdaptAction with a Python code string.
state exposes episode id, step count, current problem id, difficulty, and recent metrics.
openenv.yaml points to:
yaml
1app: server.app:app
2port:7860
Action
python
1{2"code":"n = int(input())\nprint(n * 2)"3}
Observation
Reset and step observations include:
problem statement
input format
constraints
examples
visible tests
problem id
difficulty tier
feedback
pass rate, visible pass rate, and hidden pass rate
syntax/runtime/timeout status
reward components
Hidden test inputs and expected outputs are never returned in observations.
Reward
Reward is clipped to [0.0, 1.0] and combines multiple environment-level signals:
correctness from visible and hidden pass rate
syntax validity
clean execution
output format compliance
timeout penalty
runtime error penalty
static safety rejection for dangerous imports such as os, subprocess, socket, pathlib, and shutil
If verifier.verifier.verify(code, test_cases) exists, the environment can use it as an optional reward augmentation. If the verifier is absent, the environment still works using executor-derived reward.