Stage 5 track

Track A: AI Deployment FDE

Goal: Put LLM features into customer workflows — safely, measurably, and inside the customer's constraints. Builds on: the whole Acme engagement; the email workstream becomes your capstone.

What you learn

  1. Choosing the right AI pattern — single call, workflow, RAG or agent: pick the simplest pattern the task allows. Email triage is a single structured call; don't build an agent where a classifier will do.
  2. Calling Claude with structured output — schemas the rest of the system can trust.
  3. Evals on customer data — labelled sets, held-out splits, launch thresholds agreed during scoping.
  4. Data minimisation — sending only what the task needs; redaction before every call (Part 12's tooling, now mandatory).
  5. Human in the loop — review queues and confidence thresholds; complaints and change requests route to a person.
  6. Cost and latency in production — token budgets, caching stable prompt prefixes, batching bulk jobs.
  7. Failure modes and responsible use — wrong or made-up answers, bias, and clear escalation to a person. An AI feature at a customer needs a visible "this was automated — talk to a human" path.

Executed examples

All three ran in this repo; outputs are from those runs.

Classify customer emails with Claude into a fixed schema (examples-track-a/01) — messages.parse with a Pydantic schema returns validated fields (category, shipment_id, needs_human) instead of free text. This example ran against the local mock server (tools/mock_claude.py), so the SDK code is exercised without an API key — the printed values are placeholder text from the mock, not real Claude answers (a real run classifies correctly; the mock always returns each schema field's placeholder):

Where is shipment S-2001? It was due yesterda -> {'category': 'tracking', 'shipment_id': 'placeholder', 'needs_human': True}
Please change the delivery address for S-2005 -> {'category': 'tracking', 'shipment_id': 'placeholder', 'needs_human': True}

Evaluate on held-out data (examples-track-a/02) — a rule baseline written while looking at the labelled tickets scores perfectly on them, and collapses on emails nobody saw while writing the rules:

accuracy on the emails used to write the rules: 100%
accuracy on held-out emails:                    25%
report the held-out number to Acme, and use the same split for the LLM classifier

Redact, then send (examples-track-a/03) — only the minimum data leaves the customer's boundary:

Hi, this is Asha ([EMAIL], [PHONE]). Where is S-2001?

🧪 Quick quiz — answer from memory, then check.

  1. Why use structured output (a Pydantic schema) when classifying customer emails?
Show the answer

Downstream code gets validated fields (category, shipment_id, needs_human) instead of free text. messages.parse returned a validated Triage object — verified against the installed SDK (mock run).

  1. The rule baseline scored 100% on the emails used to write it. What did it score on held-out emails?
Show the answer

25%. Always evaluate on data you did not look at while building, and report that number. (verified against the example output above)

  1. Before sending customer text to an LLM, what should you do?
Show the answer

Send only the data the task needs; redact personal data where possible. The example replaced the email address and phone number before building the request. (verified against the example output above)

  1. When is an AI feature ready to launch at a customer?
Show the answer

When it beats the baseline on held-out data and meets the accuracy the customer agreed to. Agree the launch bar during scoping, not after building.

Capstone: Acme Email Assistant

  • Core — classify and draft replies to "where is my shipment" emails with Claude, using shipment data from the pipeline.
  • Stretch — add an eval on held-out emails, redaction before every call, and a human review queue for low-confidence cases.
  • Production — add cost and latency tracking, a launch threshold agreed with Acme, and a rollout to one dispatcher team.

Read more: Anthropic docs: structured outputs · Prompt caching

Search the guide