Skip to content
  • Intelligent Agents & Environments · Artificial Intelligence

Intelligent Agents & Environments

LearnViaNotes @learnvianotes· 4 min read

An agent perceives its environment through sensors and acts on it through actuators. Describing an AI problem starts by pinning down four things — its PEAS — and the properties of its environment, which decide which techniques will work.

Environment → Sensors → percept → Agent program → Actuators → action → Environment

The vacuum world

The textbook toy: two squares, A and B, each clean or dirty. The agent perceives (location, status) and can Suck, move Left or Right. The performance measure awards one point per clean square per time step:

Python
def reflex_vacuum_agent(percept):
    location, status = percept
    if status == "Dirty":
        return "Suck"
    return "Right" if location == "A" else "Left"

def run(agent, world, location="A", steps=6):
    score, actions = 0, []
    for _ in range(steps):
        action = agent((location, world[location]))
        actions.append(action)
        if action == "Suck":
            world[location] = "Clean"
        elif action in ("Left", "Right"):
            location = "B" if action == "Right" else "A"
        score += sum(s == "Clean" for s in world.values())   # performance measure
    return actions, score

actions, score = run(reflex_vacuum_agent, {"A": "Dirty", "B": "Dirty"})
print(actions)    # ['Suck', 'Right', 'Suck', 'Left', 'Right', 'Left']
print(score)      # 10 ← 1 + 1 + 2 + 2 + 2 + 2

PEAS — specifying the task

AgentPerformance measureEnvironmentActuatorsSensors
Self-driving taxiSafe, fast, legal, comfortable trip; profitRoads, traffic, pedestrians, weather, passengersSteering, accelerator, brake, signals, displayCameras, LiDAR, radar, GPS, speedometer, odometer
Medical diagnosis systemHealthy patient, low cost, few testsPatient, hospital, staffDisplay questions, tests, diagnoses, treatmentsKeyboard entry of symptoms, test results
Chess programWin / draw / lossBoard, opponent, clockMoves on the boardBoard state
Spam filterSpam caught, legitimate mail keptMail stream, usersMark as spam / deliverMessage text, headers, sender reputation

Properties of task environments

DimensionEasy endHard endWhat it changes
ObservabilityFully observable — sensors show the whole relevant statePartially observable — noisy sensors, hidden stateHidden state → agent must keep internal state / beliefs
AgentsSingle-agentMulti-agent — competitive or cooperativeOpponents → game theory, adversarial search
DeterminismDeterministic — next state fixed by state + actionStochastic (nondeterministic) — outcomes uncertainUncertainty → probabilities, expected utility
EpisodesEpisodic — each decision independent (classify one image)Sequential — actions affect the future (chess)Sequential → planning ahead
ChangeStatic — world waits while agent thinksDynamic — world changes meanwhileDynamic → time pressure, anytime algorithms
State/timeDiscrete — finite states and actionsContinuous — positions, speedsContinuous → optimisation, control theory
KnowledgeKnown — rules/physics givenUnknown — must learn how the world worksUnknown → exploration, learning
TaskObservableAgentsDeterministicEpisodicStaticDiscrete
Crossword puzzleFullySingleYesSequentialStaticDiscrete
Chess with a clockFullyMultiYesSequentialSemiDiscrete
PokerPartiallyMultiStochasticSequentialStaticDiscrete
Taxi drivingPartiallyMultiStochasticSequentialDynamicContinuous
Image classificationFullySingleYesEpisodicStaticContinuous

What does PEAS stand for?

Is a rational agent always successful?

What's the difference between the agent function and the agent program?

Free for students and teachers

Write notes like this one

Cards for every idea, quizzes and flashcards, read aloud — on the web and your phone.

Something wrong with this note? Open it to report