Agents & SearchCore· 30 min read

Intelligent Agents

Most AI can be described as an agent: it senses its environment and chooses actions to reach a goal.

What you will learn

  • Define agent, environment, percept and action
  • Break a real AI into the agent model
  • See goals as what drives behaviour

The agent model

A huge amount of AI fits one simple picture. An agent is anything that senses its environment and acts on it to reach a goal.

PartMeaningVacuum robot example
EnvironmentThe world it works inYour rooms
PerceptsWhat it senses“dirt here”, “wall ahead”
ActionsWhat it can domove, turn, suck
GoalWhat success meansa clean floor

The agent runs a loop forever: sense → think → act → sense again.

Every agent — robot or software — follows this sense–decide–act loop
# The agent loop, in pseudo-Python
while True:
    percept = sense(environment)     # what do I see now?
    action  = decide(percept)        # the "AI" lives here
    do(action)                       # change the world

Note: Output: (There is no output — this is the shape every agent program follows. The intelligence is inside decide().)

Agents do not need a body

A spam filter is an agent too: its environment is your inbox, its percept is a new email, its actions are inbox or spam, and its goal is a clean inbox. Same model, no robot.

Tip: When you meet any AI, ask the four questions: what is its environment, what can it sense, what can it do, and what is its goal? That instantly tells you how it works.

Q. For a self-driving car, “press the brake” is an example of a…

Answer: Braking is something the agent does to the world, so it is an action. Camera input would be a percept; arriving safely is the goal.

✍️ Practice

  1. Map a thermostat onto the agent model (environment, percepts, actions, goal).
  2. Write the sense–decide–act loop in words for a chess AI.

🏠 Homework

  1. Choose any AI product and fill in all four parts of the agent model for it.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →