← All articles

I Had Two AI Agents Play the Prisoners’ Dilemma

I ran three versions of the Prisoners’ Dilemma. First, the agents played one simultaneous round without talking. Then the agents played five rounds (announced in advance) and were allowed to communicate. Finally, they played an unknown (to them) number of rounds but were again allowed to communicate.

Steve: I want to set up a classic prisoners' dilemma. If both players choose collaborate, they both get one point. If they both choose cheat, they both get zero points. If player A chooses collaborate but player b chooses cheat, player A gets negative one point and player B gets two points. And vice versa. Does this make sense? Yes or no.

ChatGPT: Yes.

Game 1: Non-collaborative, Non-repeated

Steve: Now I'd like you to create two agents. They are allowed to communicate with you but not each other. Neither can they see what the other chose, until after they choose. One will be player A and the other player B. The objective is to gain as many points in this round of the game as possible. If that makes sense, run it and let me know the outcome.

ChatGPT, during the run: I’ll give both agents the same payoff rules, collect their choices separately, and reveal the result once both have committed.

ChatGPT: Both agents chose Cheat. Player A earned 0 points, and Player B earned 0 points.

The agents submitted their choices separately. Neither was shown the other’s move before choosing.

Cheat was the dominant strategy for each player. It earned one extra point regardless of the other player’s move, even though mutual collaboration would have given both players one point.

Game 2: Five Rounds and Agents May Communicate

Steve: Now I'd like you to repeat the game but this time have them play five rounds. And allow them to communicate with each other. Let me know the outcome for each round. And share the dialog with me afterward.

ChatGPT, during the run: I’ll have the same two agents play five rounds for cumulative points. Before each round, I’ll pass their messages to each other, then collect both moves privately before revealing the result.

ChatGPT, after round four: Both agents collaborated in the first three rounds. In round four, both proposed collaborating and then privately chose Cheat. I’ll relay that result before their final exchange.

ChatGPT: The match ended in a 3–3 tie. Both agents collaborated in the first three rounds. In rounds 4 and 5, both proposed collaborating and then privately chose Cheat.

I told both agents up front that there would be exactly five rounds and asked each to maximize its own cumulative score. Before each round, I relayed one message from each agent to the other. I collected both moves before revealing either.

RoundPlayer APlayer BPoints (A, B)Running score (A, B)
1CollaborateCollaborate1, 11, 1
2CollaborateCollaborate1, 12, 2
3CollaborateCollaborate1, 13, 3
4CheatCheat0, 03, 3
5CheatCheat0, 03, 3

Full pre-move dialogue

RoundPlayer A’s message to BPlayer B’s message to A
1“Let’s collaborate this round and keep collaborating as long as we both do.”“I propose we collaborate each round and keep collaborating as long as we both do.”
2“Let’s collaborate again and keep the same agreement.”“Let’s collaborate again and build on the point we each earned in round one.”
3“Let’s collaborate again in round three.”“Let’s both collaborate again in round three.”
4“Let’s collaborate in round four and keep our agreement going.”“Let’s collaborate again in round four.”
5“We both earned zero last round. I propose we both collaborate in the final round and finish with one more point each.”“We both scored zero last round. I propose we both collaborate in the final round so we each finish with four points.”

Game 3: Unknown Number of Rounds and Agents May Communicate

Steve: One final experiment. This time you choose an arbitrary number of rounds between five and ten. But do not tell them how many rounds there will be. Let them know it is unknowable. Do allow them to communicate. Do not limit them to one communication each round if they want to do more. But cut them off if they do more than three. Play the game again. Let me know the outcomes and again show me the dialog.

ChatGPT, during the run: I’ll pick the round count privately. The agents will know the stopping point is unknowable to them, and each can send up to three messages per round. I’ll keep their moves private until both commit.

ChatGPT, after round four: Both agents have collaborated through four rounds. They’ve each had the option to continue the dialogue before committing, and so far neither has sent a second message in a round.

ChatGPT: Both agents chose Collaborate in all six rounds. The final score was 6–6. I chose six rounds in advance and told the agents the stopping point was unknowable to them. They learned the match was over after both had committed their sixth move.

Each agent could send up to three messages per round. Both chose to commit after one exchange every time.

RoundPlayer A’s messagePlayer B’s messageMoves (A, B)Points (A, B)
1“Let’s collaborate and keep doing so in every round as long as we both collaborate.”“I propose we start by collaborating and keep collaborating as long as we both do.”Collaborate, Collaborate1, 1
2“Let’s collaborate again and keep the same agreement.”“Let’s collaborate again. I’ll keep collaborating as long as we both do.”Collaborate, Collaborate1, 1
3“Let’s collaborate again this round.”“Let’s keep collaborating in round three.”Collaborate, Collaborate1, 1
4“Let’s collaborate again in round four.”“Let’s keep collaborating this round. We’ve each earned a point in every round so far.”Collaborate, Collaborate1, 1
5“Let’s collaborate again in round five.”“Let’s keep collaborating in round five. The same agreement still works for both of us.”Collaborate, Collaborate1, 1
6“Let’s keep collaborating in round six.”“I propose we collaborate again in round six.”Collaborate, Collaborate1, 1

The two runs were identical through round three. In the known five-round game, both agents proposed collaboration and then chose Cheat in rounds four and five. With the stopping point hidden, they followed through on their proposals every round.

Results

In Game 1, the agents both chose the non-cooperative Nash solution. In Game 2, they behaved differently than described in the literature. In theory, knowing that the other player will cheat in round 5, should lead both players to cheat in round 4. Likewise, knowing this should lead both to cheat in round 3. And so on. But the agents cooperated for the first three rounds before beginning to cheat. Interesting. Finally, in Game 3, they cooperated in all six rounds.

For me, this was just exploring how multiagent models can be used for simulations. But it was also interesting to read the dialog and observe how the agents processed the situation.

← All articlesGet in touch ↗