| --- |
| title: Code Review Agent Environment |
| sdk: docker |
| app_port: 7860 |
| --- |
| |
| # Code Review Agent Environment |
|
|
| Submission for the Meta x Hugging Face OpenEnv Hackathon. |
|
|
| Authors / Members: |
| - Ashish |
| - Shardul |
| - Harshit |
|
|
| ## Overview |
|
|
| This project is a real-world code review environment for AI agents. The agent receives a code diff plus surrounding context and must identify issues, suggest fixes, and decide whether changes should be approved or rejected. |
|
|
| ## Live Section |
| Live Space: [huggingface.co/spaces/Spirit-26/code-review-environment](https://huggingface.co/spaces/Spirit-26/code-review-environment) |
|
|
| ## Core Features |
|
|
| - OpenEnv-style `reset()`, `step()`, and `state()` API |
| - Pydantic-based action, observation, and state models |
| - 6 review tasks across easy, medium, and hard difficulty |
| - Deterministic graders with scores from `0.0` to `1.0` |
| - Reward shaping for partial progress and invalid actions |
| - Docker support and Hugging Face Space deployment |
| - Baseline inference script at the repository root: `inference.py` |
|
|
| ## Required Environment Variables |
|
|
| Use an OpenAI-compatible endpoint. |
|
|
| - `API_BASE_URL` |
| - `MODEL_NAME` |
| - `API_KEY` |
|
|
| Backward-compatible aliases are also supported: |
|
|
| - `HF_TOKEN` |
| - `OPENAI_API_KEY` |
|
|
| ## Local Run |
|
|
| ```bash |
| python -m venv .venv |
| .\.venv\Scripts\Activate.ps1 |
| pip install -r requirements.txt |
| python inference.py --task-id bug_detection_easy_1 --max-steps 50 --output baseline_results.json |
| ``` |
|
|
| ## Validation |
|
|
| ```bash |
| python submit.py |
| ``` |
|
|
| ## Docker |
|
|
| ```bash |
| docker build -t code-review-openenv . |
| docker run --rm -p 7860:7860 \ |
| -e API_BASE_URL=https://api.openai.com/v1 \ |
| -e MODEL_NAME=gpt-4o-mini \ |
| -e API_KEY=<your_key> \ |
| code-review-openenv |
| ``` |
|
|