Courses / Agentic AI / Module 15
Module 15: Architecture and system design for agentic systems
10 h · theory 3 · hands-on 4 · project 2 · revision 1
You will be able to
- Choose between workflows, single agents and multi-agent designs
- Apply a decision framework to an unseen brief
- Design for safety, cost and failure
- Defend a design in an interview
Capstone increment: Architecture decision records for the capstone, plus two design exercises with model answers.
Job-description skills: System design · Lab tools: mermaid
1. A catalogue of agent architectures
From most predictable to most autonomous: a fixed workflow (prompt chains and code), a router (classify, then run one of a few paths), a single agent with tools, a supervisor with specialists, and a long-running autonomous agent. Each step adds flexibility and adds cost, latency, failure modes and safety work.
Most production systems that are called agents are workflows with one or two model-driven steps. Choose the least autonomy that does the job, and move up only for a measured reason.
2. A decision framework
Ask in order: can the steps be listed in advance? (then a workflow); are there a few known paths? (a router); does the next step depend on what is found? (an agent); are there independent sub-tasks with different permissions? (specialists). Then ask what can go wrong: irreversible actions need approval gates, long runs need durable execution, untrusted content needs the guardrails of Module 10.
HumanLayer’s “12-Factor Agents” captures many of the same lessons as principles: own your prompts, own your context window, own your control flow, keep agents small and focused, and make tools structured outputs your code executes. Record each choice in an ADR with the evidence.
3. Design for safety, cost and failure
Safety: least-privilege tools, a policy check, approvals by blast radius, sandboxed code and an injection suite. Cost: budgets per run, user and tenant, smaller models for simple steps, compaction and caching. Failure: durable execution, idempotent tools, compensation, step limits, loop detection and escalation to a person with context.
Observability and evals tie them together: every run traced, every change gated on the scenario suite. A design that can’t be measured can’t be trusted with production access.
4. Design exercise: an ops assistant for 300 services
Brief: an assistant that investigates alerts for a company running 300 services, proposes fixes and applies approved ones, with about 60 incidents a day and on-call engineers in India and Europe. Try it before reading on.
Model answer: alerts start a durable workflow; a supervisor runs log, metrics and runbook specialists (read-only, in parallel) through MCP servers with scoped credentials; a planner drafts the investigation; any change goes through an approval gate with a diff and undo plan routed to the owning team’s on-call; runbook RAG with service filters; budgets and loop detection per run; 25+ scenario evals at k = 3 in CI; traces in Langfuse. The main risk is a wrong change at peak hour, so blast-radius rules and approvals get the most design attention.
5. Design exercise: a refund agent for e-commerce
Brief: an agent that handles refund requests for an online retailer with 400,000 orders a day, deciding from order data and the refund policy, and refunding automatically below a limit.
Model answer: a router sends simple cases (damaged item with photo, within policy window) to a workflow and unclear ones to an agent with read tools (order, shipment, customer history) and policy retrieval; refunds above ₹2,000, repeat claimants and fraud flags go to a person; the refund tool is idempotent with a per-order key and a per-day budget; every decision is logged with the policy clause cited; evals compare agent decisions with past human decisions before the auto-refund limit is raised. The binding constraint is reviewer capacity, not model cost.
Hands-on: coding window
The coding window and the full VS Code lab are available after you sign in.
Sign in to codeLabs
Lab 15.1: Capstone ADRs
Write or finish ADRs for the architecture level, framework, memory policy, approval rules, sandboxing, durable execution and eval gate, each with numbers from your experiments.
Expected: docs/adr/ with one short record per decision, linked from the README.
Lab 15.2: Design exercise 1
Do the 300-service ops assistant brief in 45 minutes: diagram, estimates, safety design and risks. Compare with the model answer and list what you missed.
Expected: A one-page design and a list of gaps.
Lab 15.3: Design exercise 2 with review (capstone increment)
Do the refund agent brief, then swap with a peer (or the course’s AI professor) for review against the framework, and revise.
Expected: Your design, the review and the revision in docs/designs/.
Go deeper
Videos
- How We Build Effective Agents: Barry Zhang, Anthropic · AI Engineer · ~15 min. How Anthropic builds effective agents: keep it simple, think like the agent, and iterate.
- 12-Factor Agents: Patterns of reliable LLM applications — Dex Horthy, HumanLayer · AI Engineer · ~17 min. 12-Factor Agents: patterns of reliable LLM applications from teams that ship them.
- Agentic AI Frameworks Explained: Workflows, Multi-Agent, & Production · IBM Technology · ~12 min. Workflows, multi-agent systems and frameworks explained side by side.
Further reading
- Article Building effective agents · Anthropic. The clearest guide to when you need an agent at all, and the workflow patterns to try first.
- Article How we built our multi-agent research system · Anthropic. A real architecture write-up with costs, failure modes and evaluation.
- Article Agents · Chip Huyen. Tools, planning, reflection and failure modes of agents, with an engineer's view of the trade-offs.
GitHub repositories
- humanlayer/12-factor-agents: The twelve principles with examples; check your capstone against each one.
- anthropics/claude-cookbooks: The agent patterns notebooks that go with “Building effective agents”.
- architecture-decision-record/architecture-decision-record: ADR templates; use one for every capstone decision.
Checkpoint quiz
Interview questions
- Design an agent that investigates production incidents and applies approved fixes.
- How do you decide between a workflow, a single agent and a multi-agent system?
- Where do you put human approval in an agent design, and why there?
- Design a refund agent. How do you decide what it may do without a person?
- What would make you remove an agent and replace it with a workflow?
Ask the professor
Sign in to ask questions about this module.
Discussion
Community discussion appears here once giscus is configured (see README).