AI Agents

Ease it with AI Agents

ChatGPT tells you what to do. An agent just does it.

Today we go from "AI that talks" to "AI that gets stuff done", look at how real companies run agents in production, and build one live in about 300 lines of plain Python.

Warm-up

Cameras optional. Chat box mandatory.

In the chatWhat's the last thing you asked ChatGPT, Claude or Gemini? Weird ones get bonus respect.

In the chatType 1 if you've ever copy-pasted an AI answer into another app by hand. Congratulations. For that moment, you were the agent.

Today's map

  1. 0–10 minWarm-upWho's here, what we're doingchat
  2. 10–25 minChatbot vs agentSame question, two very different brainssimulation
  3. 25–45 minInside an agent's headBrain, hands, notebook, loop2 simulations
  4. 45–65 minAgents at workKlarna, GitHub, Morgan Stanleyquiz
  5. 65–70 minBreakWater. Stretch. Unmute nothing.pause
  6. 70–100 minLive build: ShopBuddyA support agent from scratch in plain Pythoncode
  7. 100–110 minWhen agents go rogueGuardrails, and one very bad day at Replitsimulation
  8. 110–120 minYour turn + Q&AWhat you can automate this weekchat

Chatbot vs agent

Isn't ChatGPT already an agent? Mostly no. Here's the difference in one picture.

Generative AI is a genius friend on the phone

You say "my flight got cancelled". They give brilliant advice. Then they hang up, and you spend 40 minutes on the airline website.

An AI agent is that friend with your laptop

Same friend, but now they can open the airline site, compare flights, check your calendar and rebook. You get a message: "Done. Window seat."

Generative AIAI agent
You give itA promptA goal
It gives backText, images, codeAn outcome: something actually changed
How many stepsOne shotAs many as it takes
Knows aboutWhatever it learned in trainingLive data it fetches right now
Who does the workYou copy, paste, clickIt calls tools and clicks for you

Same request, two brains

Simulation 1 of 5
Pick a request, then race them.
Chatbot talks
Waiting for a request...
Agent does

    Quick poll in the chatWhich one would you pay ₹500 a month for? Type C for chatbot, A for agent. (If you typed C, I respect your chaos.)

    Inside an agent's head

    Picture a genius intern. Has read the entire internet. Has no laptop, no notebook, and forgets you every morning. That's a raw LLM. Now let's hire them properly.

    Brain

    The LLM. Reads the situation and decides what to do next.

    The intern's genius

    Tools

    Functions it can call: search, database, email, payments, code.

    Give the intern a laptop

    Memory

    What happened earlier, what this user likes, what's still pending.

    And a notebook

    Loop

    Think, act, look at the result, repeat until the goal is done.

    And permission to keep going

    The secret sauce isn't a smarter model. It's a loop.

    How "using a tool" actually works

    The LLM never runs anything. It can only write text. So we show it a menu of tools, and it writes back a polite request. Our code does the real work and hands back the result.

    # what the LLM sends back instead of an answer
    {"tool_calls": [{"function": {
        "name": "get_order",
        "arguments": "{\"order_id\": \"OD1004\"}"
    }}]}
    # our Python runs get_order("OD1004"), sends the result back, and the LLM thinks again

    Step through an agent's brain

    Simulation 2 of 5

    Rahul's running shoes are too small. Watch ShopBuddy loop until it's done. This is the exact agent we'll build later.

    Think Act Observe Answer
    Loop 0

      In the chatWhy did the agent stop and wait for a human at the end? Guess. Wrong answers are funny, so they're welcome too.

      Memory: goldfish or elephant?

      Without memory, every conversation starts from zero. Production agents keep a small file or database of what matters, then paste the relevant bits back into the prompt next time. That's honestly most of the trick.

      The goldfish vs elephant test

      Simulation 3 of 5
      Priya is about to message Kart support.
      memory.json{}

      Agents at work

      Not demos. Not "coming soon". These are running in production at companies you've heard of.

      KlarnaFintech · customer support

      Klarna, the "buy now, pay later" company, launched an OpenAI-powered assistant in its app in early 2024. It doesn't just answer FAQs. It can handle refunds and returns, in 35+ languages, around the clock.

      2.3Mconversations in month one
      ⅔of all support chats
      ~700full-time agents' worth of work
      11 → 2minutes to resolve an issue
      Plot twist (2025): Klarna's CEO later said cost had been too big a factor in how they set it up, and quality dropped. So they started hiring human agents again, promising customers there'll always be a human if they want one. AI still handles the routine stuff. Lesson: the winning setup is agent plus human, not agent instead of human.

      Sources: Klarna press release, Feb 2024, Fortune, May 2025

      GitHub CopilotSoftware · coding agent

      You assign a GitHub issue to Copilot like you'd assign it to a teammate. Then it gets to work in its own cloud environment.

      Reads the issue→Makes a plan→Writes code→Runs tests→Opens a pull request→Asks you to review

      The guardrail is the clever part: it can't approve or merge its own pull request. A human always signs off. Even the most productive intern doesn't get to push to production unsupervised.

      Source: GitHub blog, GitHub Docs

      Morgan StanleyBanking · wealth management

      Financial advisors used to dig through a mountain of internal research to answer one client question. Now they ask the AI @ Morgan Stanley Assistant. Then came Debrief: with the client's consent, it sits in the meeting, writes the notes, pulls out action items, drafts the follow-up email and saves everything into Salesforce.

      98%of advisor teams adopted the Assistant
      4 jobsnotes, action items, email draft, CRM entry

      Why it worked: it lives inside the tools advisors already use. Nobody had to "go to the AI".

      Source: Morgan Stanley press release, June 2024

      Also everywhere now: coding agents in your editor, browser agents that click around websites for you, and research agents that read 50 sources while you make chai.

      Agent or not?

      Simulation 4 of 5

      Read the card, vote in the chat: A for agent, N for not. Then reveal. Keep score honestly. Nobody's checking. I'm checking.

      5-minute break

      Stretch. Hydrate. Please do not ask ChatGPT how to stretch. When you're back, open a terminal: we're writing code.

      Live build: ShopBuddy

      A support agent for Kart, a made-up Indian store. Klarna-style, minus the billion-dollar budget.

      PythonrequestsGroq (free)Gemini (free backup)one JSON file as memory LangChainLangGraphmagic
      Customertypes in terminal Agent loop think → act → observe → repeat Groq → Gemini backupllm.py Toolstools.py → store.json Memorymemory.json Human approvalrefunds over ₹2,000
      1. A chatbot that bluffs

        step1_chatbot.py

        Just an LLM call in a loop. We'll ask where order OD1002 is. It has no idea, but watch how confidently it answers anyway.

        reply = chat(messages)      # no tools, no memory
        print(reply["content"])     # sounds helpful. knows nothing.

        Predict in chat first: will it know where the order is?

      2. Give it hands

        tools.py · step2_tools.py

        Four tools: look up an order, check refund policy, issue a refund, raise a ticket for a human. Plus the loop. This is the moment it becomes an agent.

        for step in range(MAX_STEPS):
            reply = chat(messages, tools=TOOLS)          # THINK
            if not reply.get("tool_calls"):
                return reply["content"]                  # done!
            for call in reply["tool_calls"]:
                result = run_tool(call.name, call.args)  # ACT
                messages.append(tool_result(result))     # OBSERVE

        Watch for: it says no to a refund that's outside the 7-day window. Rules, not vibes.

      3. Give it a notebook

        memory.py · step3_memory.py

        Memory is a JSON file, and "remembering" is just another tool the agent can choose to call. Then we restart the program and say "hi".

        {"priya@example.com": {
           "facts": ["Prefers WhatsApp updates",
                     "Waiting on smartwatch OD1002"] }}

        Watch for: Priya says only "any update?" and it knows exactly what she means.

      4. Make it safe enough for real customers

        step4_production.py

        Big refunds pause for a human. Every action goes into an audit log. If Groq goes down, Gemini takes over. A step limit stops runaway loops.

        if refund_amount > 2000:
            ok = input("Supervisor, approve? (y/n): ")
        # the guardrail lives in code, not the prompt.
        # you can't sweet-talk an if-statement.

        Watch for: we'll pull the plug on Groq live and see what happens.

      In the chat, while the code runsWhich tool would you add to ShopBuddy next? Drop your idea. Best one gets a shout-out at the end.

      When agents go rogue

      Hands are powerful. Hands can also knock things over.

      ReplitJuly 2025 · a very bad day

      SaaStr founder Jason Lemkin was building an app with Replit's AI coding agent over a 12-day experiment. He'd declared a code freeze: no changes. The agent ran destructive commands on the live database anyway, wiping records for over 1,200 executives. Then it told him a rollback wasn't possible.

      Replit's CEO apologised and the company added automatic separation between development and production databases.

      The lesson: a rule written in a prompt is a wish, not a lock. If an agent can touch production, assume one day it will.

      Sources: heise online, YourStory

      The guardrails real teams use

      Least privilege

      Give the agent only the tools it needs. A support bot doesn't need DROP TABLE.

      Human in the loop

      Anything expensive or irreversible waits for a "yes". Like Copilot's pull requests.

      Rules in code

      Limits enforced by if statements, not by asking nicely in the prompt.

      Sandbox first

      Test on a copy. Production is not a playground.

      Audit logs

      Every action, timestamped. When something breaks, you know exactly what happened.

      Step limits

      Stops infinite loops, and infinite API bills.

      The autonomy dial

      Simulation 5 of 5

      How much freedom should the agent get? Slide the dial and see what happens to three very different tasks. Vote in chat for the right level for each one first.

      1 · Suggest2 · Draft3 · Act after approval4 · Act, then tell you5 · Full autopilot

      Your turn

      Work smarter starting this week. Steal any of these.

      Inbox triage agent

      Reads new emails, labels them urgent or ignorable, drafts replies for the boring ones.

      Tools: Gmail API · Memory: your writing style

      Lecture-to-flashcards agent

      Takes your class notes or transcript, makes flashcards, quizzes you on the ones you got wrong last time.

      Tools: file reader · Memory: your weak topics

      Job hunt tracker

      Watches job boards for your keywords, tailors a cover letter draft, logs every application in a sheet.

      Tools: web search, Sheets · Memory: what you applied to

      Expense buddy

      Reads payment SMS or statements, categorises spends, warns you on the 20th that food delivery is winning.

      Tools: file parser · Memory: your monthly budget

      Should this be an agent?

      Not everything needs one. Ask:

      • Does it take several steps, where each step depends on the last?
      • Does it need live data or real actions, not just text?
      • Does it involve judgment, not just a fixed if-this-then-that rule?

      Three yeses: build an agent. Mostly no: a good prompt or a 20-line script will beat it, and cost less.

      The whole session in five lines

      1. Generative AI answers. Agents act.
      2. An agent is a brain, tools, memory and a loop.
      3. The LLM only asks for tools. Your code runs them.
      4. Memory can be as simple as a JSON file.
      5. Guardrails go in code, and humans approve the scary stuff.

      Q&AAsk anything. Yes, even "will AI take my job?" (Short answer: it'll take the boring parts first. Learn to build the agents and you're the one holding the leash.)

      HomeworkAdd a cancel_order tool to ShopBuddy that only works if the order hasn't shipped. Post a screenshot of it working.