AI - Agents & Environments (Full Explanation)
An AI system is made up of an agent and the environment in which it operates. The agent performs actions within its environment, and this environment may include other agents as well.
What are Agent and Environment?
An agent is anything that can sense its surroundings using sensors and respond by taking actions through effectors.
- For example, a human agent uses eyes, ears, skin, nose, and tongue as sensors, and hands, legs, and mouth as effectors.
- A robot, on the other hand, uses cameras or infrared sensors as its sensors, and motors or actuators for effectors.
- A software agent uses bit strings to represent both its programming and the actions it performs.
Agent Terminology
- Performance Measure of Agent – This defines how well the agent is doing its job.
- Behavior of Agent – It refers to the action the agent takes after receiving a sequence of inputs (percepts).
- Percept – This is the input the agent receives from the environment at one point in time.
- Percept Sequence – This is the complete history of everything the agent has sensed so far.
- Agent Function – This maps the sequence of percepts to a particular action.
Rationality
Being rational means having good judgment, acting with reason, and making sensible decisions. In AI, rationality is about choosing actions based on what has been sensed to achieve the best results.
What is an Ideal Rational Agent?
A perfectly rational agent always selects the action that will give the highest performance outcome based on:
- The percept sequence it has received so far
- Its pre-programmed knowledge about the environment
The rationality of an agent also depends on:
- How success is measured (its performance measure)
- What it has sensed so far
- What it knows beforehand about the environment
- What possible actions it can take
A rational agent always picks the best possible action based on all of this. The task it performs can be defined using PEAS — Performance Measure, Environment, Actuators, and Sensors.
The Structure of Intelligent Agents
Agents are made of two parts:
- Agent = Architecture + Agent Program
Simple Reflex Agents
- They react only to the current percept.
- These are rational only if decisions can be made using only present input.
- They assume the environment is fully observable.
Condition-Action Rule – This rule links a specific condition to a certain action.
Model-Based Reflex Agents
These agents keep an internal state and use a model of the world to decide what to do.
- Model – Describes how the world works.
- Internal State – Stores unobserved parts of the world based on past percepts.
To update their internal state, these agents need to understand:
- How the world changes
- How their own actions affect the world
Goal-Based Agents
These agents act to reach specific goals. Compared to reflex agents, they are more flexible because the logic behind decisions is modeled clearly, allowing changes:
- Goal – A desired situation or outcome
Utility-Based Agents
They choose actions based on how useful or preferable each outcome is.
Utility-based agents are helpful when:
- There are multiple goals and not all can be achieved
- There’s uncertainty about achieving a goal, so the agent must weigh importance vs. likelihood
The Nature of Environments
Some programs exist in a fully artificial setup with keyboard inputs, files, and screen outputs. Others, like softbots (software robots), operate in complex digital spaces, choosing from many actions in real-time.
An example is a softbot that scans customer preferences online and shows them relevant items. This type of environment can be both real and artificial.
One famous artificial environment is the Turing Test, which puts a machine and a human under evaluation. If a tester can’t tell which is human, the machine is considered intelligent.
Turing Test
This test checks if a machine can show intelligent behavior. In this setup:
- A human tester chats with both a person and a machine
- If the tester can’t tell which is which based on text responses, the machine passes the test
- This is a tough challenge because the machine must perform as well as a real person
Properties of Environment
The environment can vary based on different factors:
- Discrete / Continuous – If the environment has a fixed number of defined states (like chess), it’s discrete. If not, it’s continuous (like driving).
- Observable / Partially Observable – If everything can be sensed, it’s observable. If not, it’s only partially observable.
- Static / Dynamic – If the environment doesn’t change while the agent is thinking, it’s static. If it changes, it’s dynamic.
- Single Agent / Multiple Agents – There may be one agent or many, of similar or different types.
- Accessible / Inaccessible – If the agent can sense all relevant info, the environment is accessible.
- Deterministic / Non-deterministic – If the next state can be predicted exactly from current info and actions, it’s deterministic. Otherwise, it’s not.
- Episodic / Non-episodic – In episodic environments, each situation is separate and doesn’t depend on the past. Non-episodic ones require learning from earlier actions.