0
0
Agentic AIml~20 mins

How agents differ from chatbots in Agentic AI - Experiment Walkthrough

Choose your learning style9 modes available
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.