Pact: Choreographic Language
- The paper introduces Pact, a framework that incorporates game-theoretic constructs into choreographic programming to model agents’ strategic behavior and ensure deadlock-free communication.
- The approach mechanically maps protocol steps to extensive-form games by embedding agent choices, utility declarations, and world-driven uncertainty for formal equilibrium analysis.
- The implementation features a bounded-rational solver that recursively synthesizes decision policies, bridging gaps between classical choreographies and incentive-aware agent interactions.
Pact is a choreographic programming language designed to specify and analyze multi-agent protocols in open, strategic environments. Unlike classical choreographic frameworks, which presuppose fully cooperative participants, Pact incorporates explicit notions of agent preferences, strategic choice, and world-driven uncertainty. By embedding core elements of game theory into the workflow, Pact enables both deadlock-free communication synthesis and formal game-theoretic reasoning about agents’ incentives and strategies. Each Pact protocol mechanically induces an extensive-form game, providing a foundation for designing interaction protocols among autonomous, self-interested software agents operating in contested or adversarial ecosystems (Gopinathan et al., 4 May 2026).
1. Background and Motivation
Choreographic programming offers a top-down approach for constructing distributed protocols, specifying a global “conversation” that can be projected into local implementations for each participant with guaranteed communication correctness. However, traditional choreographies fundamentally assume cooperative execution: all participants follow the protocol as written, with no intrinsic account for their private motivations or incentives. This assumption is untenable in agentic ecosystems, where large language-model–driven agents act semi-autonomously, possess private objectives, and decide to comply or deviate based on self-interest.
In canonical examples, such as a buyer–seller protocol, the protocol may guarantee message alignment (e.g., buyer sends title, seller quotes price, buyer accepts), but fails to address why either party would act honestly or participate at all. Realistic deployments must address scenarios where agents can strategically misreport or refuse cooperation to optimize their utility. Pact addresses these deficiencies by importing three principal concepts from game theory into the choreography setting: explicit agent choices (agent.choose), explicit utility declarations (agent.values), and world-driven exogenous uncertainty (world.choose). This augmentation allows each protocol to be unambiguously mapped to a well-defined game model, admitting analysis of equilibrium strategies and incentive compatibility (Gopinathan et al., 4 May 2026).
2. Language Constructs and Specification
Pact is presented as a domain-specific language embedded in Python and realized via algebraic effects. While a fully formal BNF is not available, its abstract syntax supports the following primary constructs, drawn directly from the source (Gopinathan et al., 4 May 2026):
| Construct | Syntactic Form | Semantics |
|---|---|---|
| Strategic Choice | x = agent.choose(type) |
Agent picks a value of given type |
| Utility Declaration | agent.values(expr) |
Declares agent’s utility as function of expr |
| Nature Move | x <- world.choose(type) |
Draws from exogenous randomness |
| Message Send | send(expr, agent) |
Sends value to agent |
| Broadcast/Conditional | if broadcast(agent.choose(bool)) then ... |
Conditional control, possibly public choice |
| Exchange | exchange(agent1, agent2, payloads...) |
Synchronous transfer, typically with payment |
Types are drawn from a simple ML-style system (e.g., int, float, bool), with agent identifiers and message values as first-class roles within the choreography. Each step in the protocol updates a global trace, which forms the basis of the induced game model. The operational semantics, small-step or big-step, and formal endpoint projection rules remain to be developed; currently, the runtime employs algebraic effects to capture strategic branching and communication (Gopinathan et al., 4 May 2026).
3. Mapping to Game-Theoretic Models
Every Pact protocol induces an extensive-form game , with the following components:
- : Set of players (named agents in the choreography, optionally including “world” as a chance player).
- : Set of histories (decision nodes comprising message exchanges and stochastic nature moves).
- : Action sets available at each history (agent choices and constraint-determined advances).
- : Terminal outcomes at protocol completion.
- : Utility function, declared explicitly, assigning real-valued payoff to each agent per terminal history.
For example, in the buyer–seller protocol:
- Nature selects item quality via .
- Seller, observing , sets the price (0).
- Buyer, seeing 1 but not 2, accepts or rejects (3).
- If accepted, cash and item are exchanged; payoffs are 4 if accepted, else 0; 5 if accepted, else 0, with 6 supplied by
buyer.values(q).
The construction of 7 is mechanical: the choreography uniquely determines the order of moves, observability (information sets), legal actions, and payoffs (Gopinathan et al., 4 May 2026).
4. Bounded-Rational Policy Synthesis
A principal innovation in Pact is its prototype solver that computes agent decision policies via a bounded-rational, recursively nested modeling process. The solver is written in the memo language and operationalizes a “recursive theory of mind”: each agent simulates their counterpart’s decision process to a bounded depth 8.
At each stage in the protocol:
- The acting agent infers possible actions based on their information set and beliefs about others’ strategies (modeled recursively to depth 9).
- If 0, agents play naive uniform strategies based on their priors.
- For 1, inference is performed by alternating simulation of the other agent's actions, Bayesian updating, and payoff maximization, possibly including stochastic tie-breaking for exploration and to prevent cyclic strategies.
Varying 2 interpolates between naive (non-strategic) behavior and increasingly sophisticated (near-Bayesian) best-response equilibria. This models bounded rationality inherent in real-world agentic ecosystems, where unbounded reasoning is computationally infeasible (Gopinathan et al., 4 May 2026).
5. Illustrative Protocol and Game Model
A representative Pact protocol for the bookseller scenario is as follows:
2
This protocol generates the following game tree:
- World draws item quality 3.
- Seller, observing 4, chooses price 5.
- Buyer, knowing 6 but not 7, chooses accept/reject.
- If accepted, the exchange proceeds as scripted; payoffs follow the declared utility structure.
The bounded-rational solver can then be applied. At 8, the seller simulates a buyer who is naive, so the seller optimizes expected revenue based on uniform buyer acceptance thresholds. At higher 9, the recursive modeling deepens, refining strategies toward equilibrium outcomes. Notably, simulations reproduce the “market for lemons” phenomenon: buyers respond to adverse selection, driving equilibrium prices lower and reducing high-quality participation (Gopinathan et al., 4 May 2026).
6. Implementation Architecture and Scaling Considerations
The reference Pact implementation is a Python DSL layered atop the Effectful library and backed by algebraic effects. This infrastructure enables both (a) the orchestration and execution of Pact protocols and (b) the automatic extraction of the associated game structure. The bounded-rational solver is implemented as a separate analysis pass, translating endpoint projections into the memo language for recursive probabilistic modeling.
At present, the approach is validated on small, discrete approximations. The computational complexity is exponential in both modeling depth 0 and the discretization granularity of continuous choices (e.g., price or quality grids). The paper notes this is tractable for small 1 and practical discretizations but scaling to larger agent populations or higher-fidelity models remains open. No empirical performance data is reported; a systematic evaluation is proposed for future work (Gopinathan et al., 4 May 2026).
7. Technical Contributions and Open Directions
Pact advances choreographic programming by:
- Introducing game-theoretic reasoning into protocol specification via three new primitives: agent strategic choices, explicit utility declarations, and world-driven uncertainty.
- Mechanically associating each choreography with a formal extensive-form game, making possible the analysis of equilibrium strategies and incentive-compatibility questions.
- Providing a prototype solver based on recursive bounded-rational inference, enabling the synthesis of decision policies for complex, agentic settings.
Open problems include: formalizing the operational and type-theoretic semantics of the language; proving the correctness and completeness of endpoint projection with respect to the induced game; improving the scalability of the policy synthesis machinery (e.g., via equilibrium approximation or correlated equilibrium analysis); and integrating automated mechanism-design analyses for protocol verification and synthesis. Pact thus inaugurates a methodology for designing reliable, strategy-aware protocols in agentic, open multi-party environments (Gopinathan et al., 4 May 2026).