AI EngineeringZero to ProductionHome·About·Contact
Part 0 · Concepts (read before you code)

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.

🐍 Python first⏱️ ~30 min read🧠 Concepts🏗️ Capstone threaded

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

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.

👉 Your first stepOpen the Complete Python Curriculum — all of Python under one link, in order. New to Python? Work it top to bottom. Already fluent? Skim it and jump straight to the concepts below. Either way, this is the foundation everything else stands on.

P
① Fundamentals (P1–P6)

Basics, data & structures, functions/OOP, advanced, expert, real-world engineering. Start at P1 →

D
② Data Structures & Algorithms (D1–D6)

Complexity, stacks/queues/lists, hashing, trees/heaps, graphs, sorting/searching — from scratch. Start at D1 →

A
③ Advanced AI Engineering (A1–A8)

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

🤖 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.

VS

🦾 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.

🏗️ The capstoneA chatbot could describe how to fix a broken deployment. The AI DevOps Engineer will actually do it — gather the evidence, diagnose, and open the fix as a reviewable PR. That's why it's an agent problem, not a chatbot problem.

2 · Why Agentic AI matters intermediate

⚙️
Automation

Handles repetitive, multi-step work end-to-end without a human driving each step.

🗺️
Planning

Breaks a fuzzy goal into concrete steps and sequences them itself.

🧩
Decision-making

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."

🏗️ The capstoneToday, triaging an incident or reviewing an infra change eats a senior engineer's time. An agent that gathers context and proposes a fix the moment an alert fires turns an hour of toil into a 60-second review — that's the automation + decision-making value, made concrete.

3 · The building blocks of an agent advanced

Every agent — including yours — is assembled from these seven pieces. You'll build each one by hand later; here's what they are.

🎯
Goals

What the agent is trying to achieve. → "produce a broadcast-ready cut."

🗺️
Planning

Deciding the steps to get there.

🔧
Tool usage

Calling external tools — search, APIs, code, media processors.

🧠
Memory

Remembering context across steps and sessions.

🧩
Decision-making

Choosing what to do next based on results.

🎬
Action

Actually executing a step in the world.

🧑‍⚖️
Human-in-the-loop

A human checks or approves before risky/irreversible steps.

Where you'll build each block
BlockBuilt in
Tool usage, ActionChapter 4 (agent + tools)
MemoryChapter 4 (stateful agent)
Planning, Decision-makingChapter 4 (the loop)
Human-in-the-loopChapter 4 & 6 (approval gates)
GoalsChapter 2 (system prompt) & every chapter

4 · How an agent works (step by step) advanced

1Get task 2Break intosteps 3Choosetool 4Do it 5Checkresult 6 improve & loop
🗺️ How to read this diagram

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 & loop leads 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.

🏗️ The capstone, as these steps 1 alert fires → 2 plan: gather logs, events, recent deploys → 3 choose tool (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

🧠 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.

The one-liner to rememberLLMs are the brain; agents are the doers. This is the single most important idea for the capstone: the LLM decides what to do about a broken deployment, but real tools (kubectl, terraform, git) do it. The agent is the wiring between them.

6 · Common agent workflows expert

Agents are assembled in a few recurring shapes. You'll recognize these when you build Chapter 4.

Chaining — step → step → step Routing — pick a branch ReAct loop — reason ⇄ act ⇄ observe reason act observe → loop Orchestrator — fan out, gather plan Four recurring agent shapes. Chaining runs fixed steps in order; routing picks a branch by classification; the ReAct loop alternates reason→act→observe until done (Ch 4's loop); the orchestrator plans, fans out subtasks, and gathers results. Real agents combine them.
🗺️ How to read this diagram

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 reason box and an act box with an arrow that curves back on itself (labelled observe → 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 plan box 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.

PatternWhat it doesThe DevOps agent
PlannerBreaks the goal into a task list first, then executes.Plans the full provisioning before writing Terraform
ExecutorCarries out each planned step with tools.Runs get-logs → describe → check-recent-deploys
Reflection loopReviews its own result and redoes weak parts."Does this terraform plan destroy anything? Reconsider."
ReActAlternates reasoning and acting, step by step.Inspect → hypothesize → gather more evidence → conclude
Multi-stepChains many sub-tasks into one bigger job.Diagnose → fix → open PR → verify, end-to-end
Where you'll build theseChapter 4 builds the Executor + ReAct loop directly. Chapter 5 (evals) is where the Reflection loop gets real teeth — you can't "review your own work" reliably without a way to measure quality.

7 · The capstone through this lens expert

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.

The crucial truthThe LLM/agent is the decision-maker, not the tool. It reasons about the problem and orchestrates real tools; the actual work is done by 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.
LayerRoleTechCourse link
TriggerFire on an alert / Slack command / PRwebhook → handleryour AWS repo
KnowledgeKnow this company's runbooks & conventionsRAGCh 3
BrainDiagnose & decide → a structured planClaude (structured JSON)Ch 2 + Ch 4
HandsInspect & act (read-only free; writes gated)kubectl, terraform, aws, gitCh 4 tools
ReviewHuman approves any state changepolicy / approval gateCh 4 + Ch 6
TrustProve decisions are correct & safeevalsCh 5
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.
  • Copilot, not lights-out. The win is turning an hour of toil into a 60-second PR review — not an unattended agent running terraform apply on prod. Full autonomy comes only where evals prove an operation safe.
🎬 Have a different project in mind?The same lens works for any agent — an audio/video editing agent, a customer-support agent, a research agent. The layers (trigger → knowledge → brain → gated tools → review → evals) don't change; only the tools do. Learn the pattern here; apply it to whatever you build.

What's next expert

You now have the mental model. Two ways forward:

Learn with the end in mindAs you go through the hands-on chapters, keep the capstone in view. When Chapter 4 says 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.

Exercise 1 · Chatbot or agent?Beginner

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.

Exercise 2 · Name the seven building blocksIntermediate

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 get or terraform 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.

Exercise 3 · Encode the agent loop as pseudocodeAdvanced

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 while loop that re-plans when check says not done
  • Carry state across iterations in a memory list (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.

Exercise 4 · Match the four workflow shapes to tasksExpert

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
ShapeStructureGood fit
ChainingFixed steps in order (step → step → step), like an assembly line.A known, stable transform: extract → summarize → format a report.
RoutingClassify the input, then pick one branch.Support triage: send easy FAQs one way, complex tickets another.
ReAct loopReason → act → observe, curving back on itself until done.Incident diagnosis where steps aren't known in advance and depend on what you find.
OrchestratorA 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.

Exercise 5 · Map the capstone onto trigger-knowledge-brain-hands-review-trustProfessional

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
LayerRoleTech
TriggerFire on an alert / Slack command / PRwebhook → handler
KnowledgeKnow this company's runbooks & conventionsRAG
BrainDiagnose & decide → a structured planClaude (structured JSON)
HandsInspect & act (read-only free; writes gated)kubectl, terraform, aws, git
ReviewHuman approves any state changepolicy / approval gate
TrustProve decisions are correct & safeevals

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.

Exercise 6 · Defend the scoping rules to a skeptical execIndustry scenario

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 apply on 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:

  1. 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 apply on prod on day one inverts this and makes a single bad plan catastrophic and irreversible.
  2. 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

✓ Knowledge check

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
An agent wraps the LLM with tools, memory, and a loop so it can actually execute the brain's decisions in the world. It matters because a chatbot can only describe how to fix a broken deployment, whereas the agent gathers evidence, diagnoses, and opens the fix as a PR — real tools (kubectl, terraform, git) do the work the LLM decides on.
✓ Knowledge check

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?

Show answer
Chaining runs a fixed sequence once, in order; the ReAct loop alternates reason -> act -> observe, re-planning based on what it sees each step. The loop wins on messy, real-world tasks whose steps aren't known in advance — it can gather more evidence and adjust, where a fixed chain would just run its predetermined steps regardless of results.
© 2026 studybydoing.in · AI Engineering: Zero to Production · All rights reserved. · About · Privacy Policy · Terms · Contact
Educational content, provided as-is and without warranty. Code samples are examples — review, test, and adapt them before using in production. See the Terms of Use & Disclaimer. Use at your own risk.
© studybydoing.in