deepakjss/ticket-triage-openenv
Support Ticket Triage — OpenEnv (Round 1)
Classify intent, priority, and routing queue from short support-ticket text. Three graded tasks (easy → medium → hard) with scores in [0, 1].
What’s in this repo
Tasks and grading live in ticket_triage_openenv/server/support_environment.py (TASK_SPECS, grade_response). Each reset() moves to the next task. The HTTP API is built with openenv’s create_app; inference.py uses GenericEnvClient and prints `[START]` / `[STEP]` / `[END]` for the baseline run.
Requirements
- Python 3.10+ (3.11 matches the
Dockerfile) - Dependencies:
openenv-core,fastapi,uvicorn,openai(seerequirements.txt)
Action / observation
- Action:
TriageAction(message: str)— one line, e.g.intent:billing - Observation: ticket text, instruction,
task_id, hints/feedback,reward,done
Tasks
Local server
Use a virtualenv so openenv is installed (avoid a system uvicorn without deps):
cd scaler-openenv-hackathon
python3.11 -m venv .venv && source .venv/bin/activate # or your 3.10+ venv
pip install -r requirements.txt
export PYTHONPATH=.
uvicorn server.app:app --host 127.0.0.1 --port 8000Smoke test:
curl -s -X POST http://127.0.0.1:8000/reset -H "Content-Type: application/json" -d '{}' | head -c 400Docker (same as Space)
The image listens on `PORT` (default 8000). OpenEnv’s from_docker_image() maps `host:8000`. Hugging Face reads `app_port` in the YAML header above — it must be 8000 so the proxy and health checks hit the same port as uvicorn (using `app_port: 7860` while the app listens on 8000 causes a restart loop).
docker build -t ticket-triage-openenv:latest .
docker run --rm -p 8000:8000 ticket-triage-openenv:latestBaseline inference (inference.py)
Set `HF_TOKEN` (Hugging Face). Set `OPENENV_BASE_URL` to your env (e.g. http://127.0.0.1:8000 or your https://*.hf.space URL), or `LOCAL_IMAGE_NAME` for a local Docker image.
export HF_TOKEN=hf_...
export OPENENV_BASE_URL=http://127.0.0.1:8000
python inference.pyHugging Face Space
Space: `deepakjss/ticket-triage-openenv` — `app_port: 8000` must stay in sync with the Dockerfile.
Check the live API (use your direct *.hf.space URL):
curl -s -o /dev/null -w "%{http_code}" -X POST -H "Content-Type: application/json" -d '{}' \
"https://YOUR_SPACE_DIRECT_URL/reset"Validate
Pre-submission script (organiser-style): 4 checks — (1) POST /reset on your Space, (2) `docker build`, (3) `openenv validate` (uses `.venv/bin/openenv` if present), (4) `openenv validate --url` against the same Space.
chmod +x scripts/validate-submission.sh
./scripts/validate-submission.sh "https://your-space.hf.space" .Requires Docker Desktop running and `openenv-core` installed in the repo .venv or on PATH.
Optional full local check (needs uv):
chmod +x scripts/run_all_steps.sh
./scripts/run_all_steps.shBefore you submit
- Push `main` to your GitHub repo and to the Hugging Face Space repo if you deploy from git.
- Confirm `openenv validate` passes and the Space returns 200 on `POST /reset`.
- Run `inference.py` once with a real `HF_TOKEN` and see `[START]` / `[STEP]` / `[END]` in the terminal.
- Submit the GitHub URL and Space URL (and anything else the form asks for).
Repo layout
openenv.yaml
Dockerfile
inference.py
requirements.txt
pyproject.toml
server/app.py # app entry for openenv.yaml / Docker
ticket_triage_openenv/
models.py
server/app.py
server/support_environment.py
scripts/validate-submission.sh
scripts/run_all_steps.sh