Follow Discord
Sweep 09 Oct 2026 · 17:27Z Build v2.1.296 517 read Stable v2.1.287 Latest v2.1.296 Next v2.1.296 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

Create an instance of the Claude API client changedabout-claude/use-case-guides/ticket-routing

Nearest release: v2.1.293, published an hour before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+41added
Lines−9removed
From line 235 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits5to this page, all time

The whole hunk

from line 235, old and new numbered
/
lines
from line 235
235235 
236236The choice of model depends on the trade-offs between cost, accuracy, and response time.
237237 
238Many customers have found `claude-haiku-4-5-20251001` an ideal model for ticket routing, as it is the fastest and most cost-effective model in the Claude 4 family while still delivering excellent results. If your classification problem requires deep subject matter expertise or a large volume of intent categories, or complex reasoning, you may opt for the [larger Sonnet model](https://platform.claude.com/docs/en/models/overview).
238Claude Haiku 5.5 (`claude-haiku-5-5`) suits ticket routing: it's the fastest and most cost-effective current model, and at `low` effort it handles simple, high-volume requests such as classification. If your classification problem requires deep subject matter expertise or a large volume of intent categories, or complex reasoning, you may opt for the [larger Sonnet model](https://platform.claude.com/docs/en/models/overview).
239239 
240240### Build a strong prompt
241241 
from line 307
307307```
308308 
309309<Note>
310 This prompt is written for Claude Haiku 4.5, which runs here without thinking. On Claude Fable 5.1, Claude Fable 5, Claude Opus 5.5, Claude Opus 5, and Claude Sonnet 5.5, ask for the intent and a one-sentence summary of the request instead. See [Keep reasoning in thinking blocks](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#keep-reasoning-in-thinking-blocks).
310 This prompt is written for Claude Haiku 5.5, which runs here at `low` effort. On Claude Fable 5.1, Claude Fable 5, Claude Opus 5.5, Claude Opus 5, and Claude Sonnet 5.5, ask for the intent and a one-sentence summary of the request instead. See [Keep reasoning in thinking blocks](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#keep-reasoning-in-thinking-blocks).
311311</Note>
312312 
313313Here are the key components of this prompt:
from line 333
333333client = anthropic.Anthropic()
334334 
335335# Set the default model
336DEFAULT_MODEL = "claude-haiku-4-5-20251001"
336DEFAULT_MODEL = "claude-haiku-5-5"
337337 
338338 
339339def classify_support_request(ticket_contents):
from line 345
345345 # Send the prompt to the API to classify the support request.
346346 message = client.messages.create(
347347 model=DEFAULT_MODEL,
348 max_tokens=500,
348 max_tokens=2048,
349 output_config={"effort": "low"},
349350 messages=[{"role": "user", "content": classification_prompt}],
350351 stream=False,
351352 )
352 reasoning_and_intent = message.content[0].text
353 reasoning_and_intent = next(
354 (block.text for block in message.content if block.type == "text"), ""
355 )
353356 
354357 # Use Python's regular expressions library to extract `reasoning`.
355358 reasoning_match = re.search(
from line 402
399402client = anthropic.Anthropic()
400403 
401404# Set the default model
402DEFAULT_MODEL = "claude-haiku-4-5-20251001"
405DEFAULT_MODEL = "claude-haiku-5-5"
403406 
404407 
405408def classify_support_request(request, actual_intent):
from line 414
411414 
412415 message = client.messages.create(
413416 model=DEFAULT_MODEL,
414 max_tokens=500,
417 max_tokens=2048,
418 output_config={"effort": "low"},
415419 messages=[{"role": "user", "content": classification_prompt}],
416420 )
417421 usage = message.usage # Get the usage statistics for the API call for how many input and output tokens were used.
418 reasoning_and_intent = message.content[0].text
422 reasoning_and_intent = next(
423 (block.text for block in message.content if block.type == "text"), ""
424 )
419425 
420426 # Use Python's regular expressions library to extract `reasoning`.
421427 reasoning_match = re.search(
from line 469
463469 
464470For example, you might have a top-level classifier that broadly categorizes tickets into "Technical Issues," "Billing Questions," and "General Inquiries." Each of these categories can then have its own sub-classifier to further refine the classification.
465471 
466![Classifier hierarchy routing tickets to Technical Issues, Billing Questions, or General Inquiries, each with a sub-classifier](https://platform.claude.com/docs/images/ticket-hierarchy.png)
472```mermaid
473---
474config:
475 flowchart:
476 nodeSpacing: 10
477 rankSpacing: 60
478 padding: 8
479 wrappingWidth: 300
480---
481flowchart LR
482 accTitle: Hierarchy of ticket classifiers
483 accDescr: Classifier hierarchy routing tickets to Technical Issues, Billing Questions, or General Inquiries, each with a sub-classifier
484 tickets[Support Tickets] --> technical[Technical Issues]
485 tickets --> billing[Billing Questions]
486 tickets --> general[General Inquiries]
487 technical --> software[Software Installation]
488 technical --> hardware[Hardware Troubleshooting]
489 technical --> network[Network Connectivity]
490 technical --> technicalMore[...]
491 billing --> invoice[Invoice Clarification]
492 billing --> payment[Payment Processing]
493 billing --> refund[Refund Requests]
494 general --> product[Product Information]
495 general --> order[Order Status]
496 general --> partnership[Partnership Opportunities]
497 general --> generalMore[...]
498```
467499 
468500* **Pros - greater nuance and accuracy:** You can create different prompts for each parent path, allowing for more targeted and context-specific classification. This can lead to improved accuracy and more nuanced handling of customer requests.
469501 
Feedback