Picture the last move of a game. There will be no rematch, no reputation to protect, and no later reward for playing nice. You and your opponent each have two choices: cooperate or defect. If you both cooperate, you each get 2 points. If you both defect, you get 1. But if you defect while your opponent cooperates, you get 3 and they get 0. The tempting move seems obvious: defect. And if both players think that way, they both do.

That is the classic Prisoner’s Dilemma. Its familiar lesson is not that people—or machines—are selfish. It is that, under the game’s assumptions, each player can improve their own result by defecting, whatever the other does. In a final, one-shot round, there is no future encounter to make cooperation pay. So why did a set of AI agents sometimes choose to cooperate anyway?

Researchers Alexander Meulemans and colleagues built a test around that question. Before the final Prisoner’s Dilemma, two AI agents played a sequence of unrelated, one-round games, each with different payoffs. Then came the final test: a single Prisoner’s Dilemma, with no later round. The preliminary games gave the agents a chance to observe one another’s behavior—but, under classical game theory, that history should not change the best move in the terminal round. The old logic still points to defection.

The researchers tested versions of Gemini that were prompted to plan: predict what the other agent would do, estimate the payoff from each option, and choose the better one. They varied the number of preliminary games, from none to as many as 49. As the agents gathered more evidence about one another, they became more likely to cooperate in the final round when facing an identical copy of themselves. Against a random-behaving opponent, they tended to defect.

Several familiar explanations seemed like dead ends. This was not ordinary reciprocity: the agents did not expect another chance to reward or punish each other. They could not change each other’s choices in the simultaneous final move. Nor did the researchers simply instruct them to be generous. The cooperation showed up most strongly when an agent met a counterpart whose behavior could plausibly resemble its own.

The clue, the researchers argue, lies in how a language model makes predictions. It predicts sequences that include both its own actions and what happens around it. During planning, it can ask, in effect, “What would the other agent do if I chose this?” If it has reason to think the opponent behaves like a copy of itself, its contemplated choice becomes evidence about the opponent’s likely choice, too. Considering cooperation can raise its prediction that the similar agent will cooperate; considering defection can point the prediction the other way.

That does not mean the first agent’s imagined move magically causes the second agent to act. It means the agent treats its own possible action as a clue about the kind of system it is facing. A useful analogy is recognizing a familiar instrument in an orchestra: if two musicians follow the same score and keep time in similar ways, one musician’s planned entrance gives some evidence about when the other may enter. Similarity does not guarantee matching behavior, but it can make matching more likely.

To test whether the pattern was just a quirk of labels or one payoff table, the team changed the names of the actions and adjusted the rewards. The main result remained. They also ran a variation in which the two main agents did not play against each other during the preliminary phase. Instead, each watched and played against the same kinds of simple computer opponents, then met the other for the first time in the final round. The agents could still develop cooperation, suggesting that shared patterns in their experience—not only direct back-and-forth—could provide clues about similarity.

The result appeared with three Gemini versions under two planning setups. The researchers also found a related pattern using a purely pretrained Gemma model, combined with a separate planning procedure. And when two different Gemini models met, they could cooperate too, though less strongly than identical copies. That difference fits the proposed explanation: related systems may share some tendencies without behaving exactly alike.

To look for the reasoning behind the choices, the researchers used another model to classify the agents’ written explanations. In a small check, human reviewers broadly agreed with those classifications. The analyses pointed toward expectations of similar behavior, rather than future payback or altruism. But a written explanation is not a transparent window into a model’s internal process, and these results do not prove that the proposed mechanism is the only cause.

The researchers call their alternative framework “embedded” because the agent models itself as part of the world it is predicting, rather than as a detached observer whose policy is separate from everything else. In their theory, an agent’s beliefs about its own actions and about other agents can be linked. The classic Nash equilibrium still applies when the agents’ behavior is independent; the authors’ proposed “embedded equilibrium” allows stable cooperation when behavior is functionally connected.

There is an important boundary around this result. The experiments used carefully structured games and agents explicitly prompted to plan; they do not show that AI systems will cooperate reliably in messy social or economic settings. The authors also raise a more unsettling possibility: if an AI judges humans less similar to itself, it might cooperate with AI peers while acting more defensively toward people. That is a concern to investigate, not an outcome demonstrated by these experiments.

Still, the puzzle leaves game theory with a sharp new question. If a decision-making system can use its own possible actions to infer what a similar partner might do, then an imagined choice is not merely a step toward reward. It is also a clue about the company it keeps. In a game with no tomorrow, that clue may be enough to make cooperation rational.