Files · Anthropic Multi-Agent Handoff for Freshdesk SMB Support Triage
64 (1 binary, 658.4 kB total)attempt 1
README.md·3222 B·markdown
markdown
# Anthropic Multi-Agent Handoff for Freshdesk SMB Support Triage
AI-driven triage that classifies and routes Freshdesk support tickets to specialized AI agents using Anthropic Claude, with confidence-based human escalation when classification is uncertain.
## Features
- **Claude-powered intent classification** — Classifies ticket subject+description into support categories (billing, technical, account, general, emergency) using Anthropic Claude Haiku
- **Multi-agent routing** — Routes tickets to specialist agents (billing, technical, account) via `@reaatech/agent-handoff-routing` with weighted skill matching
- **Confidence-gated decisions** — Uses `@reaatech/confidence-router` to decide whether to auto-resolve, ask clarifying questions, or escalate to a human
- **Session continuity** — Maintains ticket context across multiple turns using `@reaatech/session-continuity` with token budget enforcement and sliding-window compression
- **Conversation compression for human escalation** — Compresses ticket conversation history using `@reaatech/agent-handoff-compression` (summary + key facts + open items)
- **Freshdesk webhook integration** — Receives ticket created/updated events via `@reaatech/agent-mesh-gateway` and posts triage results back as Freshdesk notes
- **LangGraph state machine** — Orchestrates the triage pipeline as a LangGraph state graph (classify → confidence gate → route/escalate)
- **Langfuse observability** — Tracks triage lifecycle events and LLM calls via Langfuse
## Architecture
```
Freshdesk Webhook → POST /webhook/freshdesk/ticket
↓
normalizeTicket(raw) → NormalizedTicket
↓
TriageAgent.runTriage(ticket)
↓
┌─────────────────────────────────────┐
│ LangGraph State Machine │
│ │
│ classify → route → selectSpecialist│
│ ↘ clarify │
│ ↘ escalate │
└─────────────────────────────────────┘
↓
Route decision:
• ROUTE → Post note with specialist assignment
• CLARIFY → Post note requesting more info
• FALLBACK → Escalate to human with compressed summary
```
## Getting Started
### Prerequisites
- Node.js >= 22
- pnpm 10.x
- A Freshdesk account with API key
- An Anthropic API key
- (Optional) Langfuse account for tracing
### Setup
```bash
pnpm install
cp .env.example .env
# Fill in your API keys in .env
pnpm dev
```
## API Reference
### POST /webhook/freshdesk/ticket
Receives Freshdesk ticket created/updated events. Accepts Freshdesk webhook payload.
### POST /api/triage
On-demand ticket triage. Accepts `{ subject: string, description: string }`. Returns `{ action, specialistAgent, confidence }`.
### GET /api/triage
Health check. Returns `{ status: "ok" }`.
## Testing
```bash
pnpm test
```
Runs vitest with coverage reporting. Targets >=90% coverage on runtime code (src/**/*.ts and app/**/route.ts). UI components are excluded from coverage thresholds.
## License
MIT