Agents in AI
This is a free course. Log in to run the code exercises and track your progress.
Agents in AI
An AI agent is software that senses its surroundings, processes what it observes, and acts to reach defined goals. It works with some autonomy so assigned tasks can be completed effectively.
- Collects and analyzes data from its environment to support decision-making
- Selects appropriate actions to accomplish tasks or escalate when needed
Key Features
- Autonomous: Act without constant human input and decide next steps from past data like a bookstore bot flags missing invoices.
- Goal‑driven: Optimize for defined objectives like a logistics AI balancing speed, cost and fuel use.
- Perceptive: Gather info from sensors, inputs or APIs like a cybersecurity agent tracking new threats.
- Adaptable: Adjust strategies when situations change.
- Collaborative: Work with humans or other agents toward shared goals like healthcare agents coordinating with patients and doctor.
Classification
An agent is a system built to sense its environment, decide what to do, and act toward specific goals. Agents run with autonomy, without direct human control, and can be grouped by behavior, environment, and how many agents interact.
- Reactive Agents: Respond to immediate environmental stimuli without foresight or planning.
- Proactive Agents: Anticipate future states and plan actions to achieve long-term goals.
- Single-Agent Systems: One agent solves a problem independently.
- Multi-Agent Systems: Multiple agents interact, coordinate or compete to achieve goals; may be homogeneous (similar roles) or heterogeneous (diverse roles).
- Rational Agents: Choose actions to maximize expected outcomes using both current and historical information.
Types of Agents
1. Simple Reflex Agents
Simple reflex agents respond only to the current perception of the environment using predefined condition–action rules. They do not draw on past experience or forecast future outcomes; they react with straightforward “if–then” logic.
- Operate without memory of past states or stored information
- Do not maintain any internal model of the environment
- Work best in fully observable and predictable environments
For Example, Traffic light control systems that change signals based on fixed timing.
2. Model-Based Reflex Agents
Model-based reflex agents keep an internal model of the environment so they can cope when full information is not available directly. That model helps them decide better by accounting for environmental change and the effects of their own actions.
- Use internal memory to update and maintain environment state
- Infer missing details from partial or incomplete observations
- React based on current input while using stored context for better decisions
For example, Robot vacuum cleaners that map rooms and tracks cleaned areas.
3. Goal-Based Agents
Goal-based agents pick actions by targeting a defined objective and judging how each option helps reach it. Rather than reacting only to the present moment, they plan ahead and weigh possible future outcomes.
- Use search and planning techniques to find suitable action paths
- Judge actions based on how well they move toward the goal
- Consider future consequences before making decisions
- Explore multiple possible routes to reach the desired outcome
For example, Logistics routing agents that find optimal delivery routes based on factors like distance and time. They continually adjust to reach the most efficient route.
4. Utility-Based Agents
Utility-based agents go further than simply reaching a goal. They score how beneficial each action is with a utility function that measures the overall “value” or satisfaction of an outcome. That helps them pick the best option under trade-offs or uncertainty.
- Make decisions in uncertain or probabilistic environments
- Select actions based on expected usefulness or reward
- Optimize choices while working within given constraints
For example, Financial portfolio management agents that evaluate investments based on factors like risk, return and diversification operate by choosing options that provide the most value.
5. Learning Agents
Learning agents improve over time by using feedback from earlier actions. They keep refining internal models so future decisions get better.
- Adapt their behavior based on experience and feedback
- Improve decision-making by updating internal models
- Combine action execution with a learning mechanism
- Create new knowledge instead of relying only on fixed rules
For example, Customer service chatbots can improve response accuracy over time by learning from previous interactions and adapting to user needs.
6. Multi-Agent Systems (MAS)
Multi-agent systems are made up of several autonomous agents that interact in a shared environment. Depending on the situation, they may cooperate, compete, or combine both behaviors.
- Include different interaction types such as cooperative, competitive, and mixed agent behavior
- Operate without a central controller, with decisions distributed across agents
- Remain robust even if some agents fail or stop functioning
Example: A warehouse system where robots navigate using reflexes, plan tasks using goals, prioritize work using utility, and improve routes through learning
7. Hierarchical agents
Hierarchical agents structure decision-making in layers: higher levels handle planning, while lower levels carry out execution. That layout helps manage complex work by separating strategy from day-to-day operations.
- Break tasks into structured levels of control and responsibility
- High-level agents focus on planning and coordination
- Low-level agents handle direct execution of actions
- Reduce complexity by simplifying how information and decisions flow across levels
For example, Drone delivery systems in which fleet management is done at top level and individual navigation at lower level.
Architecture
- Profiling Module: This module helps the agent understand its role and purpose. It gathers information from the environment to form perceptions. For example: A self-driving car uses sensors and cameras to detect obstacles.
- Memory Module: The memory module enables the agent to store and retrieve past experiences. This helps the agent learn from prior actions and improve over time. For example: A chatbot remembers past conversations to give better responses.
- Planning Module: This module is responsible for decision-making. It evaluates situations, weighs alternatives and selects the most effective course of action. For example: A chess-playing AI plans its moves based on future possibilities.
- Action Module: The action module executes the decisions made by the planning module in the real world. It translates decisions into real-world actions. For example: A robot vacuum moves to clean a designated area after detecting dirt.
Working
- Persona: Each agent is assigned a defined role, personality, and communication style, along with instructions and available tools. This ensures consistent behavior while adapting over time through experience and interaction.
- Memory: Agents typically have multiple types of memory:
- Short‑term memory for the current interaction
- Long‑term memory for storing historical data and conversations
- Episodic memory for recalling specific past events
- Consensus memory for sharing knowledge among multiple agents
Memory enables an agent to keep context, learn from experience and adapt its behaviour over time.
- Tools: These are external functions or resources an agent uses to access information, process data, control systems, or connect with other services. Agents learn when and how to use them based on context and capability.
- Model: Agents use a large language model (LLM) which serves as the agent’s “brain”. The LLM interprets instructions, reasons about solutions, generates language and orchestrates other components including memory retrieval and tools to use to carry out tasks.
Use Cases
- Robotics: Used to control robots for automation in manufacturing, logistics, and transportation
- Smart homes: Manage lighting, heating, and energy use to improve comfort and efficiency
- Healthcare: Support patient monitoring, treatment planning, and resource optimization
- Finance: Enable automated trading, fraud detection, and risk analysis
- Games: Create intelligent opponents for more realistic and challenging gameplay
Benefits
- Fast and efficient operations.
- Adapt and learn from experience.
- Scalable for large or complex problems.
- Operate autonomously with minimal human input.
- Consistent, reliable task performance.
Limitations
- Struggle with complex or unpredictable environments.
- High computational needs for learning and planning.
- Communication issues in multi-agent setups.
- Risk of bias or unintended actions.
- Challenges in designing clear goals and utility functions.