Eva1307/legal-review-env
0
Legal Review Environment
An OpenEnv RL environment where an LLM agent reviews legal contract clauses clause-by-clause, identifies risks, and suggests edits. Models real work done by legal reviewers at startups and enterprises.
Motivation
Contract review is a high-stakes, time-consuming task. This environment trains and evaluates agents on realistic legal documents with deterministic graders — filling a genuine gap in the OpenEnv ecosystem.
Observation Space
Action Space
Tasks
Reward Function
- Partial rewards at every step (not sparse)
- Bonuses for catching high-risk clauses with correct reasoning
- Penalties for approving dangerous clauses (indemnity, unlimited liability)
- Edit quality scored via keyword matching for task_hard
Baseline Scores (Qwen/Qwen2.5-72B-Instruct)
Setup
git clone https://huggingface.co/spaces/Eva1307/legal-review-env
cd legal-review-env
pip install -r requirements.txt
python app.pyDocker
docker build -t legal-review-env .
docker run -p 7860:7860 legal-review-envAPI Endpoints
POST /reset?task_id=task_easy— start new episodePOST /step?task_id=task_easy— submit actionGET /state?task_id=task_easy— current stateGET /tasks— list all tasksGET /health— health check
Inference
export HF_TOKEN=your_token
export API_BASE_URL=https://router.huggingface.co/v1
export MODEL_NAME=Qwen/Qwen2.5-72B-Instruct
python inference.py