Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
What is an agent in artificial intelligence?
Structure of an agent in artificial intelligence
Types of Agents in Artificial Intelligence
1. Simple Reflex Agents
2. Model-Based Reflex Agents
3. Goal-Based Agents
4. Utility-Based Agents
5. Learning Agent
PEAS Representation
Example of Agents with their PEAS representation
Frequently Asked Questions
What can improve the performance of an AI agent?
What is more desirable for an AI agent?
How does an AI agent interact with its environment?
Which agent deals with happy and unhappy states?
Last Updated: Mar 27, 2024

Agent in Artificial Intelligence

Create a resume that lands you SDE interviews at MAANG
Anubhav Sinha
SDE-2 @
12 Jun, 2024 @ 01:30 PM


The environment around us is composed of multiple components, each with its own purpose and unique attribute to facilitate its functioning. Humans are the most resourceful component of an active and growing environment as they can observe the living and nonliving parts of the environment and make the best use of each for their benefit.

agent in artificial intelligence

In artificial intelligence, in order to perceive and interpret information using simulations which are identical to the working of a human brain, we require a medium or a “human-like agent” which can derive useful information from the environment and make sensible decisions based on that information. Therefore, the role of an agent comes into play. Now, let us understand further what we imply by the term “agent” in artificial intelligence.

What is an agent in artificial intelligence?

An Artificial Intelligence system is composed of an agent and its environment. The agents act as mediators for information in their environment, and an environment can consist of multiple agents.

  • Human-Agent: The human agent has eyes, ears, and other organs which act as sensors. Similarly, the hands, legs, and other organs act as actuators.
  • Robotic Agent: The robotic agent has cameras and IR range finders which act as sensors. Similarly, various motors of robotic agent act as actuators.
  • Software Agent: It has keystrokes, file contents, etc., which act as sensors and files, and displays on the screen act as actuators.

Before moving forward, we should first know about sensors, effectors, and actuators.

  • Sensors: It is a device that can detect the change in the environment and send the information to other devices in the environment. An agent observes its surroundings with the help of sensors.
  • Actuators: They are the components of the machines in the environment that convert energy into motion. They are responsible for moving and controlling a system and can be in the forms of electric motors, gears, rails, etc.
  • Effectors: These devices affect the environment through actions. An agent can perform any action through effectors and they can be in the form of legs, wheels, arms, display screen, etc.

Now, when we discuss about an agent, there are a few properties of the corresponding environment in which an agent can act and they are as follows:

  • The environment in which there are a limited number of distinct and clearly defined states is a discrete environment, for example, chess, else it is a continuous environment such as driving.
  • An environment that does not undergo changes when an agent is working is a static environment else it is dynamic.
  • The environment can consist of multiple agents that may or may not be of the same kind.
  • The environment is accessible to an agent if the agent’s sensory apparatus can access the complete state of the environment.
  • If the next state of the environment is completely determined by the current state and the actions of the agent, then the environment is deterministic else it is non-deterministic.
  • In an episodic environment, an agent does not need to think ahead of time for its actions as it perceives and acts within the same episode, and subsequent episodes are not dependent upon the actions of the previous episodes.
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

Structure of an agent in artificial intelligence

Artificial intelligence is utilized to design agent programs that can implement the agent function.

The structure of an AI agent is composed of the architecture and an agent program. The architecture is the machinery on which the AI agents perform execution, and the agent function is used to map a percept to an action.

Formula for agent

Types of Agents in Artificial Intelligence

Agents are categorized into five types based on their degree of perceived intelligence and capabilities. Let us discuss each type of agent in detail.

1. Simple Reflex Agents

These are the simplest forms of agents and they make decisions based on the current percepts and ignore the rest of the percept history. They can only be successful in a fully observable environment. They function on the condition-action rule, which means it maps the current state to action, for example, a Room Cleaner agent will only work in a room if there is dirt. 

Problems that simple reflex agents face:

  • They have limited intelligence.
  • They do not have knowledge of non-perceptual parts of the current state.
  • They are mostly too big to generate and store.
  • They are not adaptive to the changes in the environment.
Simple Reflex Agents

2. Model-Based Reflex Agents

Model-based reflex agents are responsible for dealing with partial accessibility. This goal can be achieved by keeping track of the currently visible world and for executing it, these agents find a rule whose condition matches the current situation and then work. They can handle partially observable environments with the help of a model about the world. It keeps an internal state that depends on what it has perceived before and therefore, it holds information on the unobserved aspects of the current state. Updating these agents requires information about how the world evolves and how the agent’s actions affect the world.

Model-Based Reflex Agents

3. Goal-Based Agents

These agents make decisions based on how far they are currently from their set goal. Their action is intended to reduce the distance between the current position and the goal. This allows the agent to choose an action which reaches a goal among multiple possible actions. The knowledge that supports its decisions is represented explicitly and can be modified, which makes these agents more flexible. They require search and planning and their behaviour can be easily changed.

Goal-Based Agents

4. Utility-Based Agents

These agents use their end uses as building blocks and are used when there are multiple possible alternatives to decide the best one. They choose actions based on a preference for each state. A utility agent selects the action that maximizes the expected utility. A state is mapped onto a real number using a utility function, which describes the associated degree of happiness. 

Utility-Based Agents

5. Learning Agent

This agent can learn from its past experiences or it has learning capabilities. In the beginning, it starts to act with basic knowledge and later on it acts and adapts automatically through learning. A learning agent has four conceptual components, which are: Learning element, critic, performance element and problem generator. A learning element makes improvement, a critic takes feedback to describe how the agent is performing, a performance element selects external actions and a problem generator suggests actions that will lead to successful experiences.

PEAS Representation

PEAS representation is used to define the characteristics of an agent in artificial intelligence. Whenever an AI agent is defined, its properties can be grouped under PEAS representation. Each component of PEAS representation has a key aspect of the agent's behaviour. The PEAS is made of below words:

  • Performance measure (P): It is the unit which is used to define how successful the agent is.
  • Environment (E): It is the surrounding of the agent at every instance. 
  • Actuators (A): The actuators deliver the output of the agent's action to the environment.
  • Sensors (S): These are the receiving points of an agent. All the inputs to the agent are taken by the sensors.

Example of Agents with their PEAS representation

The below table shows some examples of agents with their peas components:


Performance Measure




Medical Diagnose Patient's health, cost Patient, doctor, nurse, hospital Test, treatment, diagnosis Symptoms 
Vacuum cleaner Efficiency, cleanliness, battery Room, carpet, floor Wheels, brushes Camera, different sensors
Automated vehicles Safety, time, comfort, distance Roads, traffic, signals, vehicles Break, accelerator, horn, mirror GPS, camera
Tutoring Marks, attendance Classroom, desk, chair, students Displays, corrections Notebook, eyes, ears
Part-picking robot Percentage of parts in right bins Bins Joined arms, hand Camera, sensors

Frequently Asked Questions

What can improve the performance of an AI agent?

The performance of an AI agent can be improved by choosing the right algorithms, providing diverse data, utilizing resources like GPUs, tuning hyperparameters, using regularization techniques, employing ensemble methods, and leveraging pre-trained models.

What is more desirable for an AI agent?

For an AI agent, the most desirable traits include high accuracy and reliability in its predictions or decisions. This is because the predictions are judged based on the precision and the accuracy the agent is bringing. Similarly, efficient execution, adaptability, continuous learning, etc., are also desirable for an AI agent.

How does an AI agent interact with its environment?

An AI agent interacts with its environment through receiving and acting. It receives input from sensors, such as cameras or microphones, processes this input, makes decisions using algorithms and models, and then executes actions through actuators, like motors or displays.

Which agent deals with happy and unhappy states?

An AI agent that deals with happy and unhappy states is called an emotional or affective agent. They are designed to have emotions to certain stimuli. They may exhibit various emotional states based on their interactions with the environment or users.


In this blog, we understood what an agent is in an artificial intelligence system and what the role of an agent is. We also discussed different types of agents along with the structure of an AI agent. 

Recommended Reading -

Refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive Programming, and many more! If you want to test your competency in coding, you may check out the mock test series and participate in the contests hosted on Coding Ninjas Studio! But if you have just started your learning process and are looking for questions asked by tech giants like Amazon, Microsoft, Uber, etc; you must look at the problemsinterview experiences, for placement preparations.

Nevertheless, you may consider our paid courses to give your career an edge over others!

Do upvote our blogs if you find them helpful and engaging!

Happy Learning!!

Previous article
Scope of Artificial Intelligence
Next article
Adversarial Search in Artificial Intelligence
Live masterclass