Bird
Raised Fist0
Agentic AIml~20 mins

How agents differ from chatbots in Agentic AI - Experiment Walkthrough

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Experiment - How agents differ from chatbots
Problem:You want to understand the difference between simple chatbots and intelligent agents by building and comparing two models: a basic chatbot that answers fixed questions and an agent that can perform tasks based on context.
Current Metrics:Chatbot answers 90% of fixed questions correctly but cannot handle new tasks. Agent model is not built yet.
Issue:The chatbot is limited to scripted responses and cannot adapt or perform actions, unlike an agent which can reason and act.
Your Task
Build a simple chatbot and an agent model, then compare their abilities to handle fixed questions and perform context-based tasks. Show that the agent can do more than the chatbot.
Use simple rule-based methods for the chatbot.
Use a basic agent architecture with state and action selection.
Do not use large pretrained models or external APIs.
Hint 1
Hint 2
Hint 3
Solution
Agentic AI
class SimpleChatbot:
    def __init__(self):
        self.responses = {
            'hello': 'Hi there!',
            'how are you?': 'I am fine, thank you.',
            'what is your name?': 'I am a simple chatbot.'
        }
    def get_response(self, message):
        return self.responses.get(message.lower(), "I don't understand.")

class SimpleAgent:
    def __init__(self):
        self.state = 'idle'
    def perceive(self, message):
        msg = message.lower()
        if 'hello' in msg:
            self.state = 'greeting'
        elif 'time' in msg:
            self.state = 'tell_time'
        else:
            self.state = 'unknown'
    def act(self):
        match self.state:
            case 'greeting':
                return 'Hello! How can I help you today?'
            case 'tell_time':
                from datetime import datetime
                return f"The current time is {datetime.now().strftime('%H:%M:%S')}"
            case _:
                return 'Sorry, I cannot do that yet.'

# Testing both
chatbot = SimpleChatbot()
agent = SimpleAgent()

# Fixed questions
questions = ['hello', 'how are you?', 'what is your name?', 'tell me the time']

chatbot_results = {q: chatbot.get_response(q) for q in questions}
agent_results = {}
for q in questions:
    agent.perceive(q)
    agent_results[q] = agent.act()

print('Chatbot responses:', chatbot_results)
print('Agent responses:', agent_results)
Created a SimpleChatbot class with fixed question-answer pairs.
Created a SimpleAgent class that changes state based on input and acts accordingly.
Added time-telling capability to the agent to show task performance beyond fixed responses.
Tested both on the same questions to compare flexibility.
Results Interpretation

Chatbot: Answers fixed questions well but replies 'I don't understand.' to new tasks.

Agent: Answers fixed questions and performs new tasks like telling the current time.

Chatbots follow fixed scripts and cannot adapt, while agents maintain state and can perform actions based on context, making them more flexible and intelligent.
Bonus Experiment
Extend the agent to remember user preferences and personalize responses.
💡 Hint
Add a memory dictionary to store user info and update it based on conversations.

Practice

(1/5)
1. What is the main difference between an agent and a chatbot?
easy
A. Agents only chat, chatbots can act on tasks.
B. Chatbots can perform tasks, but agents only respond with text.
C. Agents can plan and perform multiple tasks, while chatbots mainly focus on chatting.
D. There is no difference; both are the same.

Solution

  1. Step 1: Understand agent capabilities

    Agents are designed to plan and perform various tasks beyond just chatting.
  2. Step 2: Understand chatbot capabilities

    Chatbots mainly focus on conversation and do not perform complex actions.
  3. Final Answer:

    Agents can plan and perform multiple tasks, while chatbots mainly focus on chatting. -> Option C
  4. Quick Check:

    Main difference = Agents act, chatbots chat [OK]
Hint: Agents do tasks; chatbots just chat [OK]
Common Mistakes:
  • Thinking chatbots can perform complex tasks
  • Believing agents only chat
  • Assuming no difference between them
2. Which of the following is a correct statement about agents in AI?
easy
A. Agents can plan steps and execute tasks automatically.
B. Agents only respond to user messages without performing actions.
C. Agents cannot remember past interactions.
D. Agents are limited to simple keyword matching.

Solution

  1. Step 1: Review agent abilities

    Agents are designed to plan and carry out tasks automatically.
  2. Step 2: Eliminate incorrect options

    Options B, C, and D describe chatbots or limited systems, not agents.
  3. Final Answer:

    Agents can plan steps and execute tasks automatically. -> Option A
  4. Quick Check:

    Agents plan and act = A [OK]
Hint: Agents plan and act automatically [OK]
Common Mistakes:
  • Confusing agents with simple chatbots
  • Thinking agents only reply without action
  • Assuming agents lack memory
3. Consider this code snippet for an AI system:
class SimpleChatbot:
    def respond(self, message):
        return "Hello! How can I help?"

class Agent:
    def plan(self, goal):
        return ["Step 1", "Step 2", "Step 3"]
    def execute(self, steps):
        return "Tasks done"

bot = SimpleChatbot()
agent = Agent()
print(bot.respond("Hi"))
print(agent.plan("Clean room"))
print(agent.execute(agent.plan("Clean room")))
What is the output of this code?
medium
A. "Hello! How can I help?" ["Step 1", "Step 2", "Step 3"] "Tasks done"
B. "Hi" "Clean room" "Done"
C. Error because Agent has no respond method
D. "Hello! How can I help?" "Clean room" "Step 1, Step 2, Step 3"

Solution

  1. Step 1: Analyze SimpleChatbot respond method

    Calling respond("Hi") returns the fixed string "Hello! How can I help?".
  2. Step 2: Analyze Agent plan and execute methods

    plan("Clean room") returns the list ["Step 1", "Step 2", "Step 3"]. execute(...) returns "Tasks done".
  3. Final Answer:

    "Hello! How can I help?" ["Step 1", "Step 2", "Step 3"] "Tasks done" -> Option A
  4. Quick Check:

    Chatbot replies, agent plans and executes [OK]
Hint: Chatbot replies fixed text; agent returns plan and done [OK]
Common Mistakes:
  • Assuming agent has respond method
  • Confusing plan output with execute output
  • Expecting error due to missing respond in Agent
4. The following code tries to use an agent to chat but fails:
class Agent:
    def plan(self, goal):
        return ["Step 1", "Step 2"]

agent = Agent()
print(agent.respond("Hello"))
What is the error and how to fix it?
medium
A. No error; code runs fine.
B. SyntaxError due to missing colon; add colon after plan method.
C. TypeError because respond needs two arguments; add self parameter.
D. AttributeError because Agent has no respond method; add respond method to Agent.

Solution

  1. Step 1: Identify error from code

    Calling agent.respond("Hello") causes AttributeError because Agent class lacks respond method.
  2. Step 2: Fix by adding respond method

    To fix, define a respond method inside Agent class that handles chat messages.
  3. Final Answer:

    AttributeError because Agent has no respond method; add respond method to Agent. -> Option D
  4. Quick Check:

    Missing method causes AttributeError [OK]
Hint: Check if method exists before calling [OK]
Common Mistakes:
  • Thinking it's a syntax error
  • Confusing method parameters
  • Assuming code runs without respond method
5. You want to build an AI system that can chat with users and also book appointments automatically. Which approach best fits this need?
hard
A. Use a chatbot only, since it can handle all tasks.
B. Use an agent that can plan booking steps and chat with users.
C. Use a simple rule-based system without AI.
D. Use a chatbot combined with manual human booking.

Solution

  1. Step 1: Understand task requirements

    The system must chat and perform automatic booking, which requires planning and action.
  2. Step 2: Match capabilities to approach

    Agents can plan and execute tasks like booking, while chatbots mainly chat.
  3. Final Answer:

    Use an agent that can plan booking steps and chat with users. -> Option B
  4. Quick Check:

    Complex tasks need agents, not just chatbots [OK]
Hint: Complex tasks need agents, simple chat needs chatbots [OK]
Common Mistakes:
  • Choosing chatbot only for complex tasks
  • Ignoring automation needs
  • Relying on manual steps unnecessarily