liveBook · Manning

AI agent

As explained in Grokking AI Algorithms, Second Edition

An AI agent is a computational system that perceives context, makes decisions, and takes actions to pursue objectives.

An AI agent is a system that observes an environment, chooses actions, and pursues a goal. In reinforcement learning, it improves by receiving rewards or penalties for what it does. section 10.1 section 10.5

The idea is most useful when the goal and possible actions are known, but the best sequence of actions is not. Individual choices may matter less than their cumulative effect. section 10.3 section 8.5

An agent typically works through these elements:

  • Environment: the changing setting in which the agent operates. section 10.5
  • State: the current situation available to the agent. section 10.5
  • Actions: the permitted choices the agent can make. section 10.5
  • Rewards and penalties: feedback that encourages useful behavior and discourages harmful behavior. section 10.1 section 10.5

Parking-lot navigation

A self-driving car acts as the agent. It can move north, south, east, or west through a parking lot. Empty spaces earn a small positive outcome, reaching its owner earns more, collisions with cars are bad, and collisions with pedestrians are worse. By practicing in a simulator, the agent learns routes that maximize long-term reward rather than merely choosing the best-looking next move. section 10.3 section 10.5

Figure 10.5 The self-driving car in the Parking-Lot Problem
10_05

Use the parking-lot diagram to trace the agent, its goal, surrounding obstacles, and the consequences of alternative actions. section 10.3

A simple implementation separates the simulator from the learning algorithm. The simulator resets the environment, reports its state, applies an action, checks boundaries, and calculates the resulting reward. Poorly designed rewards can produce unintended behavior, such as moving repeatedly through empty spaces just to collect points. section 10.5 section 10.5

From games to general behavior

In strategy games, an agent can play repeatedly against different opponents, receive rewards for progress toward winning, and gradually learn tactics that support long-term success. Similar ideas support strategic planning, industrial-process automation, and robotics. section 10.16 section 10.3

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Defines agents, states, actions, environments, and rewards, then works through a simulator without developing learning algorithms in detail.
Examples
Uses a dog-learning analogy, a self-driving car in a parking lot, and reinforcement-learning game players.
What it assumes
Assumes basic machine-learning categories while introducing reinforcement learning and agent-environment interaction through familiar examples.
What you can do after
Evaluate agent problems by identifying goals, states, actions, environments, rewards, and long-term consequences.
How it connects
Connects agents to reinforcement learning, machine learning, supervised learning, unsupervised learning, deep learning, robotics, and strategic planning.

Also explained in

Compare how 33 books explain AI agent →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Algorithms, Second Edition. The section links point to the parts of the book it draws on.