Lecture 16 - Agents

Published

November 5, 2026

For the last few weeks, we have been various forms of simulation as tools to produce complex behavior. Today, we are going to up-level a little bit and create autonomous agents.

What is an autonomous agent?

There are a lot of ways that we could define autonomous agent. We are going to focus on a couple of features: - agents are situated in their environment and able to sense it and affect changes on it - agents have some form of decision making process to determine their actions independent of outside forces (they are intentional) - agents have some notion of goal or desire that shapes their choices

Autonomous agents fall along a spectrum from cognitive agents that are deliberative and maintain internal representations of their environment to reactive or behavioral agents, which have minimal internal representation and act on reflex

Why do we care?

There are some interesting philosophical questions about what it means to independently make decisions when their behavior is pre-programmed. What is an “outside force”? It kind of depends on where we draw the box.

Another facet of working with autonomous agents is that they can produce surprising emergent behavior that isn’t anticipated by the programmer as the collection of goals and actions combine in curious new ways.

As algorithmic artists, we might focus on - the emergent patterns the agents make that we didn’t explicitly program (much like our experience with CAs and reaction diffusion) - we might want to be simulating animalistic behavior for games or experiences - we might want to be thinking about pieces that explore concepts like free will and life

Designing Autonomous agents

We are going to focus primarily on agents on the behavioral or reactive end of the spectrum.

A common approach is something called a subsumption architecture. instead of trying to design all of the behaviors of an agent at once, we break the behavior down into collections of simple sub-behaviors.

Imagine we have built a robot that is supposed to wander around its world, collecting “food” it is a delicate machine, and we don’t want it to smash into walls

One approach to this problem would be to scan the room (or have a pre-loaded map), and have the robot compute a path that travels the room without hitting everything (of course this is the model of our cognitive agent) The problem is that this is both computationally expensive and fragile – any small change in the configuration of the environment wreaks everything

A subsumption architecture breaks the overall goal into a collection of sub goals - We can think of these as being like subconscious desires - A high level goal could be “wander in a new direction” - A mid-level goal would be “if I see food, eat it” - A low-level goal could be “don’t run into anything”

Our architecture runs all of these goals in parallel so they all see sensory input and make recommendations on behavior. They are also layered so low level goals have priority. With these rules, we have a Roomba…

designing goals

There is a great paper about “Steering Behaviors for Autonomous Characters” written by Craig Reynolds – another computer graphics and animation pioneer who incidentally worked on Tron, among other things

Reynolds proposed a three phase process to satisfying goals - select an action - steer to accomplish the action - locomotion to get there

He also provided a collection of simple actions - seeking and fleeing - following a path - wandering - interacting with groups (separation, cohesion, and alignment)

Reynold’s suggests thinking in terms of a steering force, which is the force required to change where the agent was originally headed to where the agent now wants to go

steering force = desired_velocity - current_velocity

Technically, the desired velocity is

desire_velocity = target_location - current_location

Of course, that is a teleporter. So we will give our agents max possible velocity making the desired velocity a vector in the direction the agent wants to go at the agent’s top speed.

We can also put a cap on the maximum possible force, which will provide a range of reactivity from lumbering semi trying to take a turn to the crisp turns of a professional driver in an F1 car.

Swarms

We are going to look at one particular kind of agent that Reynold’s developed that he called “boids”. These agents are designed to react in the presence of other agents like they were birds or fish, resulting in behavior we can call “flocking”.

To get flocking behavior, we have a couple of behaviors

  • unaligned collision avoidance
    • predict where other agents are going and avoid points of contact
  • seperation
    • find the other agents in the neighborhood
    • compute a repulsive force
      • find a vector between the agents
      • normalize it
      • scale by 1/distance (Reynolds notes this “just seems to work”)
  • cohesion
    • try to stay in the group
    • find the average position of the agents in the neighborhood and try to go there
  • alignment
    • try to line up with the neighbors
    • average together the velocities of the neighbors and try to achieve the average

This is a basic starting place and we could add other refinements on top of this.