Agentic AI Foundations
From zero to understanding your first AI agent — the mental model, the vocabulary, and the moving parts. Python is the most important place to start, so this page opens with the complete Python curriculum, then covers the "what and why" that makes the hands-on chapters click. Every concept is tied to the course capstone: an AI DevOps Engineer you'll assemble in Part V.
By the end of this page you'll understand
- The difference between a chatbot and an agent — and why it matters.
- The seven building blocks every agent is made of.
- How an agent works step by step (the loop).
- Why "LLMs are the brain, agents are the doers."
- The common agent workflow patterns — and which ones the DevOps agent uses.
0 · Start here — learn Python first 🐍 intermediate
Here's a trap I've watched sink a lot of motivated people. They arrive excited about agents, skim the concept pages, and dive straight into Chapter 4 to "build an agent." Two hours later they're stuck — not on anything about agents, but on a dictionary that won't unpack, a for loop that indents wrong, an import that fails. The AI part was never the blocker; the Python underneath it was. They bounced off the language, not the idea. This section exists so that never happens to you.
Python is the most important thing to start with. Every lab, every project, and the entire capstone in this course are written in Python — so before the concepts click into working code, get comfortable with the language. The course ships a complete, self-contained Python curriculum: 20 hands-on lessons from absolute basics all the way to expert AI-engineering, each linked to where the course actually uses it.
Think of Python here the way a chef thinks of knife skills. Nobody signs up for cooking school because they're passionate about chopping onions — they want to make the beautiful dish. But every dish runs through the knife, so the chef who skipped knife practice is slow, frustrated, and cutting themselves all night. Python is your knife. Agents, RAG, tool-calling, evals — the "beautiful dishes" of this course — are all expressed in Python, so an hour spent getting fluent now pays itself back tenfold when the interesting chapters stop fighting you and start flowing.
And to name the fear directly, because it stops people: you do not need to be a "real programmer" to do this. Agentic AI code is mostly plain, readable Python — functions that call an API, dictionaries that hold a message, loops that repeat until done. If you can read the labs in this course and follow what each line does, you're ready; you don't need years of software engineering behind you. The curriculum below is deliberately laddered so an absolute beginner can start at P1 and climb, while someone already fluent can skim and skip ahead. Either way, treat Python as the ground you stand on, not a detour — the concepts on the rest of this page will feel abstract until you've seen them land in code you can run.
Read it bottom-left to top-right, following the arrows as rising rungs on a staircase.
- The bottom box is tier ① Fundamentals (P1–P6) — the language basics every lab uses. This is where an absolute beginner starts.
- The middle box is tier ② Data Structures & Algorithms (D1–D6), built from scratch so the later cost/scaling reasoning makes sense.
- The top box is tier ③ Advanced AI Engineering (A1–A8) — async, tensors, tokenization, MLOps — the material the agent/RAG chapters lean on.
- The arrows rising left-to-right are the payoff: each tier stands on the one below it, so the path only ever climbs; someone already fluent can skim the lower rungs and jump in higher.
In short: Fundamentals → DSA → advanced — one climbing path. Start at the rung that fits you and go up.
Basics, data & structures, functions/OOP, advanced, expert, real-world engineering. Start at P1 →
Complexity, stacks/queues/lists, hashing, trees/heaps, graphs, sorting/searching — from scratch. Start at D1 →
Async, numerics/tensors, tokenization, validation, vector DBs, MLOps. Start at A1 →
The full curriculum — and every individual lesson — is always in the left menu at the top, above the course chapters. Come back to it whenever you hit Python you want to understand more deeply.
1 · What is Agentic AI? intermediate
Start with a moment you've probably had. You paste a stack trace into a chatbot and it writes you a beautiful three-paragraph explanation of what's wrong and exactly which commands to run. Helpful — but then you open the terminal, you run the commands, you read the output, you come back and paste the next thing. The AI knew the answer the whole time; you were its hands and feet. An agent is what you get when the AI grows its own hands and feet — when it can run those commands, read that output, and decide the next step, all without you shuttling text back and forth.
Here's the everyday analogy that makes the line crisp. A chatbot is a brilliant consultant on the phone: ask anything, get expert advice, but they never leave their desk — nothing in your world actually changes until you go do it. An agent is a contractor you hand a key: you describe the outcome you want ("get the leaking pipe fixed"), and they show up, inspect, decide what tools to grab, do the work, check it held, and only call you when they need a sign-off. The consultant tells; the contractor does. That single difference — action toward a goal — is the whole subject of this course.
The common mistake beginners make is assuming "agent" just means "a smarter chatbot" or "a chatbot with a longer memory." It doesn't. A chatbot could have a genius-level IQ and a perfect memory and still be a chatbot, because it never touches the world — it only ever produces text for you to act on. What flips it into an agent isn't raw intelligence, it's agency: the wiring that lets it call tools, observe real results, and loop until the job is done. Keep that test in your pocket as you read on: after the AI finishes, has anything actually changed out in the world? If the answer is "no, it just told me things," you have a chatbot; if the answer is "yes, it gathered evidence and opened a fix," you have an agent. The two side-by-side cards below make the contrast concrete before we pin down the definition.
Read the two columns top to bottom: the left is a chatbot's flow, the right is an agent's, split by the dashed divider.
- Left column: the AI produces advice (top box), then the red box shows you doing the actual steps. The arrow stops there — nothing in the world moved on its own.
- Right column: the agent plans and calls a tool (top box), and the green box is a real change in the world — a PR opened. Notice there is no "you run it" box.
- The curved arrow on the right loops the agent back to plan again: it observes the result and keeps going until the goal is met, with no human relaying text between steps.
In short: Chatbot = advice → you act. Agent = it acts and loops. Agency, not IQ, is the dividing line.
🤖 Chatbot
Answers questions. You ask, it replies. One turn, no action in the world. It knows things and talks — that's it.
"How do I debug a crash-looping pod?" → a paragraph of advice.
🦾 Agent
Plans, uses tools, takes action, completes tasks. You give it a goal; it figures out the steps, uses tools to do them, checks its work, and delivers a result.
"This pod is crashing" → it gathers logs, diagnoses, and opens a fix PR.
Agentic AI is AI that can take action toward a goal. It can plan, use tools, remember context, and complete multi-step tasks — not just chat about them.
2 · Why Agentic AI matters intermediate
Picture the last time a real task ate your afternoon. Not one hard question — a chain of small ones. An alert fires; you pull logs; the logs point at a bad deploy; you check what changed; you cross-reference the runbook; you draft a fix; you get someone to review it. Any single step, a chatbot could have helped with in seconds. But you were the one carrying the thread across all of them — holding the context, deciding the next move, gluing the pieces together. That gluing-together is exactly the work agentic AI is built to take off your plate.
Here's why that's a bigger deal than "a faster chatbot." A one-turn assistant helps with steps; an agent owns outcomes. The analogy is the jump from a calculator to a spreadsheet: a calculator answers one sum at a time and you copy each result forward by hand, while a spreadsheet holds the whole model, re-runs when something changes, and hands you the finished answer. Agents do that for multi-step work — they keep the context, sequence the steps themselves, and adapt when a step surprises them. The value isn't that they're smarter per step; it's that you stop being the human clipboard shuttling state between steps.
The mistake to avoid is reaching for an agent for everything, because "agentic" is the exciting word. If a job is genuinely one-shot — "summarize this paragraph," "classify this ticket" — an agent is overkill: more moving parts, more cost, more ways to fail, for a task a single call already nails. Agents earn their complexity precisely when the task is multi-step, uncertain, and stateful — when you don't know step 3 until you've seen the result of step 2. The three capabilities below — automation, planning, decision-making — are the levers that make that possible, and they're worth reading as "what an agent can do that a lone LLM call cannot."
Compare the two rows top vs bottom: the top is life without an agent, the bottom is life with one.
- The top row of boxes is one real task broken into steps — alert → pull logs → check deploy → draft fix — connected by arrows meaning "then."
- The 👤 markers under each box are you: without an agent, a human has to carry the context from each step into the next, gluing them together by hand.
- The single green bar at the bottom is the agent: it absorbs the whole chain into one actor that keeps state, sequences the steps, and adapts — so the 👤 relay disappears.
In short: Without an agent you are the human clipboard between steps; an agent owns the entire multi-step outcome so you don't have to.
Handles repetitive, multi-step work end-to-end without a human driving each step.
Breaks a fuzzy goal into concrete steps and sequences them itself.
Chooses what to do next based on what it observes — not a fixed script.
It's the direction the whole field is heading: from "AI that tells you how" to "AI that does it, with you supervising."
3 · The building blocks of an agent advanced
The word "agent" can feel like a black box — magic in, results out — and that vagueness is what makes it intimidating. So let's break the box open. An agent isn't one mysterious thing; it's a small kit of ordinary parts wired together, and once you can name the parts, the magic turns into engineering you can actually build. That's the whole aim of this section: replace "an agent, somehow" with "these seven pieces, connected like so."
Think of it like the parts of a car. A car isn't a single indivisible marvel — it's an engine, a steering wheel, wheels, a fuel tank, a dashboard, brakes, and a driver, each with one clear job, combining into something that gets you places. An agent is the same: a goal (where you're going), planning (the route), tools (the engine that does work), memory (the trip so far), decision-making (the steering), action (actually moving), and a human-in-the-loop (the driver who can grab the wheel). Learn the parts once and every agent you ever meet — simple or frontier — decomposes into the same kit.
The mistake here is skipping straight to "tools" and ignoring the rest, because tool-calling is the flashy part everyone demos. But an agent that can call tools with no memory forgets what it just learned; one with no human-in-the-loop happily runs a destructive command; one with no real decision-making is just a fixed script wearing a costume. The seven blocks matter together — the reliability and safety of a real agent live in the unglamorous ones (memory, decision-making, the human checkpoint) as much as in the exciting one. Read the cards below as a checklist you'll return to: every agent you build in this course, up to the capstone, is these same seven pieces, and you'll construct each by hand later. Right now, just get comfortable naming them and what each is.
Read it from the centre outward: the middle box is the agent, and each surrounding box is one of the seven parts feeding into it.
- The centre box "the AGENT" is the machine you're building — everything else plugs into it, like parts of a car around the driver.
- The seven labelled boxes around it are the blocks: Goals (top), Planning, Tool usage, Memory, Decision-making, Action, and Human-in-the-loop.
- The connecting lines show every block wiring into the same core — the point of the picture is that they work together, not that tools alone make an agent.
- The green Human-in-the-loop box is highlighted because it is the safety checkpoint before anything irreversible — one of the "unglamorous" blocks that actually makes an agent trustworthy.
In short: Name the seven parts and the black box disappears — an agent is these pieces wired around a core, reliability living in the boring ones.
What the agent is trying to achieve. → "produce a broadcast-ready cut."
Deciding the steps to get there.
Calling external tools — search, APIs, code, media processors.
Remembering context across steps and sessions.
Choosing what to do next based on results.
Actually executing a step in the world.
A human checks or approves before risky/irreversible steps.
| Block | Built in |
|---|---|
| Tool usage, Action | Chapter 4 (agent + tools) |
| Memory | Chapter 4 (stateful agent) |
| Planning, Decision-making | Chapter 4 (the loop) |
| Human-in-the-loop | Chapter 4 & 6 (approval gates) |
| Goals | Chapter 2 (system prompt) & every chapter |
4 · How an agent works (step by step) advanced
If you take one thing from this entire page, take this loop. Everything else — the seven blocks, the workflow shapes, the capstone architecture — is detail hanging off this single skeleton. An agent gets a task, makes a plan, picks a tool, does something, checks whether it worked, and then — the crucial part — decides whether to go around again. Miss the loop and you've missed what an agent is; get the loop and the rest is just filling it in.
The homely analogy is how you actually fix things in real life. Say your car won't start. You don't run a fixed script; you loop: guess it's the battery (plan) → grab the jump leads (choose tool) → try a jump (act) → still dead? (check) → new guess, maybe it's the starter (plan again) → and round you go until it turns over. Each attempt teaches you something that reshapes the next attempt. That "try, look at what happened, adjust, try again" rhythm is precisely the agent loop — and it's why an agent can handle a messy problem whose steps nobody could write down in advance.
The mistake to watch for is picturing an agent as a straight pipeline — task in one end, answer out the other, done. That's a workflow, not an agent, and it breaks the instant reality doesn't match the plan: the very first tool call returns something unexpected and a straight pipeline just barrels on with garbage. The loop is what buys robustness — the "check the result" step catches the surprise, and the "improve and repeat" arrow feeds it back into a fresh plan. Read the diagram below with your eye on that curved arrow returning to the start: the five steps in a row are the easy part, but the arc looping back is the whole point.
This is the single most important picture in the chapter: it shows the agent loop — the repeating cycle an AI agent runs to get a job done. Read the five numbered circles left to right, then follow the coloured arrow that curves back to the start.
- Circle 1 — "Get task" (the filled purple one) is where a job arrives, e.g. "an alert just fired." That's the agent's goal for this run.
- Circles 2→5 are the thinking-and-doing steps, and the straight blue arrows between them mean "then": 2 Break into steps (make a plan) → 3 Choose tool (which command fits?) → 4 Do it (actually run the tool) → 5 Check result (did that work? is the evidence solid?).
- Circle 6 (the small green circle, lower right) is the decision point after checking: is the task finished, or not yet? The green arrow labelled
improve & loopleads into it. - The dashed teal arrow sweeping from 6 back up to circle 2 is the loop: if the task isn't done, the agent takes what it learned and plans again, repeating the cycle. That "check, then improve and repeat" arrow is exactly what makes an agent smarter than a one-shot script.
In short: An agent = plan → pick a tool → act → check → repeat until done. A plain program runs its steps once in a fixed order; an agent keeps looping and adjusting based on what it sees, so it can handle messy, real-world tasks.
Task → break into steps → choose the right tool → do the step → check the result → improve and repeat until done. That "check & improve" loop is what makes an agent more than a script.
kubectl? aws?) → 4 run it → 5 check (root cause found? evidence solid?) → 6 propose the fix as a PR. Identical shape.5 · LLMs vs AI Agents advanced
People blur these two words constantly, and the blur causes real confusion — so let's separate them for good. "LLM" and "agent" get used almost interchangeably in casual talk, but they're different layers of the same system, and mixing them up is why beginners can't tell why their "agent" didn't do anything. An LLM is a component; an agent is the machine built around that component. One thinks; the other acts.
The cleanest analogy is a brain in a jar versus a whole person. A large language model is an astonishing brain: it understands language, reasons, weighs options, and produces the right decision — but sitting in its jar it can't pull a lever, read a dial, or open a door. It can only say what should be done. An agent is that brain given a body: eyes to observe (read tool output), hands to act (call tools), a notebook to remember (memory), and the nervous system that keeps the cycle going (the loop). The intelligence lives in the brain; the doing lives in the body wrapped around it.
Here's the mistake this framing kills: expecting an LLM, by itself, to change something in the world — and being baffled when it just describes the change instead. That's not a failure, it's the LLM doing exactly its job: it decides, it never executes. If you want a file written, a command run, a PR opened, you (or the agent scaffolding you build) must hand the model tools and wire up the loop that carries its decisions into action. Getting this distinction bone-deep is what the rest of the course rests on: the LLM is the smartest part but the least capable on its own, and the engineering — the part you're here to learn — is everything that turns a decision into a done thing. The two cards below name the split; the one-liner that follows is worth memorising.
Read it inside-out: the big outer box is the whole agent; the small box inside it is the LLM.
- The inner amber box "LLM" is the brain — it reasons and decides, but "decides only": on its own it never touches the world.
- The three boxes on the right are what the agent adds around the brain: tools (to call APIs/CLIs), memory (to carry state), and the loop (to execute and repeat).
- The arrows from the LLM to those boxes are decisions flowing outward into action — the model says what, and the wrapper makes it happen.
- The big surrounding box is the payoff: brain + tools + memory + loop together = the agent. Take away the wrapper and you're left with a brain in a jar that can only talk.
In short: LLM = decides; agent = the body of tools, memory and a loop that carries those decisions into the world.
🧠 LLM — the brain
Understands language and generates text. It can suggest what to do, reason about a problem, and decide — but it can't act on the world by itself.
🦾 Agent — the doer
An LLM plus tools, memory, and a loop. It takes the brain's decisions and actually executes them, step after step, until the task is complete.
kubectl, terraform, git) do it. The agent is the wiring between them.6 · Common agent workflows expert
Once you've built a couple of agents, a quiet realization arrives: you keep drawing the same handful of diagrams. The task changes — support triage, incident diagnosis, research synthesis — but the wiring falls into a few recurring shapes you've seen before. That's not a coincidence; it's the good news. You don't invent a new architecture per problem. You recognise which of a small set of proven shapes fits, and reach for it. This section names those shapes so you stop reinventing them.
Think of them like sentence structures in a language. English has only a few basic patterns — statement, question, command, conditional — yet they compose into infinite sentences. Agent workflows are the same small grammar: chaining (a fixed line of steps), routing (classify, then branch), the ReAct loop (reason → act → observe, repeat), and the orchestrator (fan work out, gather it back). Every elaborate agent you'll ever read about is these primitives, combined and nested. Learn the grammar once and you can parse — and design — any agent you meet.
The mistake nearly everyone makes first is defaulting to the loop for everything, because the ReAct loop is the one that feels "agentic." But the loop is also the most expensive and least predictable shape — every iteration is another model call and another chance to wander. If a task's steps are actually known and fixed, plain chaining is cheaper, faster, and easier to debug; if it's a clean either/or, routing beats looping. The skill isn't always using the fanciest shape — it's matching the shape to the task, saving the loop for problems whose steps genuinely can't be known in advance. As you read the four shapes below, don't memorise them; just tune your eye to recognise them, because you'll meet all four again when you build Chapter 4.
This diagram is a quadrant — four small mini-diagrams, one per corner — each showing a common shape that agents are wired into. In every mini-diagram a box is a step and an arrow means "flows to." The coloured word above each corner names the pattern.
- Top-left — Chaining: three boxes in a straight row with arrows (step → step → step). The steps always run in the same fixed order, like an assembly line.
- Top-right — Routing: one box splits into two, so the arrows fan out. The agent first classifies the input, then picks one branch to follow — like a switch that sends easy vs. hard questions down different paths.
- Bottom-left — ReAct loop: a
reasonbox and anactbox with an arrow that curves back on itself (labelledobserve → loop). The agent reasons, acts, looks at the result, then reasons again — this is the same loop as the first diagram, and it's what Chapter 4 builds. - Bottom-right — Orchestrator: a
planbox with arrows fanning out to three boxes. One "manager" step splits the work into subtasks, runs them, and gathers the results back together.
In short: These are just four ways to connect the boxes: chaining = fixed line, routing = pick a branch, ReAct = loop, orchestrator = fan out and gather. Real agents mix and match them — you don't have to memorise them now, just recognise the shapes when you meet them in Chapter 4.
| Pattern | What it does | The DevOps agent |
|---|---|---|
| Planner | Breaks the goal into a task list first, then executes. | Plans the full provisioning before writing Terraform |
| Executor | Carries out each planned step with tools. | Runs get-logs → describe → check-recent-deploys |
| Reflection loop | Reviews its own result and redoes weak parts. | "Does this terraform plan destroy anything? Reconsider." |
| ReAct | Alternates reasoning and acting, step by step. | Inspect → hypothesize → gather more evidence → conclude |
| Multi-step | Chains many sub-tasks into one bigger job. | Diagnose → fix → open PR → verify, end-to-end |
7 · The capstone through this lens expert
Every concept on this page has been building toward one payoff, so let's cash it in. Abstract ideas — brain vs. doer, the loop, the seven blocks, the workflow shapes — only truly stick once you watch them assemble into something real. So here we take the whole vocabulary and point it at the concrete thing you'll build: the AI DevOps Engineer. If the earlier sections felt theoretical, this is where the theory grows a spine.
Here's the analogy that keeps the capstone honest, and it's the one misconception worth killing before you write a line of it. The agent is a surgeon, not a scalpel. A surgeon doesn't cut with their hands — they decide where to cut and wield precise instruments to do it, and a good operating theatre has checklists and a second pair of eyes before anything irreversible happens. Our agent is exactly that: the LLM is the surgeon's judgment (diagnose, decide, plan), the real tools — kubectl, terraform, aws, git — are the instruments that actually cut, and a human sign-off is the theatre checklist. The mistake that sinks people is imagining the AI itself "does" the infrastructure work by magic; it doesn't. It reasons and orchestrates; boring, battle-tested CLIs do the doing. That's not a limitation to apologise for — it's what makes the whole thing trustworthy enough to ship.
The course's destination (Chapter 8) is an AI DevOps Engineer — an agent that onboards into any company's stack and diagnoses, proposes, and (carefully) executes infrastructure work. Here's the honest architecture, using every concept above.
Read the stack top to bottom, following the arrows — an alert enters at the top and a proven fix comes out the bottom.
- Trigger (top) is what starts a run — an alert, a Slack command, a PR — caught by a webhook.
- Knowledge gives the agent this company's runbooks and conventions via RAG, so it isn't guessing.
- The purple Brain is the LLM (Claude): it diagnoses and decides a structured plan — but notice it's not the layer that touches infrastructure.
- The amber Hands are the real CLIs —
kubectl,terraform,aws,git— that actually do the work the brain decided on. - The green Review gate is the human sign-off before any state change; Trust at the bottom is the eval suite that must prove an operation safe before it's ever automated.
In short: Trigger → Knowledge → Brain → Hands → Review → Trust — the brain decides, boring CLIs do the doing, and humans plus evals guard every real change.
kubectl, terraform, aws, git. It's a textbook agent where the tools happen to be infrastructure CLIs — which is why it fits this course so cleanly.| Layer | Role | Tech | Course link |
|---|---|---|---|
| Trigger | Fire on an alert / Slack command / PR | webhook → handler | your AWS repo |
| Knowledge | Know this company's runbooks & conventions | RAG | Ch 3 |
| Brain | Diagnose & decide → a structured plan | Claude (structured JSON) | Ch 2 + Ch 4 |
| Hands | Inspect & act (read-only free; writes gated) | kubectl, terraform, aws, git | Ch 4 tools |
| Review | Human approves any state change | policy / approval gate | Ch 4 + Ch 6 |
| Trust | Prove decisions are correct & safe | evals | Ch 5 |
- Read-only first, gated writes later. The agent starts by diagnosing — it can't change anything. It earns the right to act one operation at a time, on evidence. Prod stays human-approved indefinitely.
- Copilot, not lights-out. The win is turning an hour of toil into a 60-second PR review — not an unattended agent running
terraform applyon prod. Full autonomy comes only where evals prove an operation safe.
What's next expert
You now have the mental model. Two ways forward:
- See the Learning Roadmap — the step-by-step path and the common mistakes to avoid.
- Or jump into building: Chapter 1 makes your first API call.
get_weather, picture kubectl_get or terraform_plan. Every lab ends with a "🏗️ Toward the capstone" note showing exactly how it plugs into the AI DevOps Engineer.🪜 Practice ladder beginner → industry
Six graded exercises, easy to real-world. Try each before opening its solution.
Context: The first fork in agentic AI is deciding whether a job even needs an agent. A chatbot answers in one turn; an agent plans, uses tools, and acts toward a goal — and confusing the two leads to over- or under-engineering.
Your task: Classify each request as a chatbot job or an agent job and justify each in one line: (a) “explain how to fix a crash-looping pod,” (b) “this pod is crashing — gather logs, diagnose, and open a fix PR.”
Requirements:
- Label (a) as chatbot: one turn, answers a question, takes no action in the world
- Label (b) as agent: given a goal, it plans, uses tools, acts, and delivers a result
- Justify each in a single sentence tied to the lesson's definition
- Name the distinguishing test: does it act toward a goal or merely describe how?
💡 Hint: Ask of each: after the reply, has anything changed in the world? Only the agent gathers logs and opens a PR.
Show solution
(a) Chatbot. It answers a question in one turn and takes no action in the world — you ask, it replies with a paragraph of advice.
(b) Agent. You give it a goal and it plans steps, uses tools (gather logs), takes action (diagnose), and delivers a result (opens a PR). It acts toward a goal, not just chats about it.
The lesson's one-liner: a chatbot could describe how to fix a broken deployment; the agent actually does it. That difference — plan, use tools, take action, complete multi-step tasks — is what makes (b) an agent problem.
Context: Every agent, including the course capstone, is assembled from the same seven pieces. Being able to name them and point at a concrete instance of each is the vocabulary the rest of the course assumes.
Your task: List the seven building blocks of an agent from the lesson, then give one concrete capstone example each for the Tool usage and Human-in-the-loop blocks.
Requirements:
- Enumerate all seven: Goals, Planning, Tool usage, Memory, Decision-making, Action, Human-in-the-loop
- One-line description of what each block is
- Tool usage example is a real infra CLI call (e.g.
kubectl getorterraform plan) - Human-in-the-loop example gates a state change (a human approves before
terraform apply) - Reflect the lesson's rule: read-only diagnosis is free, writes are gated
💡 Hint: The blocks map onto the loop: goal in, plan, pick a tool, act, remember, decide, and a human checkpoint before anything irreversible.
Show solution
The seven building blocks:
1. Goals - what it's trying to achieve
2. Planning - deciding the steps to get there
3. Tool usage - calling external tools (APIs, code, CLIs)
4. Memory - remembering context across steps/sessions
5. Decision-making - choosing what to do next from results
6. Action - actually executing a step in the world
7. Human-in-the-loop - a human approves risky/irreversible steps
Tool usage (capstone): the agent calls real infrastructure CLIs — e.g. kubectl get to pull pod logs/events or terraform plan to preview a change. Human-in-the-loop (capstone): before any state change (a terraform apply on prod), a human reviews and approves the proposed fix PR — read-only diagnosis is free, writes are gated.
Context: The agent loop — get task, plan, choose tool, act, check, repeat — is the single most important picture in the chapter. Turning it into runnable code makes concrete what separates an agent from a one-shot script.
Your task: Write a small pure-Python skeleton that expresses the lesson's loop using stub functions — plan, choose_tool, act, and check — driven by an agent(task) that runs.
Requirements:
- Model all six steps: receive task, plan, choose tool, act, check, loop on the decision
- Use a
whileloop that re-plans whenchecksays not done - Carry state across iterations in a
memorylist (the observe step) - Stubs may be trivial, but the program must run and terminate
- Make clear how this differs from a fixed script that runs its steps once
💡 Hint: The distinguishing feature is the while + check: an agent re-plans based on what it observed, rather than executing a fixed sequence once.
Show solution
def plan(task, memory): # step 2: break into steps
return ["gather_logs", "diagnose"] # stub plan
def choose_tool(step): # step 3
return {"gather_logs": "kubectl", "diagnose": "llm"}[step]
def act(tool, step): # step 4: do it
return f"ran {tool} for {step}"
def check(results): # step 5: is evidence solid / task done?
return len(results) >= 2 # stub: done once we've acted twice
def agent(task):
memory = [] # step 1: get task -> goal for this run
while True:
for step in plan(task, memory):
tool = choose_tool(step)
memory.append(act(tool, step)) # observe -> memory
if check(memory): # step 6: done?
return memory
# else: improve & loop -- plan again with what we learned
print(agent("fix crash-looping pod"))
This mirrors the diagram exactly: circle 1 is receiving the task, 2–5 are plan → choose tool → act → check, and circle 6 is the decision point whose dashed arrow loops back to plan when the task isn't done. The distinguishing feature versus a plain script is the while loop with check: an agent re-plans based on what it observes, rather than running a fixed sequence once. memory is what carries context across iterations.
Context: Agents are wired into a few recurring shapes — chaining, routing, the ReAct loop, and the orchestrator. Recognising which shape fits a task is what lets you pick an architecture instead of reaching for the loop every time.
Your task: For each of the four workflow shapes, describe its structure in one line and give a task where it is the right fit.
Requirements:
- Cover all four: chaining, routing, ReAct loop, orchestrator
- Chaining = fixed steps in order; routing = classify then pick a branch
- ReAct loop = reason → act → observe, curving back until done
- Orchestrator = a planner fans work to subtasks, then gathers results
- Each fit example should genuinely suit that shape (e.g. incident diagnosis for ReAct)
💡 Hint: The key contrast: chaining runs a fixed line once, while the ReAct loop's “check then improve” wins when the steps aren't known in advance.
Show solution
| Shape | Structure | Good fit |
|---|---|---|
| Chaining | Fixed steps in order (step → step → step), like an assembly line. | A known, stable transform: extract → summarize → format a report. |
| Routing | Classify the input, then pick one branch. | Support triage: send easy FAQs one way, complex tickets another. |
| ReAct loop | Reason → act → observe, curving back on itself until done. | Incident diagnosis where steps aren't known in advance and depend on what you find. |
| Orchestrator | A planner fans work out to subtasks, then gathers results. | Research across many sources in parallel, then synthesize. |
The key contrast the lesson draws: chaining runs a fixed line once; the ReAct loop's "check then improve and repeat" wins on messy, real-world tasks whose steps aren't known up front, because it gathers more evidence and adjusts. Real agents mix and match these shapes.
Context: Real agent deployments are judged on their architecture, not their demo. The AI DevOps Engineer's six layers — trigger, knowledge, brain, hands, review, trust — are the honest blueprint the whole course builds toward.
Your task: Lay out the six-layer architecture of the AI DevOps Engineer, naming the role and tech for each layer, then state which layer is the “brain” and why the LLM is not the tool.
Requirements:
- Name all six layers with their role and tech (webhook, RAG, Claude, CLIs, approval gate, evals)
- Identify the brain as the LLM/agent that diagnoses and decides a structured plan
- Explain that the brain orchestrates tools but doesn't do the work itself
- Name the real tools that do the work:
kubectl,terraform,aws,git - Tie it to the lesson's one-liner: LLMs are the brain; agents are the doers
💡 Hint: The agent is the wiring between a decision and the CLIs that execute it — a textbook agent where the tools happen to be infrastructure CLIs.
Show solution
| Layer | Role | Tech |
|---|---|---|
| Trigger | Fire on an alert / Slack command / PR | webhook → handler |
| Knowledge | Know this company's runbooks & conventions | RAG |
| Brain | Diagnose & decide → a structured plan | Claude (structured JSON) |
| Hands | Inspect & act (read-only free; writes gated) | kubectl, terraform, aws, git |
| Review | Human approves any state change | policy / approval gate |
| Trust | Prove decisions are correct & safe | evals |
The brain layer is the LLM/agent — it reasons about the problem and orchestrates the real tools, but it doesn't do the work itself. The actual changes are made by kubectl, terraform, aws, git. That is the crucial truth from the lesson: "LLMs are the brain; agents are the doers" — the agent is the wiring between a decision and the CLIs that execute it, which is why it's a textbook agent where the tools happen to be infra CLIs.
Context: The moment an agent can touch production, the argument shifts from capability to safety. An exec pushing for unattended writes on prod is the pressure every real agent team faces — and the lesson's two scoping rules are the defensible answer.
Your task: An exec wants the DevOps agent running terraform apply on prod unattended “to save time.” Using the lesson's two scoping rules, write a short rebuttal and the safe path to more autonomy.
Requirements:
- Invoke rule 1 — read-only first, gated writes later; prod stays human-approved
- Invoke rule 2 — copilot, not lights-out; the win is a 60-second PR review, not autonomy
- Explain why unattended
terraform applyon day one makes one bad plan catastrophic - Give a staged path: diagnose → open a PR → build evals → auto-approve narrow, proven ops
- State the principle: autonomy is granted by measurement (evals), not by exec urgency
💡 Hint: Anchor the rebuttal in the Review and Trust layers — full autonomy comes only where evals prove a specific operation safe, lower environments first.
Show solution
Rebuttal, grounded in the lesson's two honest scoping rules:
- Read-only first, gated writes later. The agent starts by diagnosing — it can't change anything. It earns the right to act one operation at a time, on evidence. Prod stays human-approved indefinitely. Handing it unattended
terraform applyon prod on day one inverts this and makes a single bad plan catastrophic and irreversible. - Copilot, not lights-out. The real win is turning an hour of toil into a 60-second PR review — not an unattended agent mutating prod. Full autonomy comes only where evals prove a specific operation safe.
Safe path to more autonomy: (1) ship read-only diagnosis that opens a reviewable fix PR; (2) build the eval suite (the "Trust" layer) so you can measure correctness and safety per operation; (3) auto-approve only the narrow operations whose evals prove safe, in lower environments first; (4) keep prod state changes human-gated behind the approval policy. Autonomy is granted by measurement, not by exec urgency — the same discipline the capstone's Review and Trust layers exist to enforce.
Knowledge check check yourself
The lesson's one-liner is 'LLMs are the brain; agents are the doers.' What does an agent add to an LLM, and why does that distinction matter for the DevOps capstone?
Show answer
Contrast the ReAct-loop pattern with a plain chaining workflow. When does the loop's 'check then improve and repeat' give an agent an edge over a fixed sequence of steps?