This prompt is designed for operations and platform engineering teams that manage multiple support queues and need a reliable, auditable way to route incoming tickets. The core job-to-be-done is to replace brittle, rule-based routing with a few-shot classifier that learns your team taxonomy directly from historical examples. The ideal user is a technical lead or engineer who has access to a corpus of previously routed tickets and needs to integrate routing decisions into an existing ticketing API. You should use this prompt when your routing destinations are stable, your ticket volume justifies automation, and you require consistent, explainable decisions that include confidence scores and fallback rules.
Prompt
Multi-Team Ticket Routing Prompt Template

When to Use This Prompt
A practical guide for operations and platform engineering teams to automatically route support tickets to the correct team using example-based classification.
This approach is not a fit for every situation. Avoid using this prompt if your team structure or routing taxonomy changes daily, as the few-shot examples will drift out of date and require constant maintenance. It is also not a replacement for a full NLU pipeline when you need to extract complex entities or perform multi-step reasoning before routing; this prompt focuses on classification, not deep ticket analysis. Finally, do not use this prompt in isolation for high-stakes tickets where a misroute could cause a security incident or a regulatory breach—always pair it with a human-in-the-loop review step for those cases. The prompt works best as a component in a larger triage system, not as the sole decision-maker.
Before you copy the template, gather at least 5–10 representative examples per routing destination, including edge cases where tickets could reasonably go to two different teams. These examples are the engine of the prompt; without them, the model will default to guessing. Once you have your examples, integrate the prompt into your application with a validation layer that checks the output schema, enforces your confidence threshold, and logs every decision for audit. The next section provides the copy-ready template and explains how to adapt the placeholders to your environment.
Use Case Fit
Where this prompt works, where it fails, and the operational conditions required before putting it into a production triage pipeline.
Good Fit: Stable Team Boundaries
Use when: your organization has well-defined, non-overlapping support queues with documented ownership. The prompt performs best when team responsibilities are stable and examples reflect real routing decisions. Avoid when: teams are reorganizing, queues are shared, or routing rules change weekly.
Bad Fit: Novel or Unseen Ticket Categories
Risk: few-shot examples cannot cover categories that didn't exist at prompt design time. New product areas, acquisitions, or reorgs produce tickets that fall outside the example distribution. Guardrail: implement a confidence threshold below which tickets route to a triage queue for manual labeling and example refresh.
Required Inputs: Labeled Routing Examples
What you need: a curated set of 8-20 ticket-to-team examples covering each target queue, including edge cases where routing is ambiguous. Examples must reflect real ticket language, not idealized descriptions. Guardrail: validate examples quarterly against recent production tickets to detect drift in language or team scope.
Operational Risk: Cross-Team Ambiguity
Risk: tickets that could reasonably go to multiple teams produce inconsistent routing, frustrating both agents and customers. Few-shot classifiers often flip between teams when confidence is borderline. Guardrail: define explicit tie-breaking rules and a fallback queue. Log all low-confidence decisions for human audit.
Operational Risk: Example Staleness
Risk: team names change, products are deprecated, and ticket language evolves. Examples that were accurate six months ago silently degrade classification accuracy. Guardrail: schedule monthly example review cycles. Monitor routing accuracy with a holdout set of recent tickets and trigger refresh when accuracy drops below threshold.
Not a Replacement for Rule-Based Routing
Risk: teams sometimes treat LLM routing as a complete replacement for deterministic rules, leading to unpredictable behavior on high-stakes tickets. Guardrail: use this prompt for ambiguous or unstructured tickets. Keep deterministic rules for clear-cut cases (e.g., password resets, billing disputes with known keywords) and only invoke the LLM when rules don't match.
Copy-Ready Prompt Template
A production-ready prompt template for routing support tickets to the correct team using example-based classification, with placeholders for your team definitions, labeled examples, and incoming ticket data.
This prompt template implements a multi-team ticket routing classifier that uses few-shot examples to teach the model your routing logic. Instead of writing brittle rule descriptions, you provide labeled examples showing which team handles each type of ticket. The model returns a structured JSON routing decision with confidence scores, fallback handling, and evidence extraction. Replace every square-bracket placeholder with your organization's actual team definitions, routing rules, and example tickets before deploying.
textYou are a support ticket routing classifier. Your job is to read an incoming support ticket and route it to exactly one team based on the ticket's content, urgency, and technical domain. ## TEAM DEFINITIONS [TEAM_DEFINITIONS] ## ROUTING RULES [ROUTING_RULES] ## CLASSIFICATION EXAMPLES Here are labeled examples showing correct routing decisions: [LABELED_EXAMPLES] ## INCOMING TICKET Ticket ID: [TICKET_ID] Subject: [TICKET_SUBJECT] Body: [TICKET_BODY] Customer Tier: [CUSTOMER_TIER] Attachments: [ATTACHMENT_DESCRIPTIONS] ## OUTPUT INSTRUCTIONS Return a JSON object with these fields: - "routed_team": The team identifier from TEAM DEFINITIONS that should handle this ticket - "confidence": A float between 0.0 and 1.0 indicating routing confidence - "reasoning": A brief explanation of why this team was selected, citing specific evidence from the ticket - "alternative_teams": An array of other teams that could potentially handle this ticket, ordered by relevance - "requires_escalation": Boolean indicating whether this ticket needs immediate escalation - "escalation_reason": If requires_escalation is true, explain why - "missing_information": Array of questions that need answers before confident routing is possible ## CONFIDENCE THRESHOLDS - If confidence is below [LOW_CONFIDENCE_THRESHOLD], route to [FALLBACK_TEAM] and flag for human review - If confidence is between [LOW_CONFIDENCE_THRESHOLD] and [HIGH_CONFIDENCE_THRESHOLD], include alternative_teams and flag for optional review - If confidence is above [HIGH_CONFIDENCE_THRESHOLD], route directly without review ## CONSTRAINTS - Never route a ticket to a team not listed in TEAM DEFINITIONS - If the ticket spans multiple domains, select the team best equipped to handle the primary issue - For security incidents, always set requires_escalation to true regardless of confidence - For [HIGH_PRIORITY_CUSTOMER_TIERS], apply [ESCALATION_OVERRIDE_RULES] - If the ticket contains [SENSITIVE_DATA_INDICATORS], add a "data_handling_note" field to the output
To adapt this template for your organization, start by defining your team list in the [TEAM_DEFINITIONS] placeholder. Each team entry should include the team name, a unique identifier, their areas of responsibility, and any domain-specific keywords that help the model distinguish between similar teams. For example: billing_team: Handles invoice disputes, payment failures, subscription changes, and refund requests. Keywords: invoice, payment, charge, refund, billing cycle. Next, populate [LABELED_EXAMPLES] with at least 5-10 real or representative tickets per team, covering common cases, edge cases, and ambiguous cross-team scenarios. Each example should show the ticket content and the correct routing decision. Include negative examples where tickets were initially misrouted to teach the model boundary cases. Set [LOW_CONFIDENCE_THRESHOLD] to 0.6 and [HIGH_CONFIDENCE_THRESHOLD] to 0.85 as starting points, then adjust based on your tolerance for false positives versus missed escalations. The [FALLBACK_TEAM] should be a real team or queue that can manually triage uncertain cases—never route low-confidence tickets into a void.
Before deploying this prompt, build a validation layer in your application code that checks the model's JSON output against your team identifiers. Reject any routing decision that references a team not in your current team registry. Log every routing decision with the ticket ID, confidence score, and selected team for later evaluation. Set up a weekly review of low-confidence and fallback-routed tickets to identify gaps in your example coverage. If you notice consistent misrouting for specific ticket types, add those cases as new labeled examples rather than trying to fix the behavior through instruction changes alone. For high-risk domains like security incidents or legal matters, always require human approval before the routing decision takes effect, regardless of the model's confidence score.
Prompt Variables
Required inputs for the Multi-Team Ticket Routing Prompt Template. Each placeholder must be populated before the prompt is sent to the model. Missing or malformed variables will cause routing failures or fallback to the default queue.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TICKET_CONTENT] | The full text of the incoming support ticket, including subject, body, and any user-provided metadata | Subject: Cannot access billing portal Body: I've tried resetting my password three times but the reset email never arrives. Urgent - need to download invoices for audit. | Non-empty string required. Minimum 10 characters. Truncate to 8000 tokens if longer. Strip HTML but preserve line breaks. |
[TEAM_DEFINITIONS] | JSON array of team objects with name, description, and example tickets that belong to that team | [{"team":"Billing","description":"Handles invoices, payments, plan changes, and billing portal access","examples":["Invoice not generating","Credit card charge disputed"]},{"team":"Auth","description":"Handles login, SSO, MFA, password resets, and account lockouts","examples":["Password reset email not arriving","MFA code expired"]}] | Valid JSON array required. Each object must have team, description, and examples fields. Minimum 2 teams. Examples array must have at least 2 entries per team. |
[FALLBACK_TEAM] | The default team name to route tickets to when confidence is below threshold or classification is ambiguous | Tier1-General | Non-empty string. Must match exactly one team name from [TEAM_DEFINITIONS]. If null, prompt must route to a hardcoded default queue in application code. |
[CONFIDENCE_THRESHOLD] | Minimum confidence score required for automatic routing. Tickets below this threshold are routed to [FALLBACK_TEAM] or flagged for human review | 0.75 | Float between 0.0 and 1.0. Values below 0.5 produce excessive fallback. Values above 0.95 may cause unnecessary human escalation. Validate as numeric before prompt assembly. |
[AMBIGUITY_EXAMPLES] | Few-shot examples showing tickets that span multiple teams and how the model should resolve ambiguity | [{"ticket":"I can't log in and my last invoice looks wrong","correct_team":"Auth","reasoning":"Login issue blocks access to billing; resolve auth first, then escalate to Billing if needed"}] | Valid JSON array required. Each object must have ticket, correct_team, and reasoning fields. Include at least 3 examples covering different ambiguity patterns. Reasoning must be under 200 characters. |
[OUTPUT_SCHEMA] | The expected JSON structure for the routing decision, including team, confidence, reasoning, and escalation flag | {"routed_team":"string","confidence":"float","reasoning":"string","requires_human_review":"boolean","alternative_teams":["string"]} | Valid JSON schema definition required. routed_team must match a team name from [TEAM_DEFINITIONS]. confidence must be 0.0-1.0. reasoning must be non-empty. requires_human_review must be boolean. alternative_teams must be an array of strings. |
[MAX_EXAMPLES_PER_TEAM] | Upper limit on how many few-shot examples to include per team to control token usage and prevent overfitting | 5 | Integer between 2 and 10. Values above 10 risk context window overflow and example dilution. Values below 2 reduce classification accuracy for nuanced teams. Validate as integer before prompt assembly. |
[PRIORITY_SIGNALS] | Keywords or patterns that indicate urgency and should influence routing priority without changing team assignment | ["urgent","outage","data loss","security","cannot access","deadline"] | Valid JSON array of strings required. Each signal must be lowercase. Maximum 20 signals. Signals longer than 50 characters are ignored. Empty array is allowed if priority routing is not needed. |
Implementation Harness Notes
How to wire the multi-team ticket routing prompt into a production application with validation, retries, and observability.
The routing prompt is not a standalone artifact; it is a decision node inside a larger triage pipeline. The application layer is responsible for assembling the prompt with the correct [TICKET], [ROUTING_EXAMPLES], [TEAM_DEFINITIONS], and [CONFIDENCE_THRESHOLD] values before each call. The model returns a structured JSON payload containing the routed_team, confidence_score, fallback_teams, and evidence. Your harness must validate this output against the expected schema before acting on the routing decision. A common failure mode is treating the model's output as authoritative without checking whether the confidence score exceeds the configured threshold or whether the returned team ID actually exists in the current team roster.
Build the harness around a route_ticket function that accepts a ticket object and returns a routing decision. Inside this function, construct the prompt by injecting the ticket text, a curated set of few-shot examples drawn from a version-controlled example store, and the current team definitions from your routing configuration service. Call the model with response_format set to json_schema (or the equivalent structured output mode for your provider) using a schema that enforces routed_team: string, confidence_score: float, fallback_teams: array of strings, and evidence: string. After receiving the response, run three validation checks: (1) schema conformance, (2) team ID existence against the live team registry, and (3) confidence threshold comparison. If confidence is below the configured [CONFIDENCE_THRESHOLD], route to the designated fallback queue or a human triage review step. Log every routing decision with the ticket ID, model response, validation results, and final routing destination for later eval and drift analysis.
For high-volume production use, implement a lightweight retry strategy for transient model failures or malformed outputs. If the model returns invalid JSON or a team ID that does not exist, retry once with the same prompt. If the second attempt also fails, escalate to a human review queue and log the failure for prompt debugging. Do not retry more than twice on the same input; repeated failures indicate a prompt or example-set problem, not a transient error. Instrument the harness to emit metrics on routing latency, confidence score distributions, fallback rates, and human escalation rates. These metrics feed into your example drift detection and prompt regression testing workflows. Finally, version your prompt template and example sets together in the same repository as your harness code, and gate production deployments on eval runs that measure routing accuracy against a golden dataset of pre-classified tickets.
Expected Output Contract
Define the exact fields, types, and validation rules for the routing output. Use this contract to build a parser that rejects malformed responses before they reach downstream systems.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
routing_decision | object | Top-level object must parse as valid JSON. Reject if root is array, string, or null. | |
routing_decision.primary_team | string | Must match one of the allowed team slugs in [TEAM_LIST]. Reject unknown values. | |
routing_decision.confidence_score | number | Must be float between 0.0 and 1.0 inclusive. Reject if out of range or non-numeric. | |
routing_decision.fallback_teams | array of strings | If present, each element must match an allowed team slug. Reject if any unknown slug found. | |
routing_decision.reasoning | string | Must be non-empty string. Must cite at least one specific detail from [TICKET_CONTENT]. Reject if generic or empty. | |
routing_decision.ambiguous_signals | array of strings | If confidence_score < [CONFIDENCE_THRESHOLD], this field is required. Each element must be a short phrase describing a conflicting signal. | |
routing_decision.escalation_required | boolean | Must be true or false. If true, primary_team must be [FALLBACK_TEAM] or confidence_score must be below [CONFIDENCE_THRESHOLD]. | |
routing_decision.matched_example_index | integer or null | If the model used a specific example from [FEW_SHOT_EXAMPLES], provide its 0-based index. Null if no single example matched. Must be integer or null. |
Common Failure Modes
What breaks first when routing tickets across multiple teams and how to prevent misrouting in production.
Cross-Team Ambiguity Drift
What to watch: Tickets that could reasonably belong to two or more teams produce inconsistent routing when the model latches onto secondary signals instead of primary intent. This is most common with overlapping product areas or shared infrastructure issues. Guardrail: Add explicit tie-breaking examples that show the model how to choose when categories overlap. Implement a confidence threshold below which tickets route to a triage queue for human review rather than auto-assignment.
Example Set Staleness
What to watch: Team structures, product names, and routing rules change over time, but few-shot examples remain frozen. The model continues routing based on outdated team boundaries, sending tickets to renamed or dissolved queues. Guardrail: Version your example sets alongside team directory changes. Run weekly eval passes comparing routing decisions against current team assignments and flag examples referencing deprecated team names or product areas.
Low-Confidence Silent Misroutes
What to watch: The model assigns a team with moderate confidence but doesn't surface uncertainty. Tickets land in the wrong queue without any signal that the routing was uncertain, delaying resolution. Guardrail: Require the output schema to include a confidence_score field and a routing_rationale field. Set a minimum confidence threshold (e.g., 0.7) below which tickets are flagged for manual review or routed to a fallback generalist queue.
Multi-Team Ticket Fragmentation
What to watch: Tickets requiring input from multiple teams get routed to only one team based on the dominant signal, leaving cross-functional dependencies unaddressed. The ticket bounces between queues or stalls. Guardrail: Include few-shot examples demonstrating multi-team assignments with a primary_team and secondary_teams array. Add a post-routing check that detects dependency keywords and flags tickets for coordination workflows.
Prompt Injection via Ticket Content
What to watch: Malicious or accidental prompt-like language in ticket bodies overrides routing instructions, causing the model to route based on injected commands rather than actual ticket content. Guardrail: Place ticket content in a clearly delimited [TICKET_CONTENT] block with explicit instructions to ignore any routing directives found within. Pre-process inputs to strip common injection patterns before classification. Log and review any routing decision where the rationale references content outside the delimited block.
Edge-Case Ticket Format Mismatch
What to watch: Tickets arriving via email, API, chat, or web forms have different structures, lengths, and metadata. The model performs well on the format represented in examples but degrades on unseen formats. Guardrail: Include examples spanning all input channels in your few-shot set. Normalize ticket content to a consistent structure before classification. Run eval passes stratified by input source to detect format-specific accuracy drops.
Evaluation Rubric
Use this rubric to test the routing prompt's output quality before shipping. Each criterion targets a specific failure mode in multi-team ticket classification.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Primary Team Assignment Accuracy | Assigned team matches the golden label for the ticket's core issue in ≥95% of test cases | Output team differs from expected label; model selects a tangentially related team instead of the correct owner | Run against a golden dataset of 200 labeled tickets spanning all teams and common edge cases |
Confidence Score Calibration | Confidence score ≥0.85 for unambiguous tickets; score ≤0.65 for tickets with genuine cross-team ambiguity | High confidence (>0.9) on ambiguous tickets or low confidence (<0.5) on clear-cut tickets | Compare confidence scores against human-rated ambiguity labels on a 50-ticket calibration set |
Fallback Routing Trigger | Fallback team is returned only when no primary team exceeds the [CONFIDENCE_THRESHOLD] and the ticket touches ≥2 teams | Fallback triggers on single-team tickets with moderate confidence or fails to trigger on genuinely ambiguous cross-team issues | Inject 20 multi-team tickets with known ambiguity; verify fallback fires only when expected |
Evidence Citation Completeness | Every team assignment includes ≥1 quoted phrase from the ticket body that justifies the routing decision | Output contains a team label with no evidence citation, or the citation references irrelevant ticket text | Parse output for non-empty evidence field; spot-check 30 outputs for citation relevance to the assigned team |
Output Schema Compliance | Response is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed | Missing required fields, extra undeclared fields, or type mismatches (e.g., string where array is expected) | Validate all outputs against the JSON schema using a programmatic validator; reject any non-conforming responses |
Multi-Team Ambiguity Handling | When ≥2 teams are plausible, the output includes a secondary_teams array with ranked alternatives and confidence scores | Ambiguous tickets receive only a single team assignment with no alternatives listed | Test with 15 tickets designed to span two teams equally; verify secondary_teams is populated and ranked |
Edge-Case Ticket Handling | Tickets with minimal text, non-English content, or unusual formatting still receive a team assignment or explicit fallback | Model returns null, empty output, or a refusal message for valid but unusual ticket inputs | Feed 25 edge-case tickets (empty body, emoji-only, non-English, 2-word descriptions); verify valid output or fallback |
Cross-Team Consistency | Two tickets with the same core issue but different wording receive the same team assignment | Paraphrased versions of the same ticket route to different teams due to surface-level wording changes | Create 10 ticket pairs with identical intent but varied phrasing; check for matching team assignments |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a smaller example set (3-5 examples per team) and skip strict schema validation. Focus on testing routing accuracy before adding production guardrails.
code[SYSTEM] You are a ticket router. Classify the ticket into one of these teams: - billing - technical - account Use these examples: [EXAMPLE 1] Input: "My invoice is wrong" Team: billing Confidence: high [EXAMPLE 2] Input: "Can't log in" Team: technical Confidence: high [EXAMPLE 3] Input: "Want to upgrade plan" Team: account Confidence: high Now classify: [TICKET]
Watch for
- Missing confidence thresholds causing overconfident misroutes
- Example set too small to cover edge cases
- No fallback for ambiguous tickets

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us