CoolFace
Apppublic

raunakratan/priority-mind-lite

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes
App README

๐Ÿง  PriorityMind-Lite

LLM-Rewarded Customer Support Ticket Triage Environment

Meta PyTorch OpenEnv Hackathon 2026 | Team Axiom (IIT Madras)

![License: MIT](https://opensource.org/licenses/MIT) ![Python 3.10+](https://www.python.org/downloads/) ![OpenEnv Compatible](https://github.com/meta-pytorch/OpenEnv)


๐ŸŽฏ One-Line Pitch

An OpenEnv reinforcement learning environment where AI agents learn to triage customer support tickets using rewards evaluated by Llama โ€” not hardcoded rules โ€” enabling nuanced behaviors like empathy, strategic escalation, and contextual judgment.

โœจ Key Innovation

Traditional RL requires you to define "good" mathematically. How do you encode empathy as a number? You don't โ€” you let Llama judge it.

Traditional RLPriorityMind-Lite
Hardcoded rewards (+10 resolution, -5 escalation)LLM evaluates on empathy, efficiency, strategy
Optimizes numbers, not behaviorLearns human-like judgment
Fails at nuanced tasksHandles contextual appropriateness

๐Ÿš€ Quick Start

bash
# Install dependencies
pip install -r requirements.txt

# Run mock benchmark (no API key needed)
python inference.py --mock --verbose

# Run with live LLM evaluation (requires HF_TOKEN)
export HF_TOKEN=hf_your_token_here
python inference.py --verbose

# Run interactive demo for judges
python demo.py --live

# Launch Gradio web interface
python app.py

๐Ÿ“‹ What's Included

Core Components

FileDescription
environment.pyPriorityMindEnv - OpenEnv-compatible environment
grader.pyHybridGrader (LLM + Fallback) + ProgrammaticGrader
inference.pyBenchmark runner with [START]/[STEP]/[END] format
models.pyPydantic-typed Observation, Action, Reward models
demo.py90-second judge-facing demo script
app.pyGradio web interface for HF Spaces

Supporting Files

FileDescription
openenv.yamlOpenEnv metadata specification
DockerfileHF Spaces compatible container
requirements.txtPinned dependencies
RESULTS.mdBaseline benchmark results
LICENSEMIT License

Validation & Testing

FileDescription
scripts/validate_submission.pyPre-submission validation script
tests/test_environment.pyComprehensive test suite

๐ŸŽฎ Task Definitions

Each difficulty level includes 6 different ticket variations to simulate real-world diversity. The environment randomly selects a variation on each reset, ensuring robust training and evaluation.

Task 1: Easy โ€” Simple Billing Inquiries (6 variations)

  • โ€”Sample Tickets:
  • โ€”"My bill is higher than expected"
  • โ€”"I was charged twice for my subscription"
  • โ€”"Can you explain the charges on my latest invoice?"
  • โ€”"My payment failed but I was still charged"
  • โ€”"I need a refund for the overcharge on my account"
  • โ€”"Why did my monthly fee increase without notice?"
  • โ€”Sentiment Range: -0.1 to -0.5 (mildly negative)
  • โ€”True Category: billing
  • โ€”Max Steps: 3
  • โ€”Success: Correctly categorize + assign appropriate priority

Task 2: Medium โ€” Frustrated Technical Issues (6 variations)

  • โ€”Sample Tickets:
  • โ€”"App keeps crashing! I'm so frustrated!"
  • โ€”"The app freezes every time I try to upload a photo"
  • โ€”"Login page shows error 500 constantly"
  • โ€”"My notifications stopped working after the update"
  • โ€”"The search function returns no results even for items I know exist"
  • โ€”"App drains my battery in just 2 hours"
  • โ€”Sentiment Range: -0.65 to -0.8 (frustrated)
  • โ€”True Category: technical
  • โ€”Max Steps: 5
  • โ€”Success: Recognize frustration, prioritize high/urgent, empathetic response

Task 3: Hard โ€” Complex Multi-Issue Complaints (6 variations)

  • โ€”Sample Tickets:
  • โ€”"I've waited 3 days for a refund AND your app deleted my data. This is unacceptable!"
  • โ€”"Your service has been down for 2 days and I'm losing business. I want compensation!"
  • โ€”"I've been transferred 5 times and no one has solved my problem. This is terrible service!"
  • โ€”"My account was hacked and your support team is not responding fast enough!"
  • โ€”"You charged me for a year subscription but I only wanted monthly. Refund the difference NOW!"
  • โ€”"My personal data was exposed in your data breach and I haven't heard from you in a week!"
  • โ€”Sentiment Range: -0.88 to -0.97 (very angry)
  • โ€”True Category: complaint
  • โ€”Max Steps: 8
  • โ€”Success: De-escalate, coordinate multi-step resolution, maintain empathy

๐Ÿ† Benchmark Results

TaskAvg ScoreEmpathyEfficiencyStrategyResolved
easy0.300.30/1.00.50/1.00.77/1.0โœ… Yes
medium0.240.44/1.00.57/1.00.71/1.0โœ… Yes
hard0.200.41/1.00.56/1.00.70/1.0โœ… Yes
MEAN0.250.38/1.00.54/1.00.73/1.0-

Verified with python inference.py --mock --verbose using the seeded offline benchmark. Live scores depend on the configured HF model and fallback rate, so only the deterministic mock baseline is pinned in the repo.

See RESULTS.md for detailed benchmark methodology and the verified mock baseline.

๐Ÿ”ง Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    HIGH-LEVEL FLOW                          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                             โ”‚
โ”‚  1. Environment Reset                                       โ”‚
โ”‚     โ€ข Generate ticket: text + sentiment + true_category     โ”‚
โ”‚     โ€ข Return typed Observation (Pydantic model)             โ”‚
โ”‚                                                             โ”‚
โ”‚  2. Agent Takes Action                                      โ”‚
โ”‚     โ€ข Uses OpenAI-compatible client (HF Router)            โ”‚
โ”‚     โ€ข Action types: categorize/prioritize/respond/escalate/resolve โ”‚
โ”‚                                                             โ”‚
โ”‚  3. Hybrid Grader Evaluates                                 โ”‚
โ”‚     โ”œโ”€ Try LLM Evaluation (60% of reward)                  โ”‚
โ”‚     โ”‚  โ€ข Prompt Llama with state + action + criteria       โ”‚
โ”‚     โ”‚  โ€ข Llama returns: score (0-10) + reasoning + sub-scoresโ”‚
โ”‚     โ”‚  โ€ข Normalize to [0.0, 1.0]                           โ”‚
โ”‚     โ”‚                                                       โ”‚
โ”‚     โ”œโ”€ Cache Result (exact-match caching)                   โ”‚
โ”‚     โ”‚  โ€ข Reduces API calls for repeated queries            โ”‚
โ”‚     โ”‚                                                       โ”‚
โ”‚     โ””โ”€ Fallback to Programmatic (40% of reward)             โ”‚
โ”‚        โ€ข Deterministic rules if LLM fails                  โ”‚
โ”‚                                                             โ”‚
โ”‚  4. Return Reward + New State + Done Flag                   โ”‚
โ”‚     โ€ข Reward = 0.4*programmatic + 0.6*llm_normalized_score โ”‚
โ”‚     โ€ข Partial signals: empathy, efficiency, strategy        โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŒ Live Demo

Try the interactive demo on Hugging Face Spaces:

๐Ÿ‘‰ [https://huggingface.co/spaces/raunakratan/priority-mind-lite](https://huggingface.co/spaces/raunakratan/priority-mind-lite)

๐ŸŽจ Gradio Web Interface

A user-friendly web interface for interacting with the PriorityMind environment and testing ticket triage workflows.

Features

  • โ€”Interactive Ticket Input: Input customer support tickets and get immediate triage suggestions
  • โ€”Environment Simulation: Select difficulty levels (easy, medium, hard) and run full episode simulations
  • โ€”Real-time Feedback: View LLM evaluations, reward breakdowns, and reasoning
  • โ€”Episode History: Track and review past triage decisions with metrics
  • โ€”Configuration UI: Adjust model parameters, timeouts, and evaluation settings without code changes

Quick Start

bash
# Launch Gradio interface (default: http://localhost:7860)
python app.py

# Run on specific port
python app.py --port 8000

# Enable live LLM evaluation (requires HF_TOKEN)
export HF_TOKEN=hf_your_token_here
python app.py

Usage

  1. 1.Select Task Difficulty: Choose from easy (billing), medium (technical), or hard (complaints)
  2. 2.Input Ticket: Enter a customer support ticket or use a sample
  3. 3.Run Triage: Click "Triage Ticket" to send to environment
  4. 4.View Results: See category prediction, priority level, and LLM reasoning
  5. 5.Review Metrics: Check empathy, efficiency, and strategy scores

Interface Components

ComponentPurpose
Task SelectorChoose difficulty level with predefined variations
Ticket InputText area for custom or sample tickets
Action PanelSelect triage action (categorize, prioritize, respond, escalate, resolve)
Response DisplayShows environment feedback and next state
Metrics PanelDisplays reward breakdown with reasoning
History LogView all actions in current episode

โš™๏ธ Configuration

Environment Variables

VariableDescriptionDefault
HF_TOKENHugging Face API key(required for live mode)
API_BASE_URLLLM API endpointhttps://router.huggingface.co/v1
MODEL_NAMEModel identifiermeta-llama/Llama-3.1-8B-Instruct
HF_TIMEOUT_SECONDSAPI timeout12

.env File

env
# Hugging Face API Configuration
HF_TOKEN=hf_your_token_here

# API Configuration - Use HF Router for Inference
API_BASE_URL=https://router.huggingface.co/v1
MODEL_NAME=meta-llama/Llama-3.1-8B-Instruct
HF_TIMEOUT_SECONDS=12

๐Ÿงช Testing & Validation

bash
# Run all tests
python -m pytest tests/ -v

# Run pre-submission validation
python scripts/validate_submission.py

# Validate OpenEnv spec
openenv validate . --verbose

# Run mock inference (validates output format)
python inference.py --mock

๐Ÿ“ Project Structure

priority-mind-lite/
โ”œโ”€โ”€ openenv.yaml              # OpenEnv metadata
โ”œโ”€โ”€ environment.py            # PriorityMindEnv class
โ”œโ”€โ”€ grader.py                 # HybridGrader + ProgrammaticGrader
โ”œโ”€โ”€ inference.py              # Benchmark runner
โ”œโ”€โ”€ models.py                 # Pydantic models
โ”œโ”€โ”€ demo.py                   # Judge-facing demo
โ”œโ”€โ”€ app.py                    # Gradio web interface
โ”œโ”€โ”€ Dockerfile                # Container configuration
โ”œโ”€โ”€ requirements.txt          # Dependencies
โ”œโ”€โ”€ LICENSE                   # MIT License
โ”œโ”€โ”€ README.md                 # This file
โ”œโ”€โ”€ RESULTS.md                # Benchmark results
โ”œโ”€โ”€ .huggingface/             # HF Spaces config
โ”‚   โ””โ”€โ”€ README.md
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ validate_submission.py
โ”œโ”€โ”€ server/
โ”‚   โ””โ”€โ”€ app.py                # OpenEnv HTTP server
โ””โ”€โ”€ tests/
    โ””โ”€โ”€ test_environment.py

๐ŸŽฌ 90-Second Demo Flow

  1. 1.Problem Statement (15s): "How do you mathematically define empathy?"
  2. 2.Solution (15s): "Let Llama judge what good looks like"
  3. 3.Live Demo (30s): Run hard task with visible LLM reasoning
  4. 4.Results (15s): Show metrics table with empathy improvement
  5. 5.Insight (15s): "We taught the agent to satisfy a judge that values empathy"

Run with: python demo.py --live

๐Ÿ… Why This Wins

  1. 1.Perfect Requirement Alignment: Customer support explicitly allowed, 3 tasks, <20min runtime, exact output format
  2. 2.Research-Grade Innovation: First OpenEnv environment with LLM-as-reward-function
  3. 3.Meta Stack Alignment: OpenEnv + Llama + PyTorch + HF Spaces
  4. 4.Demo-Ready Design: Visible LLM reasoning, clear metrics, memorable takeaway
  5. 5.Production-Thinking: Fallback grader, smart caching, pinned dependencies

๐Ÿ“„ License

MIT License - see LICENSE for details.

๐Ÿ‘ฅ Team

Team Axiom - IIT Madras

  • โ€”Rauank Ratan
  • โ€”Akash Deep
  • โ€”Sangam Jha

๐Ÿ”— Links


Built on OpenEnv. Judged by Llama.