New Jobs Simplified, AI University
← Back to courses

AI Agents

Planning & Reasoning in Agents

This lesson covers planning and reasoning in artificial intelligence (AI) agents, including goal-based agents, plan monitoring, and replanning. We'll explore how agents make decisions and adapt to changing situations.

Why It Matters

Planning and reasoning are crucial in AI because they enable agents to achieve complex goals in dynamic environments. In the real world, AI agents are used in applications such as robotics, autonomous vehicles, and smart homes, where they need to plan and reason to achieve their objectives.

Key Points

Goal-based agents use a goal information system to choose actions that achieve their objectives. This system combines the agent's current state description with the goal information to select the best course of action.
Plan monitoring is a technique used to detect and correct errors in a plan. It involves checking the preconditions of each action in the plan and stopping execution if a precondition is not met.
Replanning is the process of revising a plan in response to changes in the environment or the agent's goals. It involves re-executing the planning algorithm to generate a new plan.
The PLANEX and SIPE planners are examples of online planners that can replan in response to changes in the environment.
Model-based reflex agents use a model of the environment to make decisions. This model can be used to predict the outcome of different actions and choose the best course of action.
Goal-based action selection can be straightforward or tricky, depending on the complexity of the goal and the agent's environment.

Key Concepts

Goal-based agent

An AI agent that uses a goal information system to choose actions that achieve its objectives.

Plan monitoring

A technique used to detect and correct errors in a plan by checking the preconditions of each action.

Replanning

The process of revising a plan in response to changes in the environment or the agent's goals.

Model-based reflex agent

An AI agent that uses a model of the environment to make decisions.

Code Examples

A simple goal-based agent that chooses actions based on a goal information system.

def goal_based_agent(goal, current_state):
  # Use a goal information system to choose an action
  action = choose_action(goal, current_state)
  return action
From the books
“The first online planner with execution monitoring was PLANEX (Fikes et al., 1972), which worked with the STRIPS planner to control the robot Shakey. SIPE (System for In- teractive Planning and Executi…”
“well as a current state description, the agent needs some sort of goal information that Goal describes situations that are desirable—for example, being at a particular destination. The agent program c…”
“the dynamic programming literature developed in the field of operations research (Puterman, 1994), which we discuss in Chapter 17. Although simple reflex agents were central to behaviorist psychology (s…”

Quick Quiz

1. What is the main purpose of plan monitoring?

To detect and correct errors in a plan
To replan in response to changes in the environment
To choose actions based on a goal information system
To predict the outcome of different actions

2. What is replanning?

The process of revising a plan in response to changes in the environment or the agent's goals
The process of choosing actions based on a goal information system
The process of detecting and correcting errors in a plan
The process of predicting the outcome of different actions

3. What is a model-based reflex agent?

An AI agent that uses a goal information system to choose actions
An AI agent that uses a model of the environment to make decisions
An AI agent that replans in response to changes in the environment
An AI agent that detects and corrects errors in a plan