Spaces:
Sleeping
Sleeping
Deployment Guide β HuggingFace Spaces
Complete step-by-step instructions to get your environment live and passing all automated judging checks.
Step 1 β Create a HuggingFace Account + Space
- Go to https://huggingface.co and sign up (free)
- Click your profile β New Space
- Fill in:
- Space name:
support-ticket-agent - License: MIT
- SDK: Docker β IMPORTANT, must be Docker
- Visibility: Public β judges need to access it
- Space name:
- Click Create Space
Step 2 β Upload Your Files
You need to upload exactly these 9 files to your Space:
main.py
environment.py
models.py
graders.py
baseline.py
openenv.yaml
requirements.txt
Dockerfile
README.md
Option A β via the HuggingFace web UI:
- In your Space, click Files tab
- Click Add file β Upload files
- Upload all 9 files at once
- Click Commit changes
Option B β via Git (faster):
# Install git-lfs first
git lfs install
# Clone your empty space
git clone https://huggingface.co/spaces/YOUR_USERNAME/support-ticket-agent
cd support-ticket-agent
# Copy all your files here
cp /path/to/your/files/* .
# Push
git add .
git commit -m "Initial deployment"
git push
Step 3 β Set Your OpenAI API Key as a Secret
- In your Space, go to Settings tab
- Scroll to Repository secrets
- Click New secret
- Name:
OPENAI_API_KEY - Value: your
sk-...key - Click Save
The key is injected as an environment variable at runtime. It's never visible in your code or logs.
Step 4 β Watch It Build
- Go to the App tab of your Space
- You'll see "Building..." with Docker logs
- First build takes ~3-5 minutes (downloads dataset from HuggingFace)
- Once you see
Application startup complete, it's live
If the build fails, click Logs and look for:
- Missing file β check Step 2
- Port error β Dockerfile already uses 7860, should be fine
- Dataset error β HuggingFace dataset download issues (retry)
Step 5 β Verify It's Working
Once live, your Space URL will be:
https://YOUR_USERNAME-support-ticket-agent.hf.space
Test each endpoint in your browser or with curl:
BASE="https://YOUR_USERNAME-support-ticket-agent.hf.space"
# 1. Health check β must return 200
curl $BASE/health
# 2. Tasks list β must return all 3 tasks
curl $BASE/tasks
# 3. Reset β start episode
curl -X POST $BASE/reset \
-H "Content-Type: application/json" \
-d '{"task_id": "task1"}'
# 4. Step β submit action
curl -X POST $BASE/step \
-H "Content-Type: application/json" \
-d '{"department": "Technical", "priority": 2}'
# 5. State
curl $BASE/state
# 6. Grader β test directly
curl -X POST $BASE/grader \
-H "Content-Type: application/json" \
-d '{
"task_id": "task2",
"ticket_body": "My invoice is wrong",
"ticket_subject": "Billing issue",
"gold_department": "Billing",
"gold_priority": 2,
"predicted_department": "Billing",
"predicted_priority": 2
}'
# 7. Baseline β runs GPT-4o-mini (needs API key set)
curl -X POST $BASE/baseline \
-H "Content-Type: application/json" \
-d '{"task_ids": ["task1","task2","task3"], "max_tickets": 5}'
Step 6 β Submit to the Hackathon
- Go to the hackathon portal
- Click Submit your Assessment
- Paste your Space URL:
https://YOUR_USERNAME-support-ticket-agent.hf.space - Also paste your GitHub/HuggingFace repo link
- Submit before April 7, 11:59 PM
Pre-Submission Checklist
Go through this before submitting β all must pass:
- HuggingFace Space URL returns 200 on
/health -
/resetreturns an observation with ticket data -
/stepreturns reward with score between 0.0 and 1.0 -
/tasksreturns all 3 tasks with action schemas -
/graderreturns a score for a test action -
/baselinereturns scores (even mock scores without API key) -
docker buildworks locally without errors -
openenv.yamlhas name, tasks, endpoints, reward_range fields - README has environment description, action space, setup instructions
- Baseline scores span easy (
0.8) β hard (0.4) β shows difficulty range
Testing Docker Locally (Before Uploading)
cd support_ticket_env/
# Build
docker build -t support-ticket-agent .
# Run
docker run -p 7860:7860 -e OPENAI_API_KEY=sk-... support-ticket-agent
# Test
curl http://localhost:7860/health
curl http://localhost:7860/tasks
Common Issues and Fixes
| Problem | Fix |
|---|---|
| Space stuck on "Building" | Check Logs tab for errors |
ModuleNotFoundError |
Check requirements.txt has all packages |
| Dataset load fails | HuggingFace may be rate-limiting β retry |
/baseline returns no_api_key |
Set OPENAI_API_KEY secret in Space settings |
| Port 7860 not responding | Make sure Dockerfile EXPOSE 7860 is there |
openenv validate fails |
Check openenv.yaml has all required fields |
What Judges Check (Automated)
The judging system will automatically:
- Ping
YOUR_SPACE_URL/healthβ must return{"status": "ok"} - POST to
/resetβ must return observation with ticket data - POST to
/stepwith an action β must return score in [0.0, 1.0] - GET
/tasksβ must list 3 tasks with action schemas - Run
docker buildon your repo - POST to
/baselineβ must return scores without crashing
All 6 must pass or you are disqualified. Make sure to test every single one before submitting.