A production-grade, fully offline support-triage pipeline that ingests raw support tickets, classifies them across three enterprise domains, evaluates risk and safety, retrieves grounded documentation, and generates safe β or escalates sensitive β responses. No LLM API calls. No hallucinations.
| Capability | Detail |
|---|---|
| π·οΈ Multi-signal classification | Weighted n-gram taxonomy with TF-IDF normalization, exclusivity bonus & confidence calibration |
| π BM25-inspired retrieval | Dual-signal ranking (TF-IDF cosine + Jaccard-like lexical overlap) with length normalization |
| π‘οΈ 4-tier safety engine | Critical β High β Medium β Low risk matrix with diminishing-returns scoring & audit trail |
| π Grounded responses | Sentence-level extraction from corpus β zero fabricated policies |
| β‘ Fast & offline | Pure NumPy/sklearn pipeline; processes 100+ tickets per minute on a laptop |
| π Full observability | Per-ticket confidence scores, processing time (ms), and escalation reasons exported to CSV |
orchestrate-support-agent/
β
βββ code/
β βββ main.py # π Entry point β orchestrates the full pipeline
β βββ classifier.py # π·οΈ Multi-signal domain & request-type classifier
β βββ retriever.py # π BM25-inspired TF-IDF retriever with query expansion
β βββ safety.py # π‘οΈ 4-tier risk engine with confidence-adjusted thresholds
β βββ responder.py # π Sentence-extraction response generator
β
βββ data/
β βββ hackerrank/ # Scraped HackerRank support corpus (.txt / .md / .html)
β βββ claude/ # Claude Help Center corpus
β βββ visa/ # Visa Support corpus
β
βββ support_tickets/
β βββ sample_support_tickets.csv # Labelled examples for validation
β βββ support_tickets.csv # π― Competition input β run the agent against this
β βββ output.csv # β
Agent-generated results
β
βββ .env.example # Copy β .env and fill in any optional API keys
βββ AGENTS.md # Agent-framework rules & logging contract
βββ README.md # You are here
βββββββββββββββββββββββββββββββββββββββ
β support_tickets.csv β
β issue | subject | company β
ββββββββββββββββββββ¬βββββββββββββββββββ
β for each row
βΌ
βββββββββββββββββββββββββββ
β π·οΈ CLASSIFIER β
β βββββββββββββββββββββ β
β β’ n-gram keyword match β
β β’ TF-IDF score per β
β domain β
β β’ Exclusivity bonus β
β β’ Confidence 0 β 1 β
ββββββββββββββ¬βββββββββββββ
β
βββββββββββββββββββΌβββββββββββββββββββ
β Confidence < threshold? β
β YES βββΊ ESCALATE β
β NO βββΊ continue β
βββββββββββββββββββ¬βββββββββββββββββββ
β
ββββββββββββββΌβββββββββββββ
β π‘οΈ SAFETY ENGINE β
β βββββββββββββββββββββ β
β Critical / High β β
β auto-escalate β
β Medium + low conf β β
β escalate β
β Low β pass through β
ββββββββββββββ¬βββββββββββββ
β
βββββββββββββββββββΌβββββββββββββββββββ
β Safety triggered? β
β YES βββΊ ESCALATE (with reason) β
β NO βββΊ continue β
βββββββββββββββββββ¬βββββββββββββββββββ
β
ββββββββββββββΌβββββββββββββ
β π RETRIEVER β
β βββββββββββββββββββββ β
β β’ Domain-specific index β
β β’ Query expansion β
β β’ BM25 normalization β
β β’ Lexical blend β
β β’ top-k chunks β
ββββββββββββββ¬βββββββββββββ
β
ββββββββββββββΌβββββββββββββ
β π RESPONDER β
β βββββββββββββββββββββ β
β β’ Sentence extraction β
β β’ Quality filtering β
β β’ Token overlap scoring β
ββββββββββββββ¬βββββββββββββ
β
βββββββββββββββββββΌβββββββββββββββββββ
β output.csv β
β status | product_area | response β
β justification | request_type β
β classification_confidence β
β response_confidence | proc_ms β
βββββββββββββββββββββββββββββββββββββββ
Classifies every ticket into a product domain and request type using a weighted keyword taxonomy β no LLM required.
- Domains:
hackerRank_assessmentsΒ·claude_platformΒ·visa_paymentsΒ·general_support - Request types:
bugΒ·feature_requestΒ·billing_disputeΒ·securityΒ·product_issueΒ·invalid - Confidence model: match density + exclusivity bonus β calibrated score [0, 0.98]
Builds per-domain TF-IDF indices at startup and retrieves the most relevant corpus chunks for each ticket.
| Feature | Implementation |
|---|---|
| Indexing | TfidfVectorizer with bigrams & sublinear TF, 8 000 max features |
| Ranking | (1 - 0.35) Γ TF-IDF cosine + 0.35 Γ lexical overlap |
| Length norm | BM25 b = 0.4 normalization to prevent long-chunk bias |
| Query expansion | Suffix-stemming & synonym seeds (e.g., payment β pay, api β endpoint) |
| Chunking | 200-word windows, 40-word overlap, 15-word minimum |
| Fallback | Primary domain β general_support if no docs found |
Every ticket is scanned against a compiled pattern library before any response is generated.
| Tier | Auto-Escalate? | Example Triggers |
|---|---|---|
| π΄ Critical | Always | account compromised, identity theft, data breach |
| π High | Always | fraud, stolen card, phishing, hack |
| π‘ Medium | If confidence < 0.5 or composite score β₯ 4.0 | refund, account locked, double charge |
| π’ Low | Never (score reducer) | "how do I", "documentation", "what is" |
Diminishing returns prevent score inflation when multiple patterns of the same tier fire.
Extracts the single best-matching sentence from retrieved corpus chunks β never invents information.
- Filters out boilerplate, navigation fragments, headings, and questions
- Scores remaining sentences by token overlap with the query
- Falls back to any well-formed sentence if no high-overlap match is found
- Ensures capitalization and terminal punctuation
pip install pandas numpy scikit-learnPlace scraped support documentation under data/:
data/
hackerrank/ β HackerRank support pages (.txt / .md / .html)
claude/ β Claude Help Center pages
visa/ β Visa Support pages
The retriever auto-detects the domain from the directory name. Any
.txt,.md, or.htmlfile is indexed.
cd code
python main.pyThe agent reads ../support_tickets/support_tickets.csv, processes every row through the full pipeline, and writes results to ../support_tickets/output.csv.
Sample terminal output:
π Loading domain-specific support corpus...
β
Retriever ready β 1 842 chunks across 3 domains.
[1] Processing...
[2] Processing...
...
[N] Processing...
β
output.csv updated successfully!
| Column | Type | Values |
|---|---|---|
status |
string | replied Β· escalated |
product_area |
string | hackerRank_assessments Β· claude_platform Β· visa_payments Β· general_support |
response |
string | User-facing answer or escalation message |
justification |
string | Why this decision was made |
request_type |
string | product_issue Β· feature_request Β· bug Β· invalid |
classification_confidence |
float | 0.0 β 1.0 |
response_confidence |
float | 0.0 β 1.0 |
processing_ms |
int | Wall-clock time per ticket in milliseconds |
- Corpus-grounded only β the agent never uses outside knowledge or pre-trained LLM completions. Every response is extracted verbatim or synthesized exclusively from the provided documentation corpus.
- Fail safe β when in doubt, escalate. Low confidence, missing docs, and critical risk patterns all route to a human agent.
- Full auditability β every output row carries confidence scores, risk tier, and processing time so evaluators can trace every decision.
- Zero external calls β the entire pipeline runs locally with no network dependency at inference time.
| Criterion | How this agent addresses it |
|---|---|
Correct status |
Safety engine + confidence thresholds provide deterministic escalation logic |
Correct product_area |
Weighted n-gram taxonomy with exclusivity calibration |
Grounded response |
Sentence extraction β only corpus text, never hallucinated |
Meaningful justification |
Escalation reason or domain attribution appended to every row |
Correct request_type |
Regex pattern hierarchy ordered from most β least specific |
Built for the HackerRank Orchestrate hackathon (May 2026).
Support corpus sourced from:
