Introduction – Agents of AI

Have you ever used Google Maps, Alexa, or seen a self-driving car video?
Guess what — they all have one thing in common.
They are agents — smart systems that can sense, think, and act just like us!

We humans are also agents.
We see the world (eyes = sensors), think using our brain, and act using our hands and legs (actuators).
AI agents work the same way — they sense, decide, and act!

Figure 1: Agent 

Figure 2.1: Working of an Intelligent Agent

Figure 2.1 shows Working of an Intelligent Agent

Let’s start with one of the most classic and easy-to-understand examples in AI — The Vacuum Cleaner Agent.

This example helps us understand how an intelligent agent thinks and acts in its environment.

Figure 2 shows  Vacuum Cleaner Agent in a Two-Room Environment

Figure 2 : Vacuum Cleaner Agent in a Two-Room Environment

🌍 The Environment

Imagine two rooms — Room A and Room B.
Each room can be either:
🧼 Clean or 🪣 Dirty

The agent (our vacuum cleaner robot) can:

  • Move between the two rooms
  • Clean when needed

⚙️ The Agent System

The Vacuum Cleaner Agent consists of four main components:

  1. 🏠 Environment: Two locations — A and B.
  2. 👀 Sensors: Detect if the current room is clean or dirty.
  3. 🧠 Agent (Decision Maker): Decides what to do next.
  4. 🦾 Effectors (Actions): Perform tasks like Suck (clean) or Move (Left/Right).
  5. 🧩 How It Works
  6. The agent follows very simple rules 👇
SituationAction
In A and DirtySuck
In A and CleanMove Right
In B and DirtySuck
In B and CleanMove Left

So basically:
➡️ If dirty → Clean it (Suck)
➡️ If clean → Move to the other room

Agent Function: 

An Agent Function defines how an agent decides what to do based on what it has seen so far.

It decides what action to take based on its current perception. 

If the current square is dirty → perform Suck 

If the current square is clean → move to the other square

📊 Example Percept Sequence

Percept SequenceAction
[A, Clean]Move Right
[A, Dirty]Suck
[B, Clean]Move Left
[B, Dirty]Suck
[A, Clean], [A, Clean]Move Right
[A, Clean], [A, Dirty]Suck

Table no.1 : Agent function

This table no.1 shows the agent function — a mapping from percepts to actions.

But in real life, this table would be infinite, because the agent could experience endless combinations of situations.
That’s why, instead of writing a huge table, we implement it in code — and that’s called the Agent Program.

Agent Program:

The Agent Program is the actual code or algorithm that tells an agent how to behave.

If the Agent Function is the idea

“If room is dirty → clean it, else move to next room”

then the Agent Program is the implementation of that idea in code
for example, a Python program that actually performs those steps.

(Python logic example)

if status == “Dirty”:

    action = “Suck”

elif location == “A”:

    action = “Right”

elif location == “B”:

    action = “Left”

Summary table of Agent Function vs. Agent Program 

Table no. 2 shows Agent Function vs. Agent Program.

ConceptMeaningExample
Agent FunctionThe mathematical idea — it tells what the agent should do for every possible percept sequence.“If dirty → clean; if clean → move”
Agent ProgramThe actual implementation (code or algorithm) that runs inside a machine.The software inside the robot that follows those rules

Table no2.: Summary table of Agent Function vs. Agent Program