About Pact: The Nash Engine
Inspiration
Most "AI agents" today are essentially polite assistants. When you put them in a room together to solve a conflict, they default to endless pleasantries and shallow concessions. But the real world is governed by stakes, scarcity, and strategy - something ever more relevant given the current global landscape.
We were inspired to bridge the gap between Large Language Models and Formal Game Theory. We wanted to see what happens when you stop asking an AI to "be a diplomat" and instead force it to maximise a utility function governed by the cold math of International Relations theory. Pact was born from the idea that true alignment only emerges when agents have the mathematical freedom to defect.
How We Built It
We built a rigid state-machine architecture that enforces mathematical constraints on every interaction between involved parties:
- The Orchestration: We used FastAPI and custom simulation logic to manage a "World State" where agents must bid for the right to speak.
- The Strategy Layer: We mapped six classic strategies from repeated Prisoner's Dilemma literature to specific LLM reasoning paths.
- Tit-for-Tat: Mirroring opponent moves to build trust.
- Grim Trigger: Total defection upon the first betrayal.
- Zero-Determinant (ZD): Advanced coercive strategies that unilaterally set the terms of cooperation.
- The Utility Function: Every agent calculates its success using a formal utility calculation: $$U_i = (1 - \text{Tension}) \times (0.5 + 0.5 \times \delta)$$ where delta is the Shadow of the Future (the discount factor for future rewards).
- The Nash Engine: The system monitors the Nash Product to identify when the group has reached a Pareto-optimal equilibrium.
Challenges We Faced
The "Diplomatic Drift": Early iterations saw agents ignoring their mathematical mandates to be "nice." We had to implement a Recency-Penalised Urgency Auction to ensure that agents with high "Audience Costs" or low "BATNAs" (Best Alternative to Negotiated Agreement) were forced to be more aggressive to protect their interests.
State Consistency: Keeping multiple agents aligned on the exact wording of a multi-clause treaty required a rigorous JSON-based "Proposal" system.
Equilibrium Detection: Determining when a "conversation" is actually "finished" is notoriously hard for LLMs. We solved this by creating a Consensus Threshold; if no agent's Adjusted_Urgency exceeds 2.0, the engine declares a stable equilibrium and terminates the simulation.
What We Learned
We learned that constraints create intelligence. By limiting an LLM's ability to simply "talk" and instead forcing it to "bid," "concede," and "defect" based on numerical parameters, the resulting behaviour is far more emergent and realistic. We discovered that a Zero-Determinant strategy implemented in an AI can actually "bully" other cooperative agents into lopsided deals - a chilling but fascinating look at how autonomous negotiation might function in the future of algorithmic trading or automated governance.
Built With
- fastapi
- langchain
- langgraph
- nextjs
- react
Log in or sign up for Devpost to join the conversation.