Agents & AI

Agents

This is a dead-simple way to understand agents—completely independent of AI:

  • An agent is an entity that exists in an environment.
  • The environment is the part of the universe that the agent interacts with.
  • The agent can observe its environment and can perform actions on the environment.

It's quite abstract but that's really it. Here are two examples:

  • One from the physical world: A hand-held calculator is a type of agent. It observes inputs from button presses (eg. "2 + 2 =") from the environment (which includes the user) and then chooses the action of displaying a result (eg. "4").
  • Another from the digital world: A social media bot can operate on Twitter / X (environment) as an agent. It can observe tweets posted by accounts it follows and for each tweet, it can choose the action of posting a reply.

Under this definition, almost anything can be considered an agent. Even you. Your an agent that's programmed by your brain, which is a biological neural network that computes an action from observations generated by your senses by existing in the physical world.

We say the behavior of an agent is governed by an agent program, which maps any given observation (optionally combined with the history of previous observations) to an action. For example, in the case of the calculator, the agent program maps the sequence of button presses to a result that's displayed on the screen. The agent program is implemented by a series of logical circuits for simple calculators. More sophisticated calculators are programmed by a combination of computer chips and software. There's no limitations on the design and implementation of an agent program. It can be a straightforward table that maps each observation to an exact action, or it can be a set of instructions in plain English, or it can be software written in a programming language, or it can be a large language model that reasons about it's text inputs to generate a response.

Agent

Now agents become more interesting with more sophisticated programs that allow them to create and pursue goals, while operating autonomously, perceiving their environment, adapting change and persisting over a prolonged time period. This is where AI comes into play.

Artificial Intelligence

Agents and AI often go hand-in-hand, but from the examples above, an agent doesn't necessarily have to be intelligent. But leveraging AI helps us build agents that can perform useful tasks and solve difficult problems. This is how the two ideas come together:

AI is focused on the study and construction of agent programs that are "intelligent".

By "intelligent", we mean behaves rationally. An intelligent agent acts so as to achieve the best possible outcome (or when there is uncertainty, the best expected outcome).

Agents are really interesting when they operate autonomously in environments that require adaption and nontrivial decision making to achieve some goal, and they have significant computational resources at their disposal. The key challenge for AI is to find out how to write programs that behave rationally from a smallish program rather than from a vast table.

A Simple Agent

In other posts, we introduce a wide range of agent archetypes. But here we consider the simplest kind of agent, the simple reflex agent. Such agents select actions on the basis of the current observation, ignoring the rest of the history of observations. They rely on the incoming observation to inform them about the current state of their environment, which is used to select from an array of "if-then" rules that ultimately produce an action.

Simple Reflex Agent

For example, let's say we have a chess-playing bot that's programmed as a simple reflex agent. After an opponent's turn in a game of chess, it would observe the current state of the board—i.e. the positions of all the pieces on and off the board—and then look up the best move from a table of moves to choose an action. (A look-up table is one way to implement a set of if-then rules.)