Lab 9: AI Agents — From Chatbots to Autonomous Systems

Objective

Understand how AI agents work and how they differ from simple chatbots. By the end you will be able to:

  • Define what makes a system an "agent" vs a chatbot

  • Explain the ReAct (Reason + Act) loop

  • Describe the major agent frameworks and architectures

  • Understand multi-agent systems and their real-world applications


Chatbot vs Agent: The Key Difference

A chatbot responds to one message at a time. An agent pursues a goal over multiple steps, using tools, making decisions, and adapting to results.

CHATBOT:
  User: "What's the weather in London?"
  Bot:  "I don't have real-time data."  ← end of interaction

AGENT:
  User: "What's the weather in London?"
  Agent thinks: "I need real-time weather data"
  Agent acts:   [calls weather API]
  Agent sees:   {"temp": 12°C, "condition": "rainy"}
  Agent replies: "It's 12°C and raining in London. You may want an umbrella."
  ← goal achieved through tool use

The Agent Loop: Observe → Think → Act → Observe


ReAct: Reason + Act

The foundational agent pattern (Yao et al., 2022). The LLM interleaves Thought, Action, and Observation steps:


Tools: What Agents Can Do

Tools extend the LLM beyond text — into the real world:

Common agent tools:

Category
Tools

Information

Web search, Wikipedia, calculator, calendar

Code

Python REPL, bash shell, SQL executor

Files

Read/write files, create documents, parse PDFs

APIs

Weather, maps, email, calendar, Slack, GitHub

Browsers

Selenium/Playwright for web automation

Databases

Query and update databases

Communication

Send email, SMS, Discord messages


Memory Systems

Agents need memory to maintain context across sessions:


Major Agent Frameworks

LangChain

The most widely used framework. Provides chains, agents, tools, memory, and RAG out of the box.

LangGraph

Graph-based agent orchestration — define agents as nodes, transitions as edges. Better for complex multi-step workflows.

AutoGen (Microsoft)

Multi-agent conversations — multiple specialised agents collaborate:


Multi-Agent Systems

Complex tasks benefit from specialisation:

Real-world multi-agent deployments:

  • Devin (Cognition AI) — autonomous software engineer; writes, tests, debugs, deploys code

  • OpenAI Operator — controls a web browser to complete real-world tasks

  • GitHub Copilot Workspace — multi-agent code review and refactoring

  • OpenClaw — personal AI assistant with memory, scheduling, messaging, browsing tools


Agent Safety Considerations

Autonomous agents introduce new risks:

Risk
Example
Mitigation

Prompt injection

Malicious webpage tricks agent to exfiltrate data

Separate privileged context from web content

Irreversible actions

Agent deletes files, sends emails, charges cards

Human-in-the-loop for destructive actions

Scope creep

Agent installs software "to be more helpful"

Explicit capability allowlisting

Infinite loops

Agent keeps retrying failed actions

Max step limits, circuit breakers

Hallucinated tool calls

Agent calls a tool with fabricated parameters

Input validation before tool execution


The Future: Agentic AI

The shift from chatbots to agents is the major transition happening in AI right now (2024–2026):

  • Claude 3.5 Sonnet computer use — controls a real computer via screenshots

  • OpenAI Operator — books restaurants, fills forms, manages subscriptions

  • Google Project Mariner — browser agent integrated into Chrome

  • Apple Intelligence — on-device agent with app integration

The endgame: AI systems that can take on tasks measured in hours and days, not seconds — with minimal human supervision.


Further Reading

Last updated