Module 6 · Capstone · Chapter 23 · Free
Capstone: design your own AI system end to end
- You finish with one artefact: a complete design document for a system you chose.
- The method is chapter 4's design method, run once, in order.
- A design is done when a reviewer can find every section: requirements, sketch, patterns, tradeoffs, eval, fallbacks, cost, risks.
The picture: the eight layers from chapter 2, used as a checklist. Every layer gets one decision from you.
- Three briefs to choose from, or use your own idea.
- The design method as six steps, each ending in a section of your document.
- One brief designed in full, compressed, so you can see what finished looks like.
- A copyable design checklist, and a self-review that scores your draft against it.
Northbeam Tutors is a made-up tutoring company. Its team brought a 14 page homework helper design to review. All 14 pages compared models.
- No page said who the users were, what a wrong answer costs a child, or what happens when the model is down.
- The review stalled for an illustrative three weeks while basics got answered.
- The model choice, the only decision made, changed twice in that time anyway.
A design document is not a model comparison. It is the decisions a team must not remake.
- Pick a brief.
- Write requirements and constraints.
- Sketch the system on the eight layers.
- Pick patterns; log tradeoffs, evals, fallbacks.
- Model the cost and review the risks.
- See a finished design, then score yours.
Next: pick the system you will design.
Step 1: Pick your brief
- Brief A: homework helper. A tutoring company. Students aged 8 to 16 ask homework questions. Hard constraint: child safety. No personal data kept, a human route for anything worrying.
- Brief B: maintenance copilot. A facilities firm. Technicians in the field ask about machine manuals, often with poor signal and gloves on.
- Brief C: returns concierge. An online fashion retailer. Shoppers ask about sizes, returns and refunds, in seconds.
- Or your own idea. Keep it small: one user group, one main job.
Write the brief at the top of your document: product, users, hard constraints, three lines.
Next: turn the brief into requirements a design can be checked against.
Step 2: Requirements and constraints
Requirements say what the system must do. Constraints say what it must live with. Write both before boxes and arrows.
- Functional: the jobs. "Answer from the manual and cite the page."
- Quality targets: numbers, not adjectives. Accuracy, reply time, cost per answer.
- Constraints: data rules, safety rules, budget, devices, signal, languages.
- Out of scope: two or three things the system will refuse or hand off. This prevents most scope creep.
Think of it as a contract before a house build: rooms and budget first, bricks later. Where the picture breaks down:
- A house contract can be complete. AI behaviour cannot, so the eval plan in step 5 is part of the contract.
- Constraints change mid-build more often than bricks do. Date your list.
Next: the sketch, drawn on the reference architecture.
Step 3: Sketch on the reference architecture
Chapter 2 gave you eight layers. Here they become a checklist: walk the picture, one decision per layer. A layer you skip is a decision made by accident.
- Where it lives: chat, voice, in-app panel. Note device and conditions, like gloves or low signal.
- The flow: one call, a fixed workflow, or an agent loop (chapter 8).
- Which models, and whether a router (chapter 7) sends easy work to a small model.
- Where facts come from: documents, a database, or live tools. Most pattern picks land here.
- What it may do: read only, or act, and which actions need approval.
- What persists between turns and sessions (chapter 9), and what must never be stored.
- Checks on input and output, and where a human takes over (chapter 10).
- How you know it works: traces, a golden set, alarms. This layer judges the others.
Your sketch is one page: eight boxes, one decision each, arrows for the main flow. Detail goes in later steps, not the drawing.
Next: choose the patterns that fill the sketch.
Step 4: Pick patterns, with reasons
Pick at least one pattern from each group. For every pick, write the reason and a when-not-to note. A pick without a reason is a fashion choice.
- Retrieval or structured data (chapter 5). How facts arrive: search over documents, structured queries, or both.
- Output and tool use (chapter 6). How answers become data your code can act on.
- Reliability (chapters 10 and 14). The checks, retries and human routes.
- Cost (chapter 12). How repeat work gets cheaper: caching, routing, batching.
Streaming (chapter 13) and memory (chapter 9) are optional: add only if a requirement asks.
Next: record what each choice costs, and how you will prove the system works.
Step 5: Tradeoff log, eval plan, fallback ladder
Tradeoff log. Three decisions. For each: the choice, the attribute bought, the attribute spent. Example: "Cache answers for 24 hours. Bought: cost. Spent: freshness." Chapter 3 gives the vocabulary.
Eval plan (chapter 11). Three lines minimum:
- Golden set: how many cases, drawn from where, including hard and unsafe cases.
- Graders: code checks where answers are exact, model or human grading where they are not.
- Release threshold: the score a change must beat to ship, and what happens when it does not.
Fallback ladder. Rungs from best to last resort: full answer, smaller model, cached or partial answer, honest refusal, human handoff. Each names its trigger.
A perfect threshold on open ended answers blocks everything. Set one you can defend: no drop on safety cases, a small drop overall at most, and treat a miss as a review, not a bypass.
Next: price the design and name its worst days.
Step 6: Cost model and risk review
Cost model. One line of arithmetic: requests per day, times tokens per request, times price, plus fixed costs like indexing. Use illustrative prices and say so. Show expected volume and ten times it.
Risk review. Three questions, in plain words:
- The worst fluent failure: the most harmful answer that sounds fully confident.
- The worst leak: the most sensitive thing shown to the wrong person.
- The runaway cost: the loop, retry or spike that multiplies the bill, and its cap.
Each risk gets a guardrail or fallback already in your document. No defence means an open item: mark it.
Next: one brief, designed in full, so you can compare shapes.
Worked example: brief B, compressed
Fieldwise Facilities is stated as made up. Its technicians service pumps and air handlers at client sites. All numbers are illustrative.
1. Requirements. Answer from machine manuals, cite model and page, on a phone with poor signal. Targets: 90 percent of answers grounded in a cited passage, first text within 4 seconds, at most $0.06 per answer. Constraint: no manual text leaves the company account. Out of scope: ordering parts, safety sign-off.
2. Sketch. Surface: phone app, voice input. Orchestration: fixed workflow, search, answer, check citation. Gateway: router sends simple lookups to a small model. Retrieval: manuals indexed per machine model. Tools: read only, plus "call the office". Memory: current machine only, cleared per job. Guardrails: citation required, low confidence to a dispatcher. Eval: traces on every answer.
3. Pattern picks. Retrieval: document search filtered by machine model, since the question names the machine. When not to: live sensor values, which need a tool. Output: structured answer with steps, warnings and citation fields. Reliability: citation check in code; no matching passage, no answer. Cost: cache per manual version, since 40 technicians ask the same questions.
4. Tradeoffs. Read only tools: bought safety, spent convenience. Cache per manual version: bought cost, spent freshness, handled by version keys. Small model first: bought speed, spent accuracy on rare machines, handled by escalation.
5. Eval plan. Golden set: 150 questions from senior technicians, 30 of them traps with no answer in the manual. Graders: code checks citations, humans grade 30 weekly. Threshold: 90 percent grounded, zero invented citations, or no ship.
6. Fallbacks. Large model, small model, cached answer, the manual PDF page, then the dispatcher.
7. Cost. Illustrative volume: 300 questions a day, about 3,000 input and 400 output tokens per answer. Illustrative prices: $3 per million input, $15 per million output. Per answer: 3,000 / 1,000,000 x $3 = $0.009, plus 400 / 1,000,000 x $15 = $0.006, total $0.015. Daily: 300 x $0.015 = $4.50, about $135 a month. At ten times volume, $1,350, still $0.015 per answer, under the target.
8. Risks. Worst fluent failure: a confident torque value from the wrong pump model. Defence: model filter plus citation check. Worst leak: one client's site notes shown to another crew. Defence: manuals partitioned per client, in code. Runaway cost: a retry loop on poor signal. Defence: two retries maximum, then the PDF rung.
Next: write your design, then score it.
Lab: draft your design, then score it
Why this exercise: most weak designs are not wrong, they are unfinished. Scoring coverage finds the missing section before a reviewer does.
Do this:
- Draft your document, one section per checklist line. Keep it under three pages.
- Complete the design form below, then press Check and fix what the checks name.
- Rewrite only your weakest section.
The course design checklist (illustrative starter, copy it):
DESIGN CHECKLIST (illustrative)
[ ] Brief: product, users, hard constraints (3 lines)
[ ] Requirements: jobs, quality targets with numbers, out of scope
[ ] Sketch: eight layers, one decision each, main flow arrows
[ ] Patterns: one each from retrieval or structured data, output
and tool use, reliability, cost. Reason + when-not-to each.
[ ] Tradeoff log: 3 decisions, attribute bought, attribute spent
[ ] Eval plan: golden set size and source, graders, release threshold
[ ] Fallback ladder: at least 3 rungs, trigger named for each
[ ] Cost model: volume x tokens x price, at 1x and 10x volume
[ ] Risk review: worst fluent failure, worst leak, runaway cost,
each with a defence in the design
Lab: This capstone uses Brief B from the chapter: a maintenance copilot for a facilities firm. This lab runs in your browser and needs JavaScript enabled.
- Your shortest bar is your next hour of work. A missing eval plan or ladder weakens every other section.
- If requirements scored low, fix that first anyway: later sections inherit its gaps.
Design reviews in production teams tend to spend most time on failure and cost, not the happy path demo. Copy that: bring your fallback ladder and cost model first, and expect the hardest questions there. Treat prices as moving parts; check current vendor pages before quoting figures elsewhere.
Mix-ups to avoid
- A model comparison is a design. No: one layer of eight, and the layer most likely to change.
- More patterns means a better design. No: each must earn its place with a reason and a when-not-to.
- The eval plan can come after launch. No: without a golden set and threshold, quality is an opinion.
- Fallbacks admit failure. No: a ladder keeps the system useful on its worst day.
Chapter quiz
Five questions. Score 70% or more to mark this chapter complete.
Review this chapter in 5 minutes
Watch the whole chapter recapped: Picking a brief, the six design steps, pattern picks, the tradeoff log, eval plan, fallback ladder and self-review.
- One artefact: a design document a reviewer can check without you.
- Order: brief, requirements, sketch, patterns, tradeoffs, eval, fallbacks, cost, risks.
- Sketch on the eight layers from chapter 2, one decision per layer.
- Four pattern picks minimum, one per group, each with a reason and a when-not-to.
- Eval plan in three lines: golden set, graders, release threshold.
- Worked example: brief B at an illustrative $0.015 per answer, $4.50 a day at 300 questions.
Decision rule: if a checklist section is empty, the design is not finished.
Review
Glossary
- Design document
- The written record of decisions, reasons and tradeoffs for one system.
- Brief
- The short statement of product, users and hard constraints.
- Reference architecture
- The eight layer sketch from chapter 2 most AI products share.
- Tradeoff log
- Decisions listed with the attribute each bought and spent.
- Golden set
- A fixed set of test cases with known good answers.
- Release threshold
- The eval score a change must beat before it ships.
- Fallback ladder
- Ordered backup behaviours, down to a human handoff.
- Fluent failure
- A wrong answer written so smoothly nobody questions it.
Next: "AI system design interview practice: timed exercises with model answers".