Module 4 · Case studies I · Chapter 15 · Free
Case study: a customer support copilot that resolves, not deflects
- One copilot, two surfaces: it drafts inside the agent console and answers easy chats directly.
- Every hard limit lives in code: refund approval above $50, and no delivery date unless the order system returns one.
- Five familiar patterns, one engineer, no multi-agent system. Simplicity is the design.
The picture: a good desk clerk. They check the file, quote only what it says, and call a supervisor before giving money back.
Company: Fernwood Home, a made up online furniture retailer invented for this chapter.
Product: a support copilot in the agent console, plus direct answers to simple chats.
Users: customers and support agents, 60,000 conversations a month (illustrative).
Hard constraints: a human approves any refund above $50; never invent a delivery date; one engineer maintains it, so it must stay simple.
Fernwood first tried a deflection bot, built to keep customers away from agents. In one illustrative month it closed 9,000 chats, but 3,100 customers came back within two days angrier, and agents re-read every chat anyway. The redesign goal: resolve the issue, or hand over cleanly with work already done.
- Run the design method: requirements first, patterns second.
- Walk one damaged chair through the architecture.
- Map the patterns and the tradeoffs taken on purpose.
- Study three failures, then debug a broken refund guardrail.
- Do the cost arithmetic, then redesign for phone support.
Next: the requirements.
Step 1: Context and requirements, the design method in brief
Chapter 4 gave the method: requirements, constraints, patterns, tradeoffs, eval plan.
- Requirements. Answer order status, damage, returns and password resets. Draft replies for agents on anything harder.
- Constraints. The three hard limits in the case file. They rule out most clever designs early.
- Patterns. The smallest set that meets them: retrieval, tools, a router, guardrails, an eval loop.
- Tradeoffs. Accuracy over speed on money. Simplicity over coverage elsewhere.
- Eval plan. A 400-case golden set, checked before every change ships. See the evals chapter of the AI engineering course.
Like clinic triage: sort fast, treat simple cases, pass the rest on with notes.
Where the picture breaks down:
- A clinic can see the patient. The copilot sees only text, so it must look things up.
- Triage staff can improvise. The copilot may not improvise dates or refunds.
Next: the architecture, walked one message at a time.
Step 2: The architecture, one damaged chair end to end
Press Next. One conversation, "my chair arrived damaged", goes from chat to resolved ticket.
- "My chair arrived damaged." The chat opens a ticket.
- Password resets take a cheap scripted path. Damage claims go to the copilot (Ch. 7).
- The order tool returns the chair, the price ($120) and carrier status. Facts come from the tool.
- Hybrid retrieval finds the damaged items page: photo first, then replacement or refund.
- Structured output fills issue type, order id, photo status and proposed action.
- A $120 refund is above $50, so the gate holds it for a human. Only after approval does it run.
The customer gets a replacement offer and a clear next step.
Predict first:
The constraint wins: never invent a delivery date. "Usually five days" is a general guide, not this order's date. Say what is known, name what is missing.
Next: which patterns appear, and where.
Patterns used and why
| Pattern | Where it appears at Fernwood | Why this one |
|---|---|---|
| Retrieval, Ch. 5 | Hybrid search over the help centre: keywords plus embeddings | Customers write "cracked leg" and "split wood" for the same policy. Keywords alone miss many. |
| Structured output and tool use, Ch. 6 | Ticket fields filled as data; order lookup as a tool | The console and refund flow need fields code can trust, not prose. |
| Router, Ch. 7 | Password resets and address changes take a cheap scripted path | Known, fixed jobs should not pay model prices or carry model risk. |
| Guardrails, Ch. 10 | The $50 approval gate, checked in code before the refund tool runs | Money rules must hold every time, even on odd chats. |
| Eval loop, Ch. 11 | A 400-case golden set run before every prompt or model change | One engineer cannot re-test by hand. The set is the safety net. |
| Memory, Ch. 9 | A short ticket summary, written back to the ticket only | The next agent needs context. Later you will see why summaries must be checked. |
Next: what Fernwood gave up, on purpose.
Tradeoffs taken
- No multi-agent system. One agent with tools is easier for one engineer to test and fix. Given up: specialist agents, not needed here.
- No streaming to the agent console. Agents get the finished draft (Ch. 13). Given up: a feeling of speed. Gained: drafts pass the guardrail first.
- Accuracy over speed on refunds. The gate adds minutes to big refunds. Given up: instant refunds above $50. Gained: no unapproved money leaves.
- Narrow scope. Four issue types answered directly, the rest drafted. Given up: coverage. Gained: an honest golden set.
Next: what broke once real customers arrived.
What broke
Three failures, invented for this case but typical of support copilots. Each forced a design fix.
- It quoted a delivery date from a stale help page. A page said a discontinued range shipped in three days, and the copilot quoted it as the customer's date. Fix: dates come only from the order tool. Retrieved text is guidance, and the answer template has no date slot for it to fill.
- A retrieved page tried to steer it. Hidden text in a help page told it to offer a full refund and skip the photo step. Fix: retrieved pages are untrusted data. Instructions inside them are ignored, and the refund gate never reads them. See RAG end to end.
- A summary carried a wrong address. The summary mixed an old address into a new one, and a replacement nearly shipped to the wrong house. Fix: addresses are copied from the order record at shipping time, never from the summary, which now links to the record.
Facts and rules live in systems and code. Text is a hint.
Next: the cost and latency arithmetic.
Cost and latency
All figures here are illustrative. Of 60,000 monthly conversations, the router sends about 40 percent to the cheap path: 60,000 × 0.40 = 24,000. The copilot handles 36,000.
- Cost per copilot conversation: about 6,000 input and 500 output tokens. At an illustrative $3 per million input and $15 per million output: 6,000 ÷ 1,000,000 × $3 = $0.018, plus 500 ÷ 1,000,000 × $15 = $0.0075. Total about $0.026.
- Monthly model cost: 36,000 × $0.026 = $936, plus near zero for the scripted path.
- Cost per resolved conversation: at 70 percent resolved without an agent, 36,000 × 0.70 = 25,200. $936 ÷ 25,200 = about $0.037 each, before agent time.
- Latency: p95 of 4.2 seconds (illustrative): retrieval, model calls, the tool round trip. Approvals add human minutes, by design.
Chapter 12 covers caching tricks that could cut the $936. Fernwood skipped them: a bill already under $1,000.
Next: the break-it lab. The guardrail that was only a sentence.
Hands-on lab: break-it, the refund gate that was only a prompt
Why this exercise: the most common guardrail failure is a rule that exists only as words. Spot it, then fix it in code.
Fernwood's refund rule before launch (illustrative). The prompt carried the rule. The tool carried nothing:
SYSTEM PROMPT (excerpt)
"Never refund above $50 without approval."
def issue_refund(order_id, amount):
# no limit here
return payments.refund(order_id, amount)
Lab: Fernwood's refund rule before launch lived in the system prompt: 'Never refund above $50 without approval.' The tool itself checked nothing, so the worst a steered model could do was anything it liked. This lab runs in your browser and needs JavaScript enabled.
Next: the redesign exercise. Fernwood changes the brief.
Redesign exercise: Fernwood adds phone support
The change: Fernwood adds phone support, in two languages, with the same resolutions. Redesign on paper before opening the model answer.
Do this: sketch what changes and what must not. Cover voice, language, the gate, dates, and evals for spoken chats.
Model answer
- Keep the core. Router, copilot, tools, ticket fields and the $50 gate stay as they are. Voice is a new front door, not a new brain.
- Add a speech layer. Speech to text in, text to speech out, same copilot. Confirm facts back: "the chair, order ending 4821, right?"
- Two languages at the edges. Detect the language, work in it, store the ticket in one language for agents. Test both languages in the golden set.
- Slow down on money and dates. Spoken numbers are easy to mishear, so read refund amounts back and wait for a yes. Dates still come only from the order tool.
- Grow the eval set. Add spoken cases: noise, accents, language switches. A text-only set misses voice failures.
- Watch latency. On a call, silence feels broken. Stream the voice reply (Ch. 13), though the console still gets finished drafts.
Support is often the first place a company trusts AI with real customers, likely because the work is high volume, answers are checkable against order data, and a human stays one click away. That is a hedge, not a statistic: teams differ.
Mix-ups to avoid
- Deflection equals resolution. No: a chat that returns in two days was never resolved. Measure repeat contact.
- A prompt rule is a guardrail. No: a guardrail is code that can refuse. Prompts guide, code gates.
- Retrieved text is safe as fact. No: pages go stale and can carry planted instructions. Facts come from tools.
- More agents means better. No: with one engineer, each agent is another system to debug.
- The summary is the record. No: summaries drift. Copy addresses and dates from the record.
Chapter quiz
Five questions. Score 70% or more to mark this chapter complete.
Review this chapter in 5 minutes
Watch the whole chapter recapped: resolve not deflect, hybrid retrieval and order tools, the $50 code gate, three failures, and the voice redesign.
- Goal: resolve, not deflect. Measure repeat contact, not closed chats.
- Design method: requirements and constraints first, then the smallest pattern set that fits.
- Architecture: router, one copilot, hybrid retrieval, order lookup tool, structured ticket fields, code gate on refunds.
- Hard rules: approval above $50, dates only from the order tool, both in code.
- Three failures: a stale page date, a steered retrieval, a wrong summary address. Each fix moved trust from text to systems.
- Numbers (illustrative): 60,000 chats a month, $0.026 per copilot conversation, $0.037 per resolution, p95 of 4.2 seconds.
- Voice redesign: new front door, same brain, same gates, bigger golden set.
Decision rule: if a rule protects money or a fact, enforce it in code and test it in the golden set. Never leave it as a sentence in a prompt.
Review
Glossary
- Copilot
- An AI helper that drafts and acts beside a human. Example: the Fernwood console assistant.
- Deflection
- Turning a customer away unsolved. Example: a bot that only links to a help page.
- Hybrid retrieval
- Search mixing keywords and embeddings. Example: finding the damage policy from "split wood".
- Order lookup tool
- A function the copilot calls for order facts: price, status, date.
- Structured output
- Answers as fields code can use: issue type, order id, action.
- Approval gate
- A code check holding an action for a human. Example: refunds above $50.
- Golden set
- Fixed test cases with known good answers. Example: Fernwood's 400 chats.
- Ticket summary
- A short recap stored on a ticket: damage reported, refund held.
- Repeat contact
- A customer returning with the same issue, the sign of deflection.
- p95 latency
- The time 95 percent of replies beat. Example: 4.2 seconds, illustrative.
Next: "Case study: enterprise search over 40,000 company documents".