🏆 Built for the HackerRank Agentic AI Hackathon
A terminal-based support triage agent that handles support tickets across three ecosystems:
- HackerRank — https://support.hackerrank.com
- Claude — https://support.claude.com/en/
- Visa — https://www.visa.co.in/support.html
For each support ticket the agent:
- Identifies the domain — uses the
companyfield or infers it via keyword scoring whencompanyisNone - Detects cross-domain confusion — if the ticket content belongs to a different domain than declared, it auto-corrects
- Detects multiple requests — flags tickets containing more than one distinct issue
- Runs safety pre-classification — catches prompt injection, malicious requests, sensitive triggers, and out-of-scope topics before the LLM
- Retrieves relevant corpus — uses TF-IDF weighted scoring to extract the most relevant paragraphs from the scraped support corpus
- Classifies and responds — sends the ticket + corpus snippet to an LLM with strict grounding rules
- Validates output — sanitizes all fields before writing to CSV
pip install -r requirements.txtcp .env.example .env
# Edit .env and add your Groq API key (free at console.groq.com)python scrape_corpus.pyCreates corpus/hackerrank.txt, corpus/claude.txt, corpus/visa.txt from the live support sites.
Put support_tickets.csv in the project root.
python agent.pyOutputs output.csv and log.txt.
.
├── agent.py # Main triage agent
├── scrape_corpus.py # One-time corpus scraper
├── scrape_hackerrank_only.py # Re-scrape HackerRank + Claude only
├── requirements.txt # Python dependencies
├── .env.example # API key template
├── corpus/
│ ├── hackerrank.txt # Scraped HackerRank support docs
│ ├── claude.txt # Scraped Claude support docs
│ └── visa.txt # Scraped Visa support docs
├── support_tickets.csv # Input tickets
├── output.csv # Agent predictions
└── log.txt # Full run transcript
| Field | Allowed Values |
|---|---|
status |
replied, escalated |
product_area |
Support category string |
response |
User-facing answer grounded in corpus |
justification |
Internal reasoning + corpus source + retrieval confidence |
request_type |
product_issue, feature_request, bug, invalid |
Rare domain-specific terms (e.g. "chargeback", "proctoring", "impersonation") score higher than common words, ensuring the most relevant corpus paragraphs are selected for each ticket.
Runs before the LLM and catches:
- Prompt injection — instruction overrides, identity manipulation, information extraction attempts, jailbreaks (categorized by type)
- Malicious requests — harmful code requests, system attacks
- Sensitive triggers — identity theft, fraud, security vulnerabilities, subscription changes
- Out-of-scope topics — irrelevant or off-domain queries
- Vague tickets — requests too ambiguous to classify
Detects when a ticket's content belongs to a different domain than the declared company field and automatically corrects the routing.
Flags tickets containing multiple distinct requests, ensuring complex tickets are handled appropriately.
Every LLM-generated response includes the exact corpus URL and retrieval confidence score in the justification field, making all decisions fully traceable.
The agent escalates when:
- Fraud, identity theft, or account compromise is detected
- Account access loss or unauthorized access
- Security vulnerabilities or bug bounty reports
- Billing disputes with specific order IDs
- Legal threats or compliance concerns
- Prompt injection or adversarial manipulation detected
- Subscription cancellation or pausing requests
- Corpus does not contain sufficient information to answer safely
Built as a submission for the HackerRank Agentic AI Hackathon.