What they’re really asking
If you only remember one thing, say this in the first minute: “I wouldn’t build one big agent. I’d split ticket handling into fixed steps: clean the text, classify it with a small model, apply escalation rules in code, find relevant help articles, draft a reply with a larger model, check the draft, and send it to a human agent for approval. Each step has its own model choice, its own test and its own failure path to a person. Drafts graduate to auto-send one intent at a time, only after people stop editing them.”
The rest of this page explains each part of that answer.
The interviewer is testing decomposition: can you break a fuzzy AI task into steps you can test one by one?
Here is why that matters more than with normal code. A large language model (LLM) is a program that reads text and writes text. You could write one huge prompt that says “read this ticket, decide what it is, decide whether to escalate, and write a reply”. It would work in a demo. But when it goes wrong you can’t tell which part failed, you can’t test the parts separately, and escalation rules buried in a prompt can’t be audited. Splitting the job into small steps, some code and some model calls, gives you the same properties you expect from any pipeline: each stage has an input, an output and a test.
PromptLayer describes this from the interviewer’s side: a whiteboard exercise to design an agent that analyzes support tickets, drafts responses and escalates complex issues. Candidates draw a flow chart, choose a model for each step and maybe write a draft prompt. The stated criteria are “Clear problem decomposition into sub-tasks”, logical flow between steps, and “Consideration of error handling and edge cases” PromptLayer.
Clarify first
- Async tickets (email, forms) or live chat? “I’ll assume async, so latency is minutes, not seconds.”
- Do drafts go to the customer or to a human agent first? “To a human agent for approval at first.”
- What counts as “complex”? Ask for examples: legal threats, refunds over a cap, outages, angry repeat customers.
- Volume and languages? “A few thousand tickets a day, English first.”
- What can we learn from? “I’ll assume a help center and a history of resolved tickets.”
Answer
Words you need first
- Token: the unit a model reads and writes, roughly ¾ of a word. Providers charge per million tokens, with separate prices for input and output.
- Classifier: here, a model call that picks one label from a fixed list (intent, urgency).
- Retrieval: searching your help articles and past tickets for text relevant to this ticket, so the model answers from your documents instead of from memory.
- LLM judge: a second model call that grades the first one’s output, for example for tone.
The pipeline
Ticket arrives (email / form)
│
▼
1. Normalize ──── code: strip signatures and quoted threads, detect language, redact secrets
│
▼
2. Classify ───── small model: intent, product area, urgency, sentiment (fixed label set)
│
▼
3. Route ──────── code rules first, then classifier confidence ──► escalate to a person
│
▼
4. Retrieve ───── help articles + similar resolved tickets for this intent
│
▼
5. Draft ──────── larger model: reply with citations; may call read-only tools
│
▼
6. Check ──────── code assertions + LLM judge for tone ──► fail: send to a person with reason
│
▼
7. Deliver ────── draft into a human agent's queue; their edits become labels
- Normalize. Plain code, no model. Messy email text makes every later step worse.
- Classify. A small, cheap model with a fixed label set. Check that the label it returns is in the set. Evaluate it on a few hundred labelled past tickets.
- Route or escalate. Rules first (legal words, an outage tag, a refund above a cap, a VIP account), then the classifier’s confidence. Rules are auditable, so keep policy here, not in a prompt.
- Retrieve. Fetch help articles and similar resolved tickets for this intent.
- Draft. A larger model writes the reply with citations to the articles it used. It may call read-only tools, such as order status or current plan.
- Check the draft. Code assertions: it cites at least one article for any policy claim, it promises no money, it contains no other customer’s data. Then an LLM judge for tone, but only one whose grades have been checked against human labels.
- Deliver. The draft goes to a human agent’s queue. How much they edit it, and why they reject it, become your labels.
Follow one ticket through it
A customer emails: “Your app charged me twice for September!!! Fix this or I’m disputing it with my bank.”
| Step | What happens | What to say in the interview |
|---|---|---|
| Normalize | Signature and the quoted earlier thread are removed; language is English. | ”Cheap code before any model.” |
| Classify | Intent: billing / double charge. Urgency: high. Sentiment: angry. | ”A small model with a fixed label set; I reject labels outside it.” |
| Route | A rule fires on “disputing it with my bank” (a chargeback threat). Escalate. | ”Legal and chargeback words go to a person by rule, whatever the model thinks.” |
| (if no rule fired) Retrieve, draft, check | The draft cites the duplicate-charge article and promises no refund amount; checks pass. | ”Each check is a line of code I can test.” |
| Deliver | A human agent receives the ticket with the classification and a draft. | ”Their edits tell me how good the drafts are.” |
Error handling at each step. A label outside the set, or a failed check, sends the ticket to a person with the reason. Retries are bounded. Every ticket gets one trace, so you can see which step failed.
Graduation to auto-send
Measure, per intent, how often humans send the draft unedited. When an intent’s error rate on a labelled set falls below a threshold the support lead signs off, let that intent auto-send. Keep sampling a share for human review. Say: “Drafts graduate one intent at a time, and the support lead owns the threshold.”
Metrics
- draft acceptance rate per intent;
- time to first response;
- escalation precision: did escalated tickets really need a person?;
- CSAT, the customer satisfaction survey score;
- policy violations, held at zero.
Senior vs Staff
Ticket triage agent
Senior
- Decomposes into classify, route, retrieve, draft and check, with a model choice and a test per step.
Staff
- Designs the graduation from drafts to auto-send per intent, with who signs off the threshold and what metric would pull an intent back.
Small-team version
This is often a better first product than a live chat agent. It is async, and a human approves each draft, so mistakes are cheap. Many helpdesks sell drafting and triage features, so check them first.
If you build, it is a workflow (fixed steps in code), not an autonomous agent: a queue consumer, two model calls, and Postgres for state. Own the label set, the classifier’s test set, and the escalation rules.
Tokens are cheap at this volume: about $1,000 a month for an assumed 3,000 tickets a day. Compare that with the helpdesk add-on’s dated per-seat or per-outcome price before building.
The arithmetic behind the numbers (for a Staff-level follow-up)
Assumed: 3,000 tickets a day; list prices fetched 2026-10-11.
- Classifier: 1,000 input + 20 output tokens on gpt-5-mini ($0.25 / $2 per million): 3,000 × (1,000 × 0.25 + 20 × 2) ÷ 10⁶ ≈ $0.87 a day.
- Draft: 4,000 input + 300 output tokens on Claude Sonnet 5 ($2 / $10 per million): 3,000 × (4,000 × 2 + 300 × 10) ÷ 10⁶ = $33 a day.
- Total ≈ $34 a day ≈ $1,000 a month.
Pitfalls
- One giant prompt that classifies, decides and drafts at once. You can’t test it step by step or tell which part failed.
- Escalation rules hidden in a prompt. They can’t be audited, and a model can be argued out of them.
- Auto-sending before measuring human edit rates. You have no evidence the drafts are good enough.
- Using a judge for tone without checking it against people. An unchecked judge can approve bad drafts consistently.
Go deeper
- Family walkthrough: Customer-facing support agent, especially “Escalation on low confidence” and “Evals and observability”.
- Draft-first rollout appears in the walkthrough’s delivery plan under “Small-team version”.
- Labs: Build Your Own LLM Evaluation Harness for measuring per-step accuracy with intervals, Build Your Own Agent FrameworkPartial for tool calls.