Guide to AI and Data Courses · Lecture Notes

Chapter 14: Multi-Agent Systems

Two drivers meet on a narrow road. Both want to get through and neither knows what the other will do; if both go they collide, and if both wait they lose time. Each driver's best move depends on the other's move. Multi-agent systems is the course about situations like this: what happens when several autonomous decision makers share one environment, how they can reach agreement, and how simple rules produce a collective order. These notes introduce the course and work through its three core ideas with small examples you can compute by hand.

Learning outcomes

Agents and environment
Describe a system as autonomous agents, their goals and their interactions; tell a single-agent problem from a multi-agent one.
Nash equilibrium
Find the Nash equilibrium of a two-player payoff matrix by marking best responses, and interpret the prisoner's dilemma.
Auctions and task allocation
Run a Contract Net allocation by hand; show why bidding one's true value is best in a second-price auction.
Emergent behavior
Follow a simple agent-based simulation step by step and explain how small preferences can produce a large collective outcome.
Place of the course
State what separates multi-agent systems from artificial intelligence, reinforcement learning, robotics and evolutionary computation.

14.1What question does the course ask?

How do several autonomous agents decide together or against each other?

Multi-agent systems study how several autonomous agents, each deciding with its own goals and knowledge, cooperate or compete in a shared environment. One agent's best decision is not enough: what the other agents will do must be taken into account, and joint behavior is steered by communication and rules.

In a single-agent problem the world is taken as fixed from the decision maker's point of view: the agent picks an action and the environment responds. In a multi-agent problem part of the environment is other decision makers with goals of their own. The value of one agent's action therefore cannot be defined alone; it depends on what the others choose. In an aisle where a hundred warehouse robots work, every robot is part of every other robot's environment.

The course draws three questions from this. When the agents' interests conflict, what is a reasonable outcome? (game theory, Nash equilibrium.) How is work divided without a central manager? (communication protocols, task allocation, auctions.) When every agent follows only a local rule, what does the collective behavior look like? (agent-based simulation, emergent behavior.) The three core sections below take these questions in turn.

14.1.1What does autonomy mean?

Three properties are asked of a piece of software before it is called an agent: it perceives its environment and reacts to it, it can start goal-directed action on its own, and it can interact with other agents. Two threads on one computer are not agents in this sense: both serve one goal of one programmer. Agents may have conflicting goals, and none of them may look into the internal state of the others; they learn what the others know through messages.

14.1.2At a glance

CriterionMulti-Agent Systems
Approachinteracting autonomous agents
Inputagents, goals, protocols
Outputjoint behavior, equilibrium
Success measuresocial welfare, stability
Math loadmedium: game theory
Data needslittle; simulation

14.2A short history

YearMilestone
1950Nash defines the equilibrium in which each player best-responds to the others.
1980Smith publishes the Contract Net protocol, which allocates tasks among agents by bidding.
1987Reynolds introduces boids, a simulation that produces flocking from three simple rules.
1991Rao and Georgeff formally define the belief-desire-intention (BDI) agent architecture.
1994Littman proposes Markov games as the framework for multi-agent reinforcement learning.
1997The first RoboCup robot soccer tournament is held in Nagoya.

14.3Core concepts

The rest of the course is built on the concepts below. The following sections work through the most important ones with examples.

ConceptMeaning
Autonomous agentDecides for its own goal without outside control.
BDI architectureAgent model that reasons with beliefs, desires and intentions.
Communication languageMessages such as propose, request, inform: FIPA ACL.
CoordinationMaking agents' actions fit together without conflict.
NegotiationAgents with different interests reaching agreement: bargaining.
Auctions and task allocationDividing work with Contract Net and auctions.
Nash equilibriumNo agent wants to change its strategy unilaterally.
Emergent behaviorGlobal order arising from simple local rules.

14.4Game theory and Nash equilibrium

When an agent's reward also depends on the others' choices, the situation is written as a game. For two agents, the actions each can choose (strategies) and the rewards of every pair of actions are collected in a payoff matrix. An agent's best response is the strategy that maximizes its own reward when the other's choice is held fixed.

Definition 14.1 (Nash equilibrium)

A combination of strategies is a Nash equilibrium if each agent's strategy is a best response to the others' strategies. Put differently, no agent can gain by changing its strategy alone while the others stay put.

Example 14.1: The prisoner's dilemma

Two agents either cooperate (C) or defect (D). Each cell holds the pair (reward of agent 1, reward of agent 2); larger is better (the values are illustrative).

Agent 2 CAgent 2 D
Agent 1 C(3, 3)(0, 5)
Agent 1 D(5, 0)(1, 1)
  1. Agent 1's best response. If agent 2 plays C, agent 1 gets 3 with C and 5 with D: D is better. If agent 2 plays D, agent 1 gets 0 with C and 1 with D: D is better again. Whatever the other does, D dominates.
  2. Agent 2's best response. The table is symmetric, so the same holds: D is better in every case.
  3. Equilibrium. The only Nash equilibrium is (D, D) with rewards (1, 1). An agent that switches back to C alone gets 0 instead of 1.
  4. Reading. The reward (3, 3) of (C, C) is better for both agents but is not an equilibrium: there each agent can switch to D alone and get 5 instead of 3.

Individually rational choices lead to an outcome that is bad for everyone.

The prisoner's dilemma shows why multi-agent systems need rule design: if the reward structure left to the agents does not produce a good collective outcome, the way to improve the outcome is to change the rewards (penalties, repeated interaction, agreements).

14.4.1Mixed strategies

Not every game has a pure equilibrium, and some have several. Then agents can choose their actions at random. Think of the two drivers on the narrow road: each chooses G (go) or W (wait). The payoffs (driver 1, driver 2) are (−10, −10) for (G, G), a collision; (2, 0) for (G, W); (0, 2) for (W, G); and (−1, −1) for (W, W), lost time. (G, W) and (W, G) are two pure equilibria, but two symmetric drivers cannot tell which one to pick. If driver 2 goes with probability q, driver 1 expects −10q + 2(1 − q) = 2 − 12q from G and 0·q − 1·(1 − q) = −1 + q from W. At the value that leaves driver 1 indifferent the two are equal: 2 − 12q = −1 + q, so q = 3/13 ≈ 0.23. By symmetry, if both drivers go with probability 3/13 this is a mixed equilibrium. The expected payoff is −1 + 3/13 = −10/13 ≈ −0.77, and the probability of a collision is (3/13)2 = 9/169 ≈ 0.05.

Common mistake

Thinking that a Nash equilibrium is the best outcome for society. An equilibrium only says that "nobody wants to deviate alone." In the prisoner's dilemma the equilibrium is (1, 1) while the best joint outcome is (3, 3); the equilibrium and the outcome with the largest total reward are often different.

14.5Task allocation and auctions

How do we distribute jobs among agents without a central planner? One answer is to announce the job by message and collect bids. In the Contract Net protocol the agent that has a job takes the "manager" role and goes through three steps: (1) it announces the job; (2) interested agents send their costs as bids; (3) it awards the job to the lowest bidder. What a bid means depends on the application; for a warehouse robot it is usually the extra distance.

Example 14.2: Two jobs, two robots

In a straight corridor R1 is at position 0 and R2 at position 10. Jobs arrive one after another: job A at position 4, job B at position 8. A bid is the distance from the robot's current last position to the job (the bids happen not to tie in this example).

  1. Announcement of A. R1 bids |0 − 4| = 4, R2 bids |10 − 4| = 6. The lowest bid is R1's: A goes to R1, whose planned last position becomes 4.
  2. Announcement of B. R1 now counts as being at 4: its bid is |4 − 8| = 4. R2 is still at 10: |10 − 8| = 2. B goes to R2.
  3. Total. Distance 4 + 2 = 6.
  4. Comparison. Count the four assignments: R1 does both, 0→4→8, gives 8; R2 does both, 10→8→4, gives 2 + 4 = 6; R1 takes A and R2 takes B gives 4 + 2 = 6; R1 takes B and R2 takes A gives 8 + 6 = 14. The best total is 6, and the auction reached it. In larger problems this sequential auction does not guarantee the best solution, but it works without central information.

Agents with conflicting interests may try to hide their true values. Auctions aim to design the rule so that giving the true information is in the agent's own interest. This idea is called mechanism design.

14.5.1The sealed-bid second-price auction

Everyone submits a sealed bid; the highest bidder wins but pays the second-highest bid. If the true value you place on the item is v and the price you pay is p, your gain is v − p if you win and 0 if you lose.

Example 14.3: Three bidders

The bidders' values for the item are 10, 7 and 4. If all bid their true values:

  1. Outcome. The bidder with value 10 wins and pays 7, the second-highest bid. The gain is 10 − 7 = 3.
  2. Bidding less. If the bidder with value 10 bids 6, it loses to 7 and gains 0: it lost out.
  3. Bidding more. Bidding 12 still pays 7 and still gains 3: nothing is gained.
  4. Someone else deviating. If the bidder with value 7 bids 11, it wins but pays 10: 7 − 10 = −3. Deviating hurts.

The general reason: the threshold for winning and for the price is the highest other bid (m). If your value is above m, the honest bid wins; an inflated bid pays the same price. If your value is below m, the honest bid loses; a bid that would win costs more than the item is worth to you. So bidding the true value is a dominant strategy.

Common mistake

Thinking that the same holds in a first-price auction. There the winner pays its own bid. If a bidder with value 10 knows the highest rival bid is 7, an honest bid gains 10 − 10 = 0, while a bid of 8 gains 2. In first-price auctions agents shade their bids below their true values.

14.6Emergent behavior and agent-based simulation

In some systems it is hard to derive the collective behavior by calculation but easy to observe it by writing the agents' rules and running them. This is called agent-based simulation. Unexpected collective patterns are called emergent behavior: an order that none of the rules states but that arises from the interaction.

Definition 14.2 (The Schelling segregation model)

Agents are of two types (X and O) arranged on a line; some cells are empty. An agent is happy if at least half of its occupied neighbors (the cell to the left and the cell to the right) are of its own type; with no neighbors it is also happy. An unhappy agent moves to the first empty cell where it would be happy.

Example 14.4: Blocks in three moves

The line has 10 cells ("." is an empty cell): OOXOX.XOX.. At each step the leftmost unhappy agent moves.

  1. Start. The O's in cells 0 and 1 are happy (cell 1's neighbors are O and X, so 1/2). The other six agents have no occupied neighbor of their own type and are all unhappy. The share of same-type neighbors is 2/12 ≈ 0.17.
  2. Move 1. The X in cell 2 goes to cell 5, the first empty cell where it is happy: OO.OXXXOX..
  3. Move 2. The only occupied neighbor of the O in cell 3 is an X; it moves to cell 2: OOO.XXXOX..
  4. Move 3. Both neighbors of the O in cell 7 are X; it moves to cell 3: OOOOXXX.X.. Now everyone is happy (cell 8 has no occupied neighbor).
  5. Result. The share of same-type neighbors is 10/12 ≈ 0.83: the line has separated into two blocks.

Although each agent found "half and half" good enough, the collective outcome is almost complete separation. No rule asks for separation.

Schelling's finding is the basic lesson of emergent behavior: reading a collective pattern off individual intentions is misleading. The same approach is used to simulate the flocking of birds (boids), traffic jams and the spread of epidemics. The results of a simulation, however, depend on the assumptions in the rules and the starting state; to see the outcome one runs it from many random starts.

Common mistake

Assuming that when we see a collective pattern, every agent wanted that pattern. In the line above no agent wanted separation; each only said "at least half of my neighbors should be my type." The separation arose from the sum of local rules, without any order from a center. A simulation is for showing which rules can produce which outcomes, not for predicting a real city.

14.7How is the course taught?

14.7.1A typical workflow

Perceiveenvironment,other agentsReasonbeliefs,goalsCommunicatemessages,bidsCoordinatenegotiation,auctionsActjoint outcome
Figure 14.1: A typical workflow in Multi-Agent Systems

A hundred robots pick orders in a warehouse. When a new order arrives, each robot bids based on its position and the best bid wins the job; robots announce their paths to each other and pass through aisles without colliding. There is no all-knowing central planner.

14.7.2Topics over the semester

  1. Intelligent agents and types of environment
  2. Deductive and reactive agent architectures
  3. The BDI architecture and practical reasoning
  4. Agent communication: speech acts, FIPA ACL
  5. Agent platforms: JADE, Jason
  6. Task sharing: Contract Net, distributed planning
  7. Game theory: Nash equilibrium, prisoner's dilemma
  8. Social choice and voting
  9. Auctions and mechanism design
  10. Bargaining and negotiation protocols
  11. Agent-based simulation and emergent behavior
  12. Multi-agent reinforcement learning

This is a typical semester; the order and coverage vary between universities.

14.7.3Skills you will gain

  • writing agents and messaging in JADE
  • simulation with NetLogo or Mesa
  • learning agents in PettingZoo
  • finding Nash equilibria in small games
  • designing auction and bargaining protocols

14.7.4Try it yourself

The Try It: Delivery Robots Bid for Packages slide in the presentation lets you solve a typical problem of this course yourself: Three delivery robots work on campus with no manager. Each package is auctioned; each robot bids the extra distance it would add to its route, and the cheapest wins. Run auctions step by step or click the map to add packages.

14.8Are you ready for this course?

14.8.1Prerequisites

CourseWhy it is needed
Artificial Intelligencethe agent concept, collective decisions
Algorithmic Game TheoryNash equilibrium, mechanism design and auctions
Object Oriented Programming with Javaobjects and messaging: the language of agent platforms such as JADE
Algorithmsgraph algorithms and complexity of distributed problems

14.8.2Ask yourself

For every "no", the right-hand column shows where to start. If you can say "yes" to most of them, you are ready.

QuestionIf not, start with
Can you find the Nash equilibrium in a two-player payoff matrix?The opening chapters of an algorithmic game theory course
Can you explain a single agent that searches a state space?Artificial Intelligence
Can you write classes and have objects send messages via method calls?An intro to object-oriented programming in Java
Can you write an algorithm that finds the shortest path in a graph?Graph algorithms from an algorithms course

14.9Neighboring courses

Reinforcement LearningArtificial IntelligenceRoboticsMulti-Agent Systems
subfieldbuilds onshares methodsapplication
Figure 14.2: Neighbors of Multi-Agent Systems and the kind of relation

14.9.1Where it overlaps

RelationCourseShared ground
subfieldThis course is a subfield of Artificial Intelligencethe agent concept, collective decisions
shares methodsShares methods with Reinforcement Learningmulti-agent reinforcement learning, game theory
shares methodsShares methods with Robotics and Robot Visionswarm robotics, coordination

14.9.2Where it differs

  • Artificial Intelligence: AI seeks one agent's best decision against its environment; this course studies joint behavior where other agents also decide.
  • Reinforcement Learning: RL studies one agent learning from reward; this course also covers communication, negotiation and coordination, with or without learning.
  • Robotics and Robot Vision: Robotics solves sensing and motion for one machine; this course deals with dividing work among many robots or software agents.
  • Evolutionary and Metaheuristic Optimization: Swarm intelligence algorithms use a swarm as a tool to solve a problem; here the agents and their interaction are the subject.

14.10In practice

14.10.1Applications

AreaWhat is done
Warehouse robotsSharing tasks and paths among hundreds of robots.
Smart gridEnergy trading between producers and consumers.
Traffic managementCoordinating intersections and vehicles.
Automated negotiationOnline bidding and ad auctions.
GamesComputer opponents that play as a team.
Social simulationEpidemic, market and crowd behavior.

14.10.2Risks and ethics

RiskExplanation
Unforeseen collective behaviorAgents that each work correctly can together produce surprises: in the 2010 Flash Crash, automated trading sped up the fall.
Collusion without talkingPricing agents that learn can, without any agreement, learn to punish each other and settle on prices above the competitive level.
Gaming the mechanismAn agent that finds a loophole in an auction or voting rule can bid or vote untruthfully and tilt the outcome its way.
Mistaking simulation for realityResults of agent-based epidemic or market simulations depend on the assumed rules and should not go straight into policy.

These issues are discussed in depth in Explainable AI and AI Ethics.

14.10.3Tools and datasets

Tools: JADE, NetLogo, Mesa, PettingZoo, Jason (AgentSpeak), Repast, MASON.

Classic benchmark problems: Prisoner's dilemma, Predator-prey problem, RoboCup soccer, StarCraft Multi-Agent Challenge (SMAC), Schelling segregation model, Flocking (boids) simulation.

In this course data is mostly not collected but generated by simulation: agents' rules are written and joint behavior is observed by running them.

14.11Common misconceptions

Common mistake

A multi-agent system is a multi-core program.

In a parallel program the parts serve one goal; agents are autonomous and their goals may conflict.

Common mistake

If each agent does its best, the whole is best.

As in the prisoner's dilemma, individually rational choices can lead to an outcome bad for everyone.

Common mistake

Coordination needs a central manager.

Swarms and auction protocols achieve decentralized coordination through local rules and messages.

Common mistake

Agents always cooperate.

Agents can also be rivals; the course studies cooperation, competition and mixtures of both.

14.12Summary

  • In multi-agent systems the value of an agent's action depends on the others' choices, so the course treats game theory, communication and coordination together.
  • At a Nash equilibrium no agent gains by changing strategy alone; in the prisoner's dilemma the equilibrium is (1, 1) although the best joint outcome is (3, 3).
  • Contract Net distributes work without a center through announcement, bids and award; a sequential auction does not guarantee the best solution.
  • In a sealed-bid second-price auction bidding the true value is a dominant strategy; in a first-price auction it is not.
  • Simple local rules can produce unexpected collective patterns (the Schelling model); a simulation is for showing this, not for predicting a real system exactly.

14.13Test Yourself

  1. In a stag hunt the payoffs (agent 1, agent 2) are (4, 4) for (S, S), (0, 3) for (S, H), (3, 0) for (H, S) and (3, 3) for (H, H), where S is hunting stag and H is hunting hare. Find the pure Nash equilibria.

    Answer

    Check a unilateral deviation in each cell. (S, S): deviating gives 3 instead of 4, so it is an equilibrium. (H, H): deviating gives 0 instead of 3, an equilibrium. (S, H): agent 1 gets 0 with S and would get 3 with H, so it is not one; (H, S) fails for the same reason. There are two pure equilibria: (S, S) is better for both, while (H, H) carries no risk. Which one is chosen depends on communication and trust.

  2. Three bidders with values 12, 9 and 5 bid their true values in a sealed-bid second-price auction. Who wins, what does the winner pay and what is its gain? What would have happened if the bidder with value 9 had bid 13?

    Answer

    The bidder with value 12 wins and pays 9; its gain is 12 − 9 = 3. If the bidder with value 9 had bid 13 it would have won but paid 12: gain 9 − 12 = −3. Deviating would have hurt.

  3. R1 is at position 2 and R2 at position 9. A job is announced first at position 5 and then a second job at position 8. A bid is the distance from the robot's planned last position. Who gets the jobs and what is the total distance?

    Answer

    First job: R1 bids |2 − 5| = 3, R2 bids |9 − 5| = 4; R1 wins and now counts as being at 5. Second job: R1 bids |5 − 8| = 3, R2 bids |9 − 8| = 1; R2 wins. Total distance 3 + 1 = 4.

  4. In the narrow-road game the payoffs are (−10, −10) for (G, G), (2, 0) for (G, W), (0, 2) for (W, G) and (−1, −1) for (W, W). If we change the payoff of (G, G) to (−6, −6), what is the probability q of going in the mixed equilibrium?

    Answer

    For driver 1, G gives −6q + 2(1 − q) = 2 − 8q and W gives −1 + q. Setting them equal: 2 − 8q = −1 + q, 3 = 9q, q = 1/3. Because a collision is cheaper, drivers go more often (1/3 instead of 3/13).

  5. On the line XOOX.XO ("." is empty; the neighbors are the occupied cells to the left and right), how many agents are unhappy? Compute the share of same-type neighbors.

    Answer

    Count cells from 0. Cell 0, X: its neighbor is O, unhappy. Cell 1, O: neighbors X and O, 1/2, happy. Cell 2, O: neighbors O and X, happy. Cell 3, X: its occupied neighbor is O, unhappy. Cell 5, X: its occupied neighbor is O, unhappy. Cell 6, O: its neighbor is X, unhappy. Four agents are unhappy. Same-type neighbors number 2 out of 8 in total; the share is 2/8 = 0.25.

  6. In reinforcement learning with one agent, the environment's response is a fixed probability distribution. Why does this break in multi-agent reinforcement learning?

    Answer

    The other agents also learn and change their strategies, so the environment one agent sees is not stationary: the same action gives different results at different times. Convergence guarantees for a single agent therefore do not carry over directly, and game-theoretic notions such as the Nash equilibrium come in.

14.14After this course

Multi-agent systems extend AI with a social view. After this course you can move to multi-agent reinforcement learning for learning agents, swarm robotics for physical teams, or algorithmic game theory for designing incentives and rules.

Related careers: Robotics software engineer, Simulation and modeling specialist, Game AI developer, Logistics systems engineer, Researcher.

14.15Further reading

  • M. Wooldridge, An Introduction to MultiAgent Systems (2nd ed., 2009): covers agent architectures, communication, coordination and the basics of game theory together at textbook level.
  • Y. Shoham and K. Leyton-Brown, Multiagent Systems: Algorithmic, Game-Theoretic, and Logical Foundations (2009): treats game theory, mechanism design and social choice from an algorithmic angle.
  • T. C. Schelling, Micromotives and Macrobehavior (1978): the original account of the segregation model used in these notes.

14.16References

  1. Wooldridge, An Introduction to MultiAgent Systems, 2nd ed., Wiley, 2009.
  2. Shoham and Leyton-Brown, Multiagent Systems: Algorithmic, Game-Theoretic, and Logical Foundations, Cambridge University Press, 2009.
  3. Weiss (ed.), Multiagent Systems, 2nd ed., MIT Press, 2013.
  4. Albrecht, Christianos and Schäfer, Multi-Agent Reinforcement Learning: Foundations and Modern Approaches, MIT Press, 2024.

Related pages: Slides · Slides (PDF) · Course page