Pranav Srivastava

10 lessons

0/10 done
Lesson 1 of 10·10 min·Beginner

What is an AI Agent?

What you will learn
  • Understand the key difference between a chatbot and an agent
  • Know when agents are the right tool and when they are not
  • Recognise the four parts every agent is built from: model, tools, memory, loop

The simplest definition

An AI agent is a system where a language model (an LLM) runs in a loop — it takes in information, decides what to do next, acts (usually by using a tool), observes the result, and repeats. It keeps going until the task is done. A chatbot answers once; an agent keeps working.

repeatuntil donePlanActObserveCheck
An agent isn't one answer — it's a loop that keeps going until the job is done.
Chatbot vs Agent — the fundamental difference
  CHATBOT
  +------------------------------------------------+
  |  User: "What is the weather?"                  |
  |    |                                           |
  |    v                                           |
  |  LLM: "I don't have real-time weather data."  |
  |  (done -- one round trip)                      |
  +------------------------------------------------+

  AGENT
  +------------------------------------------------+
  |  User: "What is the weather in Amsterdam?"     |
  |    |                                           |
  |    v                                           |
  |  Think: I should call the weather tool         |
  |    |                                           |
  |    v                                           |
  |  Act:   weather_api("Amsterdam")               |
  |    |                                           |
  |    v                                           |
  |  Observe: {"temp": 14, "cond": "cloudy"}      |
  |    |                                           |
  |    v                                           |
  |  Think: I have the data. I can answer now.     |
  |    |                                           |
  |    v                                           |
  |  Answer: "It's 14 deg C and cloudy today."    |
  +------------------------------------------------+
A chatbot does one round trip. An agent loops until the task is complete.

The four components of an agent

Agent = LLM + Tools + Memory + Loop

LLM — the reasoning engine. Decides what to do at each step.

Tools — functions the LLM can request (search, write, query, send). The LLM does not run them — you do. It just asks.

Memory — what the agent knows: the current conversation, past runs, or a knowledge base.

Loop — the cycle of Think → Act → Observe that repeats until the task is done.

Chatbot vs Agent: key differences

ChatbotAgent
InputA messageA goal
OutputA text responseA result (file, action, decision)
StepsOneMany
ToolsNoneMany
AutonomyYou driveIt drives (with guardrails)
ReliabilityHigh, predictableNeeds observability

When to use an agent

Use an agent when:

  • The task has multiple steps that cannot be hardcoded
  • The task needs real tools (search, write, query, send)
  • The task can fail partway and needs to retry or adjust
  • The steps are not known in advance

Do not use an agent when:

  • A single LLM call is enough
  • The steps are fixed — just chain prompts in code instead
  • Low latency is critical (agents do multiple round trips)
  • Errors are unrecoverable (agents can make wrong decisions)
Chapter summary
  • An agent is an LLM + tools + memory + loop
  • A chatbot does one response; an agent loops until the task is done
  • The LLM never runs tools directly — it requests them, and your code runs them
  • Use agents for multi-step, dynamic tasks; use direct LLM calls for simple ones
Check your understanding
  1. What are the four components of an agent?
  2. Name one scenario where you should NOT use an agent.
  3. Who actually runs the tool code — the LLM or your Python code?

Finished this lesson?

Mark it done — your progress is saved automatically.