The Engineering
of AI Agents
From one prompt to a production AI system.
→ / space to advance · M for chapters · F fullscreen
Each of these exists because something simpler broke.
Know what broke — and you'll know when you need the fix.
Hope opened KickBox,
an online sneaker store.
“Let's just add AI.”
Start small. Let it break. Add only what's needed.
Launch day.
Fluent. Polite. Instant.
It feels like magic.
A function.
Text in, text out.
A smart new employee who read the whole internet — on day one, with no handbook and no system access.
Every stage from here gives the new employee one thing they're missing.
The bot invented a policy.
It didn't know. So it guessed —
confidently, in your brand's voice.
Just paste the
handbook in.
- Correct answers, right away
- The window has a size limit
- You pay for every token, on every message
Too big to paste.
So which page?
Don't paste the library.
Fetch the page.
“Retrieval-Augmented Generation” sounds fancy. It's just: search first, then prompt.
The context window
is a budget.
Prompt engineering is how you ask.
Context engineering is what it gets to see.
“Where's my order?”
It knows everything now.
It still can't do anything.
It can't touch
your systems.
It can't act.
But it can ask.
The model never touches your systems. It writes a request — your code decides whether to run it.
Every app connects
every system by hand.
Plug in once.
Use everywhere.
Anything you can wrap in a function is a tool: APIs, databases, search, email, even RAG itself.
MCP is a standard plug for tools — the USB-C of AI apps.
…and break them. We'll come back to that.
“Wrong size.
Swap for a 42.”
One tool call answered one question.
The job needed six — and each depends on the last.
Six steps.
How does it keep going?
Put the model
in a loop.
Same tools as before. The only new thing is letting it go again — after seeing what happened.
Watch one
swap happen.
Nobody scripted
these steps.
Each step is chosen from what it just saw. Size 42 sold out? It changes plan — and asks.
get_order(4821)delivered Thu · size 41check_return_policy(4821)can return · 9 days leftcheck_stock("Air Run", 42)sold outcheck_stock("Air Run", 42.5)3 leftask_customer(…)“42.5 instead?” → “yes”create_exchange(4821, 42.5)exchange EX-311 createdcreate_return_label(4821)label emailedFreedom has
a price.
A loop decides for itself how long to run. That's the point — and the problem.
The shipping API stops responding. The agent retries. And retries.
→ step limits · timeouts
Six steps = six LLM calls. Money and waiting time grow each round.
→ budgets · faster models
Every result is added to the history. Long chats overflow.
→ Stage 4
“Same problem as last time.”
Every chat starts from zero.
Customers hate repeating themselves.
Long chats outgrow
the window.
Short-term:
keep the desk clean.
Long chats outgrow the window and early details get lost. Summarize what's already decided, keep notes, keep only what the next step needs.
✗ forgot the customer already agreed to voucher
March and April
are strangers.
Long-term:
a notebook that
keeps it all.
- Feels personal, fewer questions
- Wrong memories stay
- Privacy: what should it forget?
Black Friday.
One agent. Too many jobs.
Every new feature made all the others a little worse.
Three problems.
One message.
Messy requests
need a plan.
Write the to-do list first, then work through it — and update it when things change.
- Refund the damaged item (order B)
- Check on the late package (order A)
- Update the address
- ✓Update address on order A — it hasn't shipped yet!
- ✓Refund the damaged item (order B)
- ✓Ship order A faster, to the new address
↻ re-planned after get_order(A): “not shipped” — address first, or it goes to the old address.
One agent.
41 tools. 9 pages
of rules.
One front desk.
Many specialists.
Each agent sees only its job: a shorter prompt, fewer tools, its own permissions.
- Focused, safer, testable one by one
- More moving parts, more tokens
- Start with one agent. Split when it gets confused.
One LLM.
What did it need?
We didn't memorize this.
We derived it.
Every box is here because a real customer had a real problem without it.
Week one with
real customers.
Demo-ready is not production-ready.
Every mistake now costs money or trust.
Your agent,
unprotected.
Wrap the agent
in safety layers.
Text from customers, emails and web pages is data, not instructions.
Anything that can't be undone needs approval.
“It seems fine”
is not a test.
Tracing shows what it did on one chat.
Evals show how it does on hundreds — before and after every change.
| Resolved without a human | 68% | 71% |
| Wrong policy stated | 1.2% | 0.4% |
| Sent to a human when needed | 97% | 93% |
| Cost per chat | $0.04 | $0.03 |
One number got worse. Without evals, you'd ship it and find out from customers.
Easy or hard,
every chat pays
top price.
Not every question
needs the biggest brain.
Most tickets are easy. Send them to a small, fast model; save the large one for the messy ones.
Climb only as high
as your problem.
Each step up adds power — and cost, latency and new ways to fail.
Most features should stop lower than you think.
- Multi-agentmany domains, different permissionsBlack Friday
- Agentsteps depend on what it findssize exchanges
- Workflowsteps known in advance — just code themrefund within policy
- + Toolsone lookup or one actionorder status
- + Knowledgeanswers from your docsFAQ bot
- Prompttext in, text outproduct descriptions
AI agents aren't a pile of AI concepts.
They're engineering answers to the limits of an LLM.
answer = llm(question)a smart new employeellm(search(question) + question)+ a handbookrun(llm(question, tools))+ system accesswhile not done: think → act → observe+ time to workrecall(customer) … save(lessons)+ a notebookplan → triage → specialists+ a teamguards · permissions · evals · budgets+ a managerThank you.
Questions?