Entity Extraction Results
Intelligent Agents (AIMA Ch. 2)
Entity Statistics
361
Total Entities15
Entity TypesspaCy NER
MethodEntity Breakdown by Type
ORG
69
CHAPTER
Ourplan
A,Clean],[A
A,Clean],[A,Clean],[...
havedesiresandprefer...
Champs
caterpillar
caterpillar
Totheextentthatanage...
Next
GPSsignals
Refinery Purity
Refinery
Interactive Student’...
Examplesofagenttypes...
+54 more
LAW
24
Chapter 1
Chapter 2 Intelligen...
Chapter 2 Intelligen...
Chapter 16
Chapter 2 Intelligen...
Chapter 2 Intelligen...
Chapter 2 Intelligen...
Chapter 2 Intelligen...
Chapter 2 Intelligen...
Chapter 2 Intelligen...
Chapter 2 Intelligen...
Chapter 16
Chapter 14
Chapter 6
Chapter 7
+9 more
PERSON
60
Wedescribeanumberofb...
Givenanagenttoexperi...
Partialtabulationofa...
Norbert Wiener
andlearnmoreaboutita...
Theperformance
Suck
OKtocrosstheroad
Ourdefinitionrequire...
hashadlittle ornoexp...
Webeginbyshowinghow
Wediscusseachelement...
Roads
Displayofscene High-...
Percentageof Conveyo...
+45 more
CARDINAL
101
2.1
two
2.2
two
One
2.3
2.3
1
2
38
4
2 + 2
2.2
2.2.1
33
+86 more
PRODUCT
9
Agentfunction
Single
Chessand
REFLEX-VACUUM-AGENT(...
Transitionmodel
Afactoredrepresentat...
Structured
Truck
Shreve
NORP
6
wecan
Asecond
Examplesoftaskenviro...
Wecan
Boolean
valuescan
GPE
26
Agentprogram
King Midas
Taskenvironment
Alaska
Britain
Japan
Steering
Thebasicsensorsforth...
agent(orsoftware
withparts;bins
Sequential
Newton
Booleancircuit
Updatingthisinternal...
Chapter18
+11 more
TIME
1
eight-hour
ORDINAL
20
First
First
Second
First
First
First
First
second
second
first
first
First
Second
First
Second
+5 more
DATE
35
one day
1950
Chapters 3–5
1038
theconceptwasofperip...
2004
2004
1986
2007
1998
2006
1985
1986
1971
1984
+20 more
LOC
3
Southern California
Softbot
Earth
FAC
2
Partiallyobservable
Static
PERCENT
1
25%
QUANTITY
1
roughly 70 megabytes
WORK_OF_ART
3
Section2.4 The Struc...
GPSlocation
Truck Ahead Backing ...
Text with Entity Highlights
ORG
(69)
LAW
(24)
PERSON
(60)
CARDINAL
(101)
PRODUCT
(9)
NORP
(6)
GPE
(26)
TIME
(1)
ORDINAL
(20)
DATE
(35)
LOC
(3)
FAC
(2)
PERCENT
(1)
QUANTITY
(1)
WORK_OF_ART
(3)
CHAPTER
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment.
Ourplan
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment.
Wedescribeanumberofbasic“skeleton
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak
Agentfunction
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider.
Givenanagenttoexperimentwith
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,
wecan
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these
two
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an
Agentprogram
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure
2.2
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just
two
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2
One
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure
2.3
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure
2.3
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
CHAPTER
INTELLIGENT AGENTS
Inwhichwediscussthenatureofagents,perfectorotherwise,thediversityofenvironments,
andtheresultingmenagerie ofagenttypes.
Chapter 1 identified the concept of rational agents as central to our approach to artificial
intelligence. Inthischapter,wemakethisnotionmoreconcrete. Wewillseethattheconcept
ofrationality canbeappliedtoawidevarietyofagentsoperating inanyimaginable environment. Ourplan inthisbook istousethis concept todevelop asmallset ofdesign principles
forbuilding successful agents—systems thatcanreasonably becalledintelligent.
Webegin by examining agents, environments, and the coupling between them. The observation that some agents behave better than others leads naturally to the idea of a rational
agent—one that behaves as well as possible. How well an agent can behave depends on the
natureoftheenvironment;someenvironmentsaremoredifficultthanothers. Wegiveacrude
categorization ofenvironments andshowhowproperties ofanenvironment influencethedesignofsuitable agentsforthatenvironment. Wedescribeanumberofbasic“skeleton” agent
designs, whichwefleshoutintherestofthebook.
2.1 Agents and Environments
Environment Anagentisanything thatcanbeviewedasperceiving itsenvironmentthrough sensorsand
Sensor actinguponthatenvironmentthroughactuators. Thissimpleideaisillustratedin Figure2.1.
Actuator A human agent has eyes, ears, and other organs for sensors and hands, legs, vocal tract,
and so on for actuators. A robotic agent might have cameras and infrared range finders for
sensors and various motors for actuators. A software agent receives file contents, network
packets, andhumaninput(keyboard/mouse/touchscreen/voice) assensory inputsandactson
the environment by writing files, sending network packets, and displaying information or
generating sounds. Theenvironment could beeverything—the entire universe! Inpractice it
isjustthatpartoftheuniversewhosestatewecareaboutwhendesigningthisagent—thepart
thataffectswhattheagentperceivesandthatisaffectedbytheagent’s actions.
Percept We use the term percept to refer to the content an agent’s sensors are perceiving. An
Percept sequenc◮e agent’sperceptsequenceisthecompletehistoryofeverything theagenthaseverperceived.
Ingeneral, anagent’s choice ofaction atanygiven instant candepend onitsbuilt-in knowledge and on the entire percept sequence observed to date, but not on anything it hasn’t perceived. By specifying the agent’s choice of action for every possible percept sequence, we
have said more or less everything there is to say about the agent. Mathematically speak Agentfunction ing, wesay that an agent’s behavior is described by the agent function that maps any given
perceptsequence toanaction.
Section2.1 Agentsand Environments 37
Agent
Sensors
Actuators
Environment
Percepts
?
Actions
Figure2.1 Agentsinteractwithenvironmentsthroughsensorsandactuators.
We can imagine tabulating the agent function that describes any given agent; for most
agents, this would be a very large table—infinite, in fact, unless we place a bound on the
lengthofperceptsequenceswewanttoconsider. Givenanagenttoexperimentwith,wecan,
in principle, construct this table by trying out all possible percept sequences and recording
whichactionstheagentdoesinresponse.1 Thetableis,ofcourse,anexternalcharacterization
of the agent. Internally, the agent function for an artificial agent will be implemented by an
agent program. It is important to keep these two ideas distinct. The agent function is an Agentprogram
abstract mathematical description; the agent program is a concrete implementation, running
withinsomephysicalsystem.
To illustrate these ideas, we use a simple example—the vacuum-cleaner world, which
consists of a robotic vacuum-cleaning agent in a world consisting of squares that can be
either dirty or clean. Figure 2.2 shows a configuration with just two squares, A and B. The
vacuum agent perceives which square it is in and whether there is dirt in the square. The
agentstartsinsquare A. Theavailable actionsaretomovetotheright,movetotheleft,suck
up the dirt, or do nothing.2 One very simple agent function is the following: if the current
square is dirty, then suck; otherwise, move to the other square. A partial tabulation of this
agent function is shown in Figure 2.3 and an agent program that implements it appears in
Figure2.8onpage49.
Looking at Figure 2.3, we see that various vacuum-world agents can be defined simply ◭
byfillingintheright-handcolumninvariousways. Theobviousquestion,then,isthis: What
is the right way to fill out the table? In other words, what makes an agent good or bad,
intelligent orstupid? Weanswerthesequestions inthenextsection.
1 Iftheagentusessomerandomizationtochoose itsactions, thenwewouldhavetotryeachsequence many
timestoidentifytheprobabilityofeachaction. Onemightimaginethatactingrandomlyisrathersilly,butwe
showlaterinthischapterthatitcanbeveryintelligent.
2 Inarealrobot,itwouldbeunlikelytohaveanactionslike“moveright”and“moveleft.” Insteadtheactions
wouldbe“sp
All Extracted Entities
| Entity | Type | Position | Confidence |
|---|---|---|---|
| CHAPTER | ORG | 0-7 | 85% |
| Chapter 1 | LAW | 147-156 | 85% |
| Ourplan | ORG | 409-416 | 85% |
| Wedescribeanumberofbasic“skeleton | PERSON | 1030-1063 | 85% |
| 2.1 | CARDINAL | 1115-1118 | 85% |
| Agentfunction | PRODUCT | 2563-2576 | 85% |
| Givenanagenttoexperimentwith | PERSON | 3076-3104 | 85% |
| wecan | NORP | 3105-3110 | 85% |
| two | CARDINAL | 3430-3433 | 85% |
| Agentprogram | GPE | 3475-3487 | 85% |
| 2.2 | CARDINAL | 3807-3810 | 85% |
| two | CARDINAL | 3843-3846 | 85% |
| One | CARDINAL | 4070-4073 | 85% |
| 2.3 | CARDINAL | 4262-4265 | 85% |
| 2.3 | CARDINAL | 4354-4357 | 85% |
| 1 | CARDINAL | 4657-4658 | 85% |
| 2 | CARDINAL | 4895-4896 | 85% |
| 38 | CARDINAL | 5136-5138 | 85% |
| Chapter 2 Intelligent Agents | LAW | 5139-5167 | 85% |
| A,Clean],[A | ORG | 5544-5555 | 85% |
| A,Clean],[A,Clean],[A | ORG | 5607-5628 | 85% |
| Partialtabulationofasimpleagentfunctionforthevacuum-cleanerworldshown | PERSON | 5699-5768 | 85% |
| 4 | CARDINAL | 6247-6248 | 85% |
| 2 + 2 | CARDINAL | 6283-6288 | 85% |
| 2.2 | CARDINAL | 6724-6727 | 85% |
| 2.2.1 | CARDINAL | 6937-6942 | 85% |
| havedesiresandpreferencesoftheirown;theperformancemeasureis | ORG | 7791-7850 | 85% |
| Norbert Wiener | PERSON | 8177-8191 | 85% |
| 33 | CARDINAL | 8296-8298 | 85% |
| eight-hour | TIME | 8529-8539 | 85% |
| one | CARDINAL | 8865-8868 | 85% |
| King Midas | GPE | 10168-10178 | 85% |
| 40 | CARDINAL | 10201-10203 | 85% |
| Chapter 2 Intelligent Agents | LAW | 10204-10232 | 85% |
| 33 | CARDINAL | 10238-10240 | 85% |
| andlearnmoreaboutitastimegoesby;suchagentsaredescribedin Chapters16,18,and22 | PERSON | 10506-10582 | 85% |
| Theperformance | PERSON | 10655-10669 | 85% |
| First | ORDINAL | 11308-11313 | 85% |
| one | CARDINAL | 11497-11500 | 85% |
| 2.2 | CARDINAL | 11644-11647 | 85% |
| Suck | PERSON | 11975-11979 | 85% |
| Champs | ORG | 13057-13063 | 85% |
| one day | DATE | 13073-13080 | 85% |
| OKtocrosstheroad | PERSON | 14428-14444 | 85% |
| First | ORDINAL | 14457-14462 | 85% |
| Second | ORDINAL | 14591-14597 | 85% |
| Chapter 16 | LAW | 14902-14912 | 85% |
| Asecond | NORP | 14914-14921 | 85% |
| Ourdefinitionrequiresarationalagentnotonlytogatherinformationbutalsotolearnas Learning | PERSON | 15063-15149 | 85% |
| caterpillar | ORG | 16169-16180 | 85% |
Showing first 50 of 361 entities
Processing History
Single extraction run