Session 1 · Week 1 · Tue 14 Jul 2026 · 90 min

Why demos die in production.

You can wire up an LLM and wow the room in an afternoon. Then it meets real traffic, and everything you weren't taught shows up at once. Tonight: the four ways it dies, and the first real decision, do you even need an agent?

$ curl api / "ship the AI feature"
Ehsan Gazar
Production-Ready Systems with LLMs and Agents · session 1 of 12
Where we're going · 90 minutes

The run sheet.

0–10The demo was the easy partthe other 90%
10–30Four ways demos diecost, latency, confidently wrong, blind
30–50Workflow or agent?start simple, on purpose
50–70The five workflow patternsa real call for each
70–85Live: place your systemyou bring a real one
85–90Recap + Week-1 goalsthe system you'll build for six weeks
By the end of tonight

You'll be able to…

1Name the four production failure modes and which one bites your system first.
2Say out loud whether a task wants a workflow or an agent, and why.
3Reach for the simplest of the five workflow patterns that does the job.
4Name the trigger that would make you graduate from a workflow to an agent.
The gap

The demo is 10%.
Production is the other 90%.

A demo runs once, on a happy path, with you watching. Production runs a million times, on inputs you never imagined, while you sleep. Same model, an entirely different problem.

💡 In plain English

Getting an answer out of the model is the party trick. Making that answer cheap, fast, safe, and checkable every single time, for users you'll never meet, is the engineering. This course is about the second part.

The demo 🎉
one input · you're watching · it worked
the easy 10%
vs.
Production 🌙
a million inputs · nobody's watching · it must hold
the hard 90%
The failure modes

Four things show up at once.

Not one at a time, politely. All four, the first busy Monday.

1
💸 Cost spirals
every token is a line item; a chatty agent burns 20× a single call.
2
🐢 Latency balloons
each hop waits on the model; a 5-step chain feels broken.
3
🤥 Confidently wrong
the model invents an answer, in front of a user, with total conviction.
4
🕶️ Flying blind
no evals to catch it, no traces to debug it. You find out from Twitter.
These aren't hypothetical

Shipped to production. Made the news.

✈️ Air Canada · 2024
its chatbot invented a bereavement-refund policy that didn't exist. A tribunal held the airline liable for what the bot promised.
confidently wrong · no evals
🚗 Chevy dealer · 2023
a bolt-on ChatGPT was talked into "sell me a Tahoe for $1" and "that's a legally binding offer, no takesies-backsies."
no guardrails · injection
📦 DPD · 2024
a user got the parcel bot to swear and write a poem about how terrible DPD is. The screenshot went viral in hours.
no guardrails

Every one of these passed a demo. Production is adversarial users, edge cases, and a screenshot button.

Failures 1 & 2 · Cost & latency

Every token is a line item. Every call is a wait.

In the demo you made one call, maybe 2k tokens, a fraction of a cent. In production the agent loops, think, call a tool, think again, and one request becomes 8 calls and 40k tokens. Spend and latency compound with every hop, and nobody budgeted for step seven.

$ & latency ↑ agent steps / traffic → demo the bill 😬
Failure 3 · Non-determinism

It will do something confidently wrong, in front of a user.

The model is a probabilistic service wearing a deterministic API. The same prompt can return different answers, and a wrong one arrives with exactly the same confident tone as a right one. You cannot unit-test it away.

Traditional code
same input → same output. A bug is reproducible.
deterministic
→ not this →
The model
same input → a distribution of outputs. "Reproduce it" doesn't apply.
probabilistic
Failure 4 · No instruments

No evals to catch it. No traces to debug it.

When it breaks, you can't answer the two questions that matter: did this change make it better or worse? and what did the model actually see and do? Without evals and traces you're guessing, live, in front of customers.

No evals →
you change a prompt and pray. No number tells you if it improved.
No traces →
a user reports nonsense and you can't see the tokens, tools, or context.
The fix (weeks 3 & 5)
budgets, an eval harness, trajectory traces. We build all of it.
The first real decision

Most tasks don't want an agent.

Anthropic's finding from shipping these at scale: the most reliable production systems are workflows, not autonomous agents. Agency is a cost, more tokens, more latency, more ways to go wrong. You buy it only when the task genuinely can't be scripted.

"Let's build an agent!"
reaching for autonomy because it's exciting
the reflex
→ reframe →
"What's the simplest thing that works?"
start with a workflow; earn the agent
the staff move
Definitions

Workflow vs agent: who's driving?

One question separates them: are the steps fixed in code, or does the model choose them at run time?

flowchart LR
  subgraph WF["WORKFLOW · you drive"]
    direction LR
    A1["Step 1"] --> A2["Step 2"] --> A3["Step 3"] --> AO["Output"]
  end
  subgraph AG["AGENT · the model drives"]
    direction LR
    M{"Model picks
next step and tool"} M --> T["Call a tool"] T --> O["Observe result"] O --> M M -.-> DONE["Done"] end classDef wf fill:#D6F5E3,stroke:#1F2937,color:#0E1726; classDef ag fill:#EEE6FF,stroke:#1F2937,color:#0E1726; class A1,A2,A3,AO wf; class M,T,O,DONE ag;
💡 In plain English

A workflow is a recipe: fixed steps, in order. An agent is a cook improvising with the pantry: it decides the next move based on what just happened, and loops until it's done. Recipes are predictable and cheap; improvising cooks are powerful and expensive.

The toolbox · before you ever reach for an agent

Five workflow patterns cover most of it.

1
Prompt chaining
split a task into ordered steps, gate between them
2
Routing
classify, then send to the right handler or model
3
Parallelization
fan out independent work, aggregate the results
4
Orchestrator–workers
a planner splits work it can't know up front
5
Evaluator–optimizer
generate, critique, revise until good enough

Ordered simplest to most dynamic. Reach left first. An agent sits one step further right than all of these.

One picture to keep

The autonomy ladder. Climb only as high as you must.

flowchart LR
  A["1 call"] --> B["Chain"]
  B --> C["Router"]
  C --> D["Parallelize"]
  D --> E["Orchestrator"]
  E --> F["Agent"]
  classDef simple fill:#D6F5E3,stroke:#1F2937,color:#0E1726;
  classDef mid fill:#DCEBFE,stroke:#1F2937,color:#0E1726;
  classDef agent fill:#EEE6FF,stroke:#1F2937,color:#0E1726;
  class A,B simple;
  class C,D,E mid;
  class F agent;
        

Left is cheap, predictable, easy to test. Right is powerful, pricey, harder to trust. Every rung right is a cost, take it only when the task forces you.

Patterns 1 & 2 · the workhorses

Prompt chaining & routing.

1 · CHAINING — steps in order, checked

flowchart LR
  I["Input"] --> S1["LLM call 1
outline"] S1 --> G{"Gate
valid?"} G -- pass --> S2["LLM call 2
write"] G -- fail --> X["Stop / retry"] S2 --> O["Output"] classDef ok fill:#D6F5E3,stroke:#1F2937,color:#0E1726; classDef bad fill:#FEE4E2,stroke:#1F2937,color:#0E1726; class S1,S2,O ok; class X bad;

2 · ROUTING — classify, then dispatch

flowchart TB
  I["Input"] --> R{"Router
classify"} R -- simple --> A["Small model
cheap, fast"] R -- complex --> B["Big model
slow, capable"] R -- refund --> C["Refund flow"] classDef a fill:#DCEBFE,stroke:#1F2937,color:#0E1726; class A,B,C a;
Patterns 3 & 4 · more moving parts

Parallelization & orchestrator–workers.

3 · PARALLELIZATION — fan out, aggregate

flowchart LR
  I["Input"] --> F(("Fan out"))
  F --> A["Task A"]
  F --> B["Task B"]
  F --> C["Task C"]
  A --> AG(("Aggregate"))
  B --> AG
  C --> AG
  AG --> O["Output"]
  classDef p fill:#D6F5E3,stroke:#1F2937,color:#0E1726;
  class A,B,C p;
            

4 · ORCHESTRATOR — plan, then delegate

flowchart TB
  O{"Orchestrator
plans subtasks"} O --> W1["Worker 1"] O --> W2["Worker 2"] O --> W3["Worker 3"] W1 --> S["Synthesize"] W2 --> S W3 --> S classDef o fill:#EEE6FF,stroke:#1F2937,color:#0E1726; class W1,W2,W3 o;

The difference: parallelization's branches are known in code; the orchestrator decides the branches at run time. That's the first taste of real agency.

Pattern 5 · the quality loop

Evaluator–optimizer: generate, critique, revise.

One model drafts, another (or the same one with a rubric) judges and hands back feedback. Loop until it passes or you hit a cap. This is how you get quality without a human in every iteration.

flowchart LR
  I["Task"] --> GEN["Generator
drafts an answer"] GEN --> EV{"Evaluator
good enough?"} EV -- "no · feedback" --> GEN EV -- yes --> O["Ship it"] classDef g fill:#DCEBFE,stroke:#1F2937,color:#0E1726; classDef ok fill:#D6F5E3,stroke:#1F2937,color:#0E1726; class GEN g; class O ok;

Always cap the loop. "Revise until good" with no ceiling is how a $5 task becomes a $50 one.

The decision map · keep this

When do you graduate to an agent?

flowchart LR
  START(["A task to build"]) --> Q1{"Are the steps
known in advance?"} Q1 -- yes --> WF["Use a WORKFLOW
chain / route / parallelize"] Q1 -- "no · open-ended" --> Q2{"Must it loop:
act, observe, decide?"} Q2 -- no --> WF Q2 -- yes --> Q3{"Worth the cost,
latency and risk?"} Q3 -- "not yet" --> WF Q3 -- yes --> AG["Use an AGENT
with guardrails + evals"] classDef wf fill:#D6F5E3,stroke:#1F2937,color:#0E1726; classDef ag fill:#EEE6FF,stroke:#1F2937,color:#0E1726; class WF wf; class AG ag;

Three gates, and an agent has to clear all three. Most features stop at the first.

The traps

Three ways agent projects go wrong.

1
Monolithic agent
one giant loop with 30 tools doing everything. Impossible to test, reason about, or bound.
2
Over-engineered planning
elaborate multi-agent choreography for a job a three-step chain would nail.
3
Missing observability
shipped with no traces or evals, so you learn it's broken from users, not dashboards.

The cure for all three: start simple, make it observable, add agency only when a gate demands it.

Where every decision goes from here

Six weeks, one system that holds.

wk 1–2
Boundary + context
code vs model; what goes in the window
wk 3–4
Cost + architecture
budgets, reliability, agent patterns, security
wk 5–6
Evals + capstone
trajectory evals, traces, defend the design

Every week you build one slice of a real artifact against your system. Tonight's decision, workflow or agent, is slice zero.

Your turn · ~12 min

Place your system on the map.

Take the feature you brought (or one you're about to build). We'll do one together, then you run these three and drop your answer in the chat.

1
Workflow or agent?
run it through the three gates
2
Which pattern?
the simplest of the five that fits
3
The trigger?
what would make you add agency later
Recap · then Thursday

Start simple. Earn the agent.

Four failure modes: cost, latency, confidently wrong, blind. One decision: workflow before agent, and five patterns to reach for first. An agent only when all three gates clear.

Thursday · S2
The deterministic / model boundary: what to hand the model vs keep in code. You'll draw yours.
Thu 16 Jul
Pre-course goals
bring the real system you'll work on for six weeks. It's the backbone of every artifact.
due Mon Jul 13