Spaces:
No application file

SupportEnv / PRD.md
Adi-19's picture
codes pushed to 84 from 72 on a scale of 100
05b75ac
|
Raw History Blame Contribute Delete
4.25 kB

PRD: SupportEnv – AI Customer Support RL Environment

Overview

Build a complete OpenEnv-compliant environment that simulates a real-world customer support system where an AI agent can:

  • Classify support tickets
  • Search Knowledge Base (lookup_kb)
  • Generate empathetic responses
  • Decide escalation (de-escalate if possible)
  • Resolve issues efficiently

Requirements

  • Follow OpenEnv spec: reset(), step(), state()
  • Include 3 tasks (easy β†’ medium β†’ hard)
  • Include deterministic graders (0.0–1.0)
  • Include baseline inference
  • Deploy via Docker + Hugging Face Spaces

Task 1: Project Setup & Structure

Create full project structure:

SupportEnv/ β”œβ”€β”€ models.py # Typed Action, Observation, State β”œβ”€β”€ client.py # WebSocket client for external use β”œβ”€β”€ openenv.yaml # Environment metadata β”œβ”€β”€ pyproject.toml # Package dependencies β”œβ”€β”€ requirements.txt # Pip requirements β”œβ”€β”€ README.md # Documentation β”‚ β”œβ”€β”€ server/ β”‚ β”œβ”€β”€ init.py β”‚ β”œβ”€β”€ app.py # FastAPI application β”‚ β”œβ”€β”€ environment.py # Core RL logic β”‚ β”œβ”€β”€ tasks.py # Task definitions (easy/medium/hard) β”‚ β”œβ”€β”€ graders.py # Deterministic scoring β”‚ β”œβ”€β”€ reward.py # Reward computation β”‚ β”œβ”€β”€ ticket_generator.py # Realistic ticket generation β”‚ β”œβ”€β”€ utils.py # Helper functions β”‚ └── Dockerfile # Container definition β”‚ β”œβ”€β”€ baseline/ β”‚ β”œβ”€β”€ init.py β”‚ β”œβ”€β”€ run_baseline.py # Baseline execution script β”‚ β”œβ”€β”€ policy.py # Rule-based baseline agent β”‚ └── results.json # Saved baseline scores β”‚ β”œβ”€β”€ frontend/ β”‚ β”œβ”€β”€ init.py β”‚ └── gradio_ui.py # Gradio interface β”‚ β”œβ”€β”€ tests/ β”‚ β”œβ”€β”€ init.py β”‚ β”œβ”€β”€ test_environment.py β”‚ β”œβ”€β”€ test_graders.py β”‚ β”œβ”€β”€ test_api.py β”‚ └── test_baseline.py β”‚ └── scripts/ β”œβ”€β”€ start_local.sh β”œβ”€β”€ validate.sh └── deploy.sh

Requirements

  • Follow OpenEnv structure
  • All files created (no placeholders)
  • Project runs locally without errors

Task 2: Define Typed Models

Action

  • action_type: classify | respond | escalate | resolve | lookup_kb | request_info
  • content: string

Observation

  • ticket_text
  • history
  • customer_sentiment
  • issue_category

State

  • episode_id
  • step_count
  • resolved

Requirements

  • Fully typed (Pydantic)
  • OpenEnv compatible
  • No missing fields

Task 3: Implement Ticket Generator

Features

Generate tickets for:

  • Billing
  • Technical
  • Account

Include:

  • Difficulty (easy / medium / hard)
  • Sentiment score
  • Keywords

Requirements

  • Minimum 20 tickets
  • Include ambiguous hard cases
  • Deterministic with seed

Task 4: Implement Environment Core

reset()

  • Generate new ticket
  • Initialize state
  • Clear history

step(action)

Handle:

  • classify
  • respond
  • escalate
  • resolve

Return:

  • observation
  • reward
  • done

state()

  • Return metadata

Requirements

  • Multi-step interaction supported
  • Episode ends correctly
  • No crashes on invalid input

Task 5: Implement Reward System

Rewards

  • Correct classification β†’ +0.25
  • Hybrid Semantic Response Quality β†’ +0.30
  • Appropriate KB usage β†’ +0.15
  • Correct escalation decision β†’ +0.35
  • Successful resolution β†’ +0.40
  • Wrong escalation β†’ -0.20
  • Missed mandatory escalation β†’ -0.35
  • Harmful response β†’ -0.40

Requirements

  • Step-level rewards
  • Not purely binary
  • Penalizes bad behavior

Task 6: Implement Grader System

Evaluate

  • Classification accuracy
  • Response quality (Semantic + Keyword)
  • Escalation correctness (with mandatory de-escalation for hard tasks)
  • Resolution Alignment
  • Efficiency (Penalizing superficial handling of hard tasks)

Output

  • Scalar score [0.0, 1.0]
  • Detailed breakdown by difficulty
  • Passing status (score > 0.8)