What Is an Agent in AI

By Avni Singh 27-Dec-2022
What Is an Agent in AI

Artificial Intelligence, or AI as it is popularly known, is all-pervasive. It is an integral part of our life. The technology behind AI is intriguing and complex but can be understood when we break them into small parts and study them individually. 

In this blog, we have discussed the intelligent agents in AI. This includes defining what intelligent agents are, their interaction, structure, function, composition, and types. 

What is an Agent in AI?

Much like a real-life agent, agents in AI are highly intelligent, thus the name intelligent agents. An agent is an independent entity/program that communicates with its environment and makes decisions to take actions based on these interactions. The interaction with the environment takes place with the help of its sensors, and the action happens with the help of its actuators. 

Using their actuators, agents go through three phases - perception, thought, and action. Let us take a look at some of the common examples of agents.

  • Software: A software agent uses items, such as keystrokes, contents, and received network packages, as sensors. Based on the inputs received, the results are displayed on actuators, such as screens or files. 

  • Robotic: Robot agents are another common example of agents. They have cameras and infrared range finders that work as sensors. And, of course, their motors act as actuators. 

  • Human: To be fair, an agent can be anything that can perceive its environment through sensors and take action through actuators. Humans can perceive surroundings using their sensory organs. The rest of our body parts act as actuators responsible for taking action based on the input.

How do Agents Interact?

Each intelligent agent has its environment staying in constant contact with it. As mentioned above, there are two ways of interaction - perception and action. Before discussing these, let us understand the meaning of a sensor, actuator, and effector.

  • Sensor: A sensor can be defined as an object that detects environmental changes and relays this information to the device. It is used for observing the surroundings.

  • Actuator: Actuators move and control a system. Essentially, they convert energy into motion. Examples of actuators include gears and electric motors.

  • Effector: Effectors are the parts through which action takes place in the environment. For example, an effector can be wheels, arms, display screens, or legs.  

Now that you understand these terms let us understand how interaction happens.

  • Perception: In this phase, the agent learns and understands its environment. They gather information from the surrounding without making any changes to them. When the sensors receive information, it is known as perception. 

  • Action: As the name suggests, this is when the agent makes a change to its environment. It is a proactive contact and is done through actuators.  

Rules of agents

An agent is an individual entity that acts based on the inputs received from its surroundings. However, there are four rules that an AI agent follows. These rules include the following. 

  • Rule 1: An agent should be able to perceive the environment. 

  • Rule 2: The observations made from the environment must be used for decision-making.

  • Rule 3: The decision taken must result in an action.

  • Rule 4: The action must be rational. 

Rational Agent

Let us understand what rational actions are in the context of agents. Essentially, rational actions help achieve the best possible outcome and maximize performance. A rational agent takes rational actions. To do this, they have clear preferences, and all their actions enhance their performance. 

Multiple factors judge the rationality of an agent. Some of them include the following.

  • Prior knowledge of its environment.

  • Sequence of percepts.

  • Best possible action that an agent can perform.

Structure of Agents

An intelligent agent’s structure is a blend of architecture and an agent program. It can be represented as follows.

Agent = Architecture + Agent program

Let us discuss what these three terms mean.

  • Architecture: This refers to the machinery/platform on which the intelligent agent is executed.

  • Agent Function: This map a precept to an action. The formula is f:P*-- A.

  • Agent Program: Implementing the agent function is called an agent program. It is executed on the physical architecture. This execution is done to produce function f. 

Intelligent agents typically make use of the PEAS model. PEAS stands for Performance Measure, Environment, Actuators, and Sensors. Let’s understand this with an example of a medical diagnosis system. 

  • Performance measure: Minimized costs, healthy patients.

  • Environment: Hospital, staff, patient.

  • Actuators: Screen display including tests, treatments, and questions.

  • Sensors: Keyboard (for entry of symptoms and findings.)

Property of Agents

An intelligent agent in AI has multiple properties. They are discussed as follows.

  • Environment: The intelligent agent is in some kind of environment.

  • Autonomy: The agent doesn’t require direct interference from humans or other software to do its work; it controls its activities and internal environment. The agent's goal is to maximize performance and independently takes steps to ensure this goal is achieved. For an agent to be considered autonomous, its performance should be decided by experiences concerning its learning and adapting capability. 

  • Social Ability: To achieve its goals and get information, the agent must have the ability to interact with other agents and people in a complex manner. This is referred to as social ability.

  • Reactivity: The agent must have the ability to recognize the changes in its environment, decide independently when to act, and respond to those changes on time.

  • Proactiveness: Apart from reacting to changes, the agent must also be able to respond to any anticipated future actions. This means it should be able to identify opportunities and take the initiative independently.

  • Temporal Continuity: The agent runs continuously. 

  • Mobility: The agent can actuate in its environment. 

  • Veracity: An agent will not communicate false information.

  • Benevolence: All actions performed by the agent must be for the benefit of others. It will always do what is asked of it. 

  • Rationality: The agent makes informed decisions. It doesn’t work in a manner that will stop it from accomplishing its goals. 

  • Learning: An agent can learn.

  • Versatility: The agent can have several goals at the same time. It doesn’t necessarily have one goal. 

  • Coordination: The agent comes with the ability to manage various resources. 

Types of Agents

There are five types of agents in artificial intelligence based on their intelligence and capability.

Simple Reflex Agents

The simple reflex agents take action based on current perceptions. They don’t consider the perception history while making decisions; their judgments are based only on present perceptions. Simple reflex agents cannot solve complex problems. 

This agent operates under the condition-action rule enabling the agent to convert the present state into action. For example, a room cleaner can only work when a place is dirty. Therefore, if the condition is true, the agent will take action. 

This agent can function only when the environment can be fully observed. The agent may get stuck in infinite loops if the environment cannot be fully observed.

Some of the disadvantages of Simple Reflex agents include the following. 

  • They have extremely limited intelligence. 

  • They are too big to generate and store.

  • They cannot adjust to changes in their environment. If the environment is changed, the agent must be updated with new rules.

  • They are not aware of non-perceptual parts of the state.

Model-Based Reflex Agents

Model-based reflex agents can function in partially observable environments. The two necessary components of this agent include the model and the internal state. The model means these agents know how things function in the world. The agent's internal state adjusts with each percept, and its depiction of existing conditions happens based on the percept history. 

The model-based reflex agents identify a rule which matches the present condition by using the model of the world to function in a partially observable environment. This type of agent stores the current condition inside itself, helping maintain a rough structure that defines the invisible part of the environment. 

Goal-Based Agents

Goal-based agents make decisions based on their distance from their goal. All the actions taken by these agents reduce the distance between themselves and their goals. Goal-based agents are more adaptable than reflex agents as the knowledge required for their decisions is clear and can be modified easily. 

The agent can choose between multiple options. It chooses the one that helps achieve its goals by searching and planning functions. This means it has a clear target to achieve. It plans and finds the right action to help it reach that target. 

The goal-based agents are smarter and more intelligent than simple reflex agents as they can think beyond what is happening in the present moment and decide the best possible action. One of the limitations of these agents is that they become inflexible once their goal is set.

Utility-Based Agents

Unlike goal-based agents, which look for the best possible way to reach their goals, utility-based agents look for a quick, cost-effective, and secure way of achieving goals. It differentiates itself from other agents through its utility. Let us take an example to understand this.

If you want to travel from Delhi to Rajasthan, a goal-based agent will set the goal as Rajasthan and take you there through the right path. A utility-based agent will instead analyze other possible routes and select the option that achieves the maximum utility. 

Therefore this type of agent is preferred when there are multiple alternatives and the agent has to decide between them to ensure maximum utility. 

Learning Agents

As the name may suggest, learning agents can learn from their experiences. They have learning capabilities and can act and adapt based on what they have learned. 

There are four conceptual parts of a learning agent. They are as follows.

  • Element of Learning: This is responsible for learning from its environments and improving based on the learning.

  • Critic: The critic gives feedback to the learning element regarding the agent’s performance compared to the preset performance benchmark.

  • Element of Performance: This is responsible for selecting an external action.

  • Problem Generator: The problem generator suggests actions/problems that can help the agent experience new things to enable learning. 

Intelligent Agents Applications

If you look around yourself, you will see an intelligent agent at work. Yes, they are a part of our daily lives. Some of their common applications are as follows. 

Medical Diagnosis

Intelligent agents are extensively used in the healthcare sector for medical diagnosis. The patient and the hospitals form the environment of the agent with the keyboard as the sensor. The data received by the agent is used to choose the best course of action.

Monotonous Business Operations

Businesses today have automated many of their mundane tasks, resulting in increased efficiency, reduced costs, and overall productivity.

Autonomous Vehicles

Self-driving vehicles function with the help of different intelligent agents. The agent's sensors are the radar, camera, and other similar things. The roads, other vehicles, and people form its environment, and the action is taken through different effectors, such as brakes

Intelligent agents are a crucial part of our lives. They are the present and the future. With continuous technological advancements, AI will solve more and more problems we face today, due to which the industry is also popular among students. With its bright outlook, more and more people want to be a part of this industry and contribute to making AI more advanced.

Avni Singh

Avni Singh has a PhD in Machine Learning and is an Artificial Intelligence developer, researcher, practitioner, and educator as well as an Open Source Software developer, with over 7 years in the industry.