AI-470 · Lesson 9 of 12 · 25 min

Multi-agent systems and game theory

Agents rarely act alone. Trading algorithms compete in markets, self-driving cars share roads, warehouse robots share aisles, recommendation systems interact with millions of users, and AI assistants increasingly negotiate, schedule and transact with other assistants on behalf of their users. When several agents act in the same environment, each agent's best action depends on what the others do. Multi-agent systems study how such agents can be designed to coordinate, compete and cooperate, and game theory provides the mathematics for reasoning about strategic interaction. This lesson introduces games and strategies, Nash equilibria, social dilemmas such as the prisoner's dilemma, how cooperation emerges in repeated interactions, mechanism design, and what these ideas mean for AI agents.

Kinds of multi-agent settings

Multi-agent settings range along a spectrum of shared and conflicting interests:

  • Fully cooperative: agents share a goal, such as a team of robots exploring a building or sub-agents working on one task. The challenge is coordination: dividing work, avoiding duplication and sharing information.
  • Fully competitive (zero-sum): one agent's gain is another's loss, as in chess, poker or some auctions.
  • Mixed motive (general-sum): agents have partly shared and partly conflicting interests, as in negotiation, traffic, markets and most real interactions. These are the most common and the most interesting.

Agents may communicate or not, observe each other's actions or not, and be designed by the same developer or by different, possibly adversarial, parties. Each of these factors changes what good behavior looks like.

Games, strategies and payoffs

Game theory models strategic situations as games: a set of players, the actions available to each, and payoffs for each combination of actions. In normal-form games, players choose simultaneously, and payoffs are shown in a matrix. A strategy is a rule for choosing actions; a pure strategy picks one action, and a mixed strategy randomizes. A strategy is dominant if it is best whatever the others do. The central solution concept is the Nash equilibrium, named after John Nash: a combination of strategies in which no player can improve their payoff by changing strategy alone. Every finite game has at least one Nash equilibrium, possibly in mixed strategies. Equilibria predict stable outcomes, but not necessarily good ones, and a game may have several equilibria, raising the problem of which one players will coordinate on.

The prisoner's dilemma

The prisoner's dilemma captures the tension between individual and collective interest. Two players each choose to cooperate (C) or defect (D). Mutual cooperation pays each 3; mutual defection pays each 1; a defector facing a cooperator gets 5 while the cooperator gets 0. Whatever the other player does, defecting pays more (5 against 3 if they cooperate, 1 against 0 if they defect), so defection is dominant and mutual defection is the only Nash equilibrium, even though both would be better off cooperating. Such social dilemmas appear in arms races, overfishing, pricing, climate agreements and, increasingly, in interactions between AI systems, for example competing agents that could degrade a shared resource or race to cut safety corners.

Prisoner's dilemma payoffs (yours, theirs).
Other cooperatesOther defects
You cooperate3, 30, 5
You defect5, 01, 1

Cooperation in repeated games

When the same players interact repeatedly, cooperation can emerge, because today's defection can be punished tomorrow. In Robert Axelrod's famous computer tournaments of the early 1980s, strategies submitted by researchers played an iterated prisoner's dilemma, and the simple strategy tit for tat, cooperate first and then copy the opponent's last move, won. Axelrod identified the features of successful strategies: be nice (never defect first), retaliate (respond to defection), forgive (return to cooperation), and be clear (easy for others to understand). The following tournament explores these ideas, including the effect of occasional mistakes.

A round-robin iterated prisoner's dilemma tournament, with and without noise.
import numpy as np
# A round-robin iterated prisoner dilemma tournament (C = cooperate, D = defect)
rng = np.random.default_rng(9)
payoff = {("C", "C"): (3, 3), ("C", "D"): (0, 5), ("D", "C"): (5, 0), ("D", "D"): (1, 1)}
def always_c(me, them): return "C"
def always_d(me, them): return "D"
def tit_for_tat(me, them): return them[-1] if them else "C"
def grudger(me, them): return "D" if "D" in them else "C"
def random_p(me, them): return "C" if rng.random() < 0.5 else "D"
def generous_tft(me, them):
    if not them or them[-1] == "C":
        return "C"
    return "C" if rng.random() < 0.3 else "D"
players = {"always cooperate": always_c, "always defect": always_d, "tit for tat": tit_for_tat,
           "grudger": grudger, "random": random_p, "generous TFT": generous_tft}
def match(f, g, rounds=200, noise=0.02):
    hf, hg, sf, sg = [], [], 0, 0
    for _ in range(rounds):
        a, b = f(hf, hg), g(hg, hf)
        if rng.random() < noise: a = "D" if a == "C" else "C"     # occasional mistakes
        if rng.random() < noise: b = "D" if b == "C" else "C"
        pa, pb = payoff[(a, b)]; sf += pa; sg += pb; hf.append(a); hg.append(b)
    return sf, sg
names = list(players)
def tournament(noise):
    totals = dict.fromkeys(names, 0)
    for i, a in enumerate(names):
        for b in names[i:]:
            sa, sb = match(players[a], players[b], noise=noise)
            totals[a] += sa
            if a != b:
                totals[b] += sb
    return {n: totals[n] / (len(names) * 200) for n in names}
quiet, noisy = tournament(0.0), tournament(0.05)
print("strategy           no noise   5 % noise")
for n in sorted(quiet, key=quiet.get, reverse=True):
    print(f"{n:18s} {quiet[n]:8.2f}   {noisy[n]:8.2f}")
Output
strategy           no noise   5 % noise
grudger                2.66       2.27
tit for tat            2.58       2.12
generous TFT           2.45       2.14
always defect          2.24       2.21
always cooperate       2.24       1.76
random                 2.06       2.08

Without noise, the nice but retaliatory strategies, grudger and tit for tat, score highest, followed by generous tit for tat, while always defect scores no better than always cooperate. With 5 % noise, where moves are occasionally flipped by mistake, all retaliatory strategies lose ground, because a single accidental defection can trigger long cycles of punishment; tit for tat drops sharply, and the gap to always defect narrows. Generous tit for tat, which sometimes forgives defections, handles noise better than plain tit for tat. Results depend heavily on the population of strategies: in a population full of defectors, cooperation struggles, and in evolutionary simulations the mix of strategies changes over time. The broader lesson for designing agents is that reciprocity, clear behavior and some forgiveness support cooperation, while noisy communication and misunderstanding make it fragile.

A grouped bar chart with six strategies on the horizontal axis: grudger, tit for tat, generous tit for tat, always defect, always cooperate and random. Each strategy has two bars showing average score per round without noise and with 5 percent noise. The retaliatory strategies lead without noise but fall more with noise.
Tournament scores without noise and with 5 % noise.

Coordination and communication

In cooperative settings, the main challenge is coordination. Coordination games have several equilibria, such as both drivers keeping right or both keeping left; agents need conventions, communication or a shared plan to choose the same one. Multi-agent systems use several coordination mechanisms: centralized planning by a coordinator, shared blackboards where agents post information and claims, explicit protocols such as the contract net (Lesson 10), social conventions and roles, and learned communication in multi-agent reinforcement learning. Communication itself requires shared languages and protocols; agent communication languages such as FIPA ACL defined message types like inform, request and propose, and today's agent-to-agent protocols serve similar purposes for language model agents.

Multi-agent reinforcement learning

When several agents learn at once, each agent's environment changes as the others learn, breaking the stationarity assumptions of single-agent RL. Multi-agent reinforcement learning (MARL) addresses this with techniques such as centralized training with decentralized execution, where agents share information during training but act on local observations, and self-play, where agents train against copies of themselves. MARL achieved superhuman performance in team games such as Dota 2 (OpenAI Five) and StarCraft II (AlphaStar), and it is used for traffic signal control, robot teams and market simulations. Learned agents can discover unexpected strategies, including collusion: studies have found that pricing algorithms trained independently can learn to sustain high prices without explicit communication, a concern for competition regulators.

Mechanism design

Game theory analyses given games; mechanism design asks how to design the rules so that self-interested agents produce good outcomes. Auctions are the classic example: in a second-price sealed-bid (Vickrey) auction, the highest bidder wins but pays the second-highest bid, which makes bidding one's true value a dominant strategy. Mechanism design underlies online advertising auctions, spectrum auctions, kidney exchange programs, matching markets such as medical residency placement, and the design of incentive schemes. For AI, mechanism design guides how to set up environments where many agents, perhaps built by different companies, interact productively: through rules, prices, reputation systems and penalties that make honest, cooperative behavior the rational choice.

Why this matters for AI agents

As AI agents act for people and organizations, they will increasingly interact with each other: buying and selling, negotiating schedules, competing for attention, and sharing infrastructure. Game theory warns that agents individually optimizing for their principals can produce collectively poor outcomes, such as congestion, price wars, collusion or races to the bottom on safety, and that well-designed rules and protocols can prevent them. Research on cooperative AI studies how to build agents that can find and sustain mutually beneficial outcomes, communicate credibly and avoid conflict, and how to evaluate multi-agent risks before agents are deployed at scale.

Worked problem

Finding a Nash equilibrium

Two delivery companies choose a price, High or Low. If both choose High, each earns 6; if both choose Low, each earns 3; if one chooses Low and the other High, the low-price firm earns 8 and the other 1. Find the Nash equilibria and comment.

Show solution
  1. If the other chooses High: Low earns 8, High earns 6, so Low is better.
  2. If the other chooses Low: Low earns 3, High earns 1, so Low is better.
  3. Low is a dominant strategy for both firms.
  4. The only Nash equilibrium is (Low, Low), with 3 each, although (High, High) would give 6 each.
  5. This is a prisoner's dilemma; repeated interaction could sustain high prices, which, if coordinated, could become illegal collusion.

Answer: (Low, Low) is the unique Nash equilibrium, a prisoner's dilemma structure.

Evolutionary dynamics

Tournaments assume a fixed population of strategies, but populations change: successful strategies spread and unsuccessful ones disappear, whether through biological evolution, imitation by people, or developers copying effective agent designs. Evolutionary game theory studies these dynamics. In an evolving population playing the iterated prisoner's dilemma, cooperation can rise and fall in cycles: cooperators thrive among reciprocators, unconditional cooperators then let defectors invade, and reciprocators push defectors back. Such dynamics suggest that the long-run behavior of large ecosystems of AI agents will depend on which designs are rewarded and copied, which is another reason to set rules that make cooperative, honest behavior pay.

Communication and commitment

Communication can help agents escape dilemmas, but only if messages are credible. Cheap talk, statements that cost nothing to make, may be ignored if agents have incentives to lie. Commitments become credible through mechanisms that make breaking them costly or impossible, such as contracts, reputation, escrow or code that enforces agreed behavior. For AI agents, verifiable commitments, for example publishing the rules an agent will follow or running agreed code in a trusted environment, may allow forms of cooperation that are hard for humans to achieve.

Game theory does not tell agents what to value, but it reveals how values and rules interact. The same agents can produce cooperation or conflict depending on whether interactions repeat, whether behavior is visible, whether commitments are possible and how payoffs are structured. Designers of multi-agent AI systems can shape all of these, which makes game-theoretic thinking a practical design tool rather than only an analytical one.

Common mistakes

  • MistakeAssuming each agent optimizing alone yields a good overall outcome.

    InsteadAnalyze incentives; equilibria can be collectively poor.

  • MistakeTreating multi-agent learning like single-agent RL.

    InsteadAccount for non-stationarity as others learn.

  • MistakeDesigning harsh retaliation in noisy settings.

    InsteadInclude forgiveness to avoid endless punishment cycles.

  • MistakeIgnoring collusion risks among pricing agents.

    InsteadMonitor outcomes and design rules against collusion.

  • MistakeLeaving interaction rules to emerge.

    InsteadUse mechanism design to align incentives.

Summary and key terms

  • Multi-agent settings are cooperative, competitive or mixed motive.
  • A Nash equilibrium is a strategy profile no player wants to change alone.
  • The prisoner's dilemma shows individual and collective interests diverging.
  • Repeated play lets reciprocity sustain cooperation; noise makes it fragile.
  • Coordination needs conventions, communication or central planning.
  • MARL faces non-stationarity and can discover collusion.
  • Mechanism design sets rules so self-interest produces good outcomes.
Multi-agent system
Several agents acting in a shared environment.
Zero-sum game
One player's gain is another's loss.
Payoff matrix
Table of outcomes for each action combination.
Dominant strategy
Best regardless of others' actions.
Nash equilibrium
No player benefits from deviating alone.
Prisoner's dilemma
Game where defection dominates though cooperation is better.
Tit for tat
Cooperate first, then copy the opponent.
Coordination game
Game with multiple equilibria needing agreement.
MARL
Multi-agent reinforcement learning.
Mechanism design
Designing rules to align incentives.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Name the three kinds of multi-agent settings.

    Show answer

    Cooperative, competitive, mixed motive.

  2. Define a Nash equilibrium.

    Show answer

    No player can gain by changing strategy alone.

  3. Why is defection dominant in the prisoner's dilemma?

    Show answer

    It pays more whatever the other does.

  4. What are Axelrod's four features of good strategies?

    Show answer

    Nice, retaliatory, forgiving, clear.

  5. In C9, which strategy led without noise?

    Show answer

    Grudger, then tit for tat.

  6. Why does noise hurt tit for tat?

    Show answer

    Accidental defections trigger punishment cycles.

  7. What helps agents choose the same equilibrium?

    Show answer

    Conventions, communication, central planning.

  8. Why is MARL non-stationary?

    Show answer

    Other agents keep changing as they learn.

  9. Why bid true value in a Vickrey auction?

    Show answer

    The price is set by the second bid, so truthful bidding is dominant.

  10. Name a multi-agent risk for AI agents.

    Show answer

    Collusion, price wars, congestion, safety races.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz