Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS" : "1"
}
}
4 changes: 4 additions & 0 deletions .claude/skills/analyze-problem-statement/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: "analyze-problem-statement"
description: "Analyze the problem statement that have been given and identify key components such as the problem, constraints, and desired outcomes."
---
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# secrets
.env
.env.example
.env.local
*.pem
*.key
Expand Down Expand Up @@ -29,5 +30,7 @@ Thumbs.db
# local data / caches the participant may create
data/index/
data/embeddings/
code/index/
code/runs/
*.sqlite
*.db
50 changes: 50 additions & 0 deletions code/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# HackerRank Orchestrate Triage Agent

Terminal-based, corpus-grounded support triage agent. Reads
`support_tickets/support_tickets.csv`, classifies each ticket, retrieves
relevant snippets from `data/{hackerrank,claude,visa}/`, generates a
grounded response (or escalates), and writes `support_tickets/output.csv`.

## Install

```bash
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # macOS / Linux
pip install -r code/requirements.txt
cp .env.example .env
# Edit .env: set ANTHROPIC_API_KEY=sk-ant-...
```

## Build the corpus index (one-time, ~5 min)

```bash
python code/indexer.py --rebuild
```

Index artifacts land under `code/index/` and are gitignored.

## Run the agent

```bash
python code/main.py --input support_tickets/support_tickets.csv \
--output support_tickets/output.csv
```

Optional flags:

- `--limit 5` process the first 5 rows only (dev iteration)
- `--rebuild-index` force corpus reindex
- `--trace-dir DIR` per-run JSONL trace location (default `code/runs/`)
- `--config PATH` alternate config.yaml path

## Run tests

```bash
pytest code/tests/
```

## Environment variables

See `.env.example`. `ANTHROPIC_API_KEY` is required; everything else has
defaults in `code/config.yaml`.
55 changes: 55 additions & 0 deletions code/_smoke_probe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""Tiny smoke probe — verifies the live Anthropic API works for our classifier.

Cost: ~200 input + ~100 output tokens on claude-sonnet-4-5 -> ~$0.0021.

Run: python code/_smoke_probe.py
Requires: ANTHROPIC_API_KEY in .env at repo root.
"""

from __future__ import annotations

import os
import sys
from pathlib import Path

# Ensure code/ is on sys.path so `from preprocessor import ...` resolves.
sys.path.insert(0, str(Path(__file__).resolve().parent))

from dotenv import load_dotenv

load_dotenv(Path(__file__).resolve().parent.parent / ".env")

if not os.getenv("ANTHROPIC_API_KEY"):
print("FAIL: ANTHROPIC_API_KEY not in environment after loading .env")
sys.exit(2)

from classifier import classify # noqa: E402
from preprocessor import clean # noqa: E402
from schemas import Ticket # noqa: E402

ticket = Ticket(
index=0,
issue="I cannot cancel a test invite for a candidate. The Cancel button is greyed out.",
subject="Cannot cancel test invite",
company="HackerRank",
)

cleaned = clean(ticket)
print(f"[probe] preprocessor OK: injection={cleaned.injection_detected}")

try:
result = classify(cleaned)
except Exception as exc:
print(f"FAIL: classifier raised {type(exc).__name__}: {exc}")
sys.exit(3)

print(f"[probe] classifier OK")
print(f" request_type = {result.request_type}")
print(f" domain = {result.domain} (conf={result.domain_confidence:.2f})")
print(f" product_area = {result.product_area} (conf={result.product_area_confidence:.2f})")
print(f" is_outage = {result.is_outage_report}")
print(f" is_chitchat = {result.is_chitchat_or_trivia}")
print(f" is_sensitive = {result.is_sensitive}")
print(f" is_authz_violation = {result.is_authorization_violation}")
print(f" is_multi_request = {result.is_multi_request}")
print("[probe] PASS")
13 changes: 13 additions & 0 deletions code/agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""Re-export module for the AGENTS.md section 6.1 entry-point contract.

Some evaluator scripts look for ``code/agent.py``; others look for
``code/main.py``. Both paths resolve to the same pipeline.
"""

from __future__ import annotations

from main import _process_ticket as process_ticket # noqa: F401
from main import run # noqa: F401


__all__ = ["run", "process_ticket"]
Loading