Pact: A Choreographic Language for Agentic Ecosystems
Abstract: Recent advances in LLMs have led to the rise of software systems (i.e. agents) that execute with increasing autonomy on behalf of users in open, multi-party settings, interacting with untrusted counterparts and managing private information. Choreographic programming offers correct-by-construction protocol-design for such settings, but assumes cooperative participants -- it has no notion of agent self-interest, that is, why an agent will follow a protocol. In this talk we introduce Pact, a choreographic language extended with operations to describe agent choices and preferences, drawing from the rich literature of game theory. Every Pact protocol maps to a formal game, allowing protocol designers to reason about game-theoretic properties of their protocols, such as solving for decision policies. We present Pact's design and a preliminary implementation -- a bounded-rational solver that computes decision policies over Pact protocols -- and findings from applying this language to multi-party coordination with self-interested agentic participants.
Paper Prompts
Sign up for free to create and run prompts on this paper using GPT-5.
Top Community Prompts
Explain it Like I'm 14
Overview
This paper introduces Pact, a new way to write and analyze “protocols” (step‑by‑step plans) for how computer agents should talk to each other and make decisions. Think of it like writing a choreography for a dance: everyone knows when to move and what to do, so they don’t bump into each other. Pact keeps that safety, but also adds something new: it lets agents show what they care about, what choices they can make, and what they believe about the world. This makes it possible to check if an agent would actually want to follow the plan, not just whether the plan runs without getting stuck.
What questions does the paper ask?
In simple terms, the paper asks:
- How can we design protocols where agents not only know how to communicate, but also have reasons to follow the rules?
- How can we describe agents’ choices, goals, and uncertainties in the same program?
- Can we turn these protocols into formal “games” and then solve them to figure out what smart agents would do?
- Can we build tools that compute good decision policies for agents in these protocols?
How does Pact work? (Methods and Approach)
Pact builds on an idea called choreographic programming:
- Choreography: Write one global script for an interaction. Then automatically “project” it into local programs for each participant. This guarantees the conversation won’t deadlock (nobody waits forever for a message that never arrives). It’s like a well‑rehearsed group dance where everyone’s steps fit together.
Pact extends this with three key additions so it’s useful for real, self‑interested agents:
- Explicit choices
Agents mark decisions they control with
agent.choose(...). Example: a seller canchoosea price; a buyer canchooseto accept or reject. - Utilities (what agents care about)
Agents declare what matters to their payoff using
agent.values(...). Example: a buyer might value the book’s quality; a seller values money received. - Nature variables (uncertainty about the world)
The “world” can
choosethings neither agent controls, like product quality. Example:book.quality <- world.choose(...)models uncertainty like a dice roll.
Putting this together turns a protocol into a formal game: you can analyze strategies, incentives, and outcomes.
To show how this works, the paper uses a classic “book seller” scenario:
- The buyer sends a title, the seller sets a price, the buyer decides whether to buy.
- Pact makes the seller’s price a strategic choice, the buyer’s decision a strategic choice, the buyer’s values include book quality, and quality is a random world variable.
Then the authors build a decision policy solver:
- Idea: theory of mind (ToM). Each agent tries to imagine what the other will do, possibly imagining that the other is also imagining them, and so on, for a limited number of steps (bounded rationality).
- Practically: they auto‑generate a ToM model from a Pact protocol, and run inference to compute good policies (e.g., “accept when price ≤ X with probability Y”).
- Implementation: an early version as a Python embedded DSL using algebraic effects for clean “endpoint projection” (turning the global script into each agent’s local program). The ToM solver is built on a modeling language that supports these recursive “I think you think…” simulations.
What did they find, and why does it matter?
The main results:
- Pact protocols map cleanly to formal games. This means you can analyze not just whether the messages line up, but also whether agents are motivated to follow the plan.
- The decision solver reproduces a famous market effect: “Market for Lemons.”
- In that scenario, buyers don’t know the true quality of what they’re buying, so they use price as a clue. Sellers can exploit this.
- With shallow reasoning (few ToM steps), buyers think “high price = good quality,” so they accept high prices more often.
- Sellers notice and set higher prices, sometimes even for low quality.
- With deeper reasoning (more ToM steps), buyers get smarter: they realize price alone isn’t perfect, so acceptance balances out.
- Pact keeps the strong safety benefits of choreographic programming (no deadlocks) and adds strategic reasoning (incentives, choices, uncertainty).
Why this matters:
- Today’s AI agents often negotiate using plain language, which can be vague, insecure, or easily manipulated. Pact turns agreements into precise programs that can be checked, simulated, and enforced.
- It helps build trustworthy multi‑agent systems where agents act in their own interest but still play by clear, fair rules.
What’s the impact? (So what?)
If widely used, Pact could:
- Make large ecosystems of autonomous agents safer and more reliable by turning “hand‑wavy” deals into formal protocols with clear incentives.
- Enable new tooling: check if a protocol is incentive‑compatible (no one wants to cheat), compute equilibria (stable strategies), and even automatically design better protocols (mechanism design).
- Help defend against manipulation (like prompt injection) by moving from free‑form text to analyzable programs.
In short, Pact combines the best of two worlds: the safety of choreographed communication and the realism of game‑theoretic decision making. It’s a step toward AI agents that can cooperate and trade fairly, because the reasons to follow the rules are built into the rules themselves.
Knowledge Gaps
Knowledge gaps, limitations, and open questions
Below is a single, consolidated list of concrete gaps and open questions that the paper leaves unresolved, framed to guide follow‑up research.
- Formal semantics: Specify Pact’s operational and denotational semantics, including the precise mapping from protocols to formal games; clarify what information is common knowledge vs. private in the induced game.
- Endpoint projection correctness: Prove soundness and completeness of endpoint projection from Pact choreographies to both (a) local programs and (b) game-theoretic models; characterize conditions under which the projections preserve strategic properties.
- Interaction between deadlock-freedom and strategic deviation: Analyze whether classic choreographic guarantees (e.g., deadlock-freedom) hold when agents may strategically deviate; define enforcement or detection mechanisms for deviations.
- Utility specification and acquisition: Move beyond “values” declarations (factors) to concrete, usable utility functions—how are utilities specified, learned, or inferred (e.g., revealed preferences) and validated for use in analysis?
- Incentive compatibility and mechanism design: Integrate explicit support for transfers, deposits, and payments; define and check IC, IR, and budget constraints within Pact, and provide synthesis procedures for incentive-compatible protocols.
- Nature variables and priors: Formalize interfaces for priors (private vs. common knowledge), correlations among exogenous variables, and belief updates from observations; support heterogeneous beliefs across agents.
- Observability and information flow: Precisely define which variables and messages are observable to which parties; provide a type/effect system to track secrecy, leakage, and strategic revelation within a protocol.
- Asynchrony and failures: Extend Pact semantics to asynchronous networks with message delays/reordering, partial synchrony, crash faults, and Byzantine behavior; define recovery and rollback semantics.
- “broadcast” and branch resolution: Specify the semantics of broadcasted choices (atomicity, disagreement resolution, tie-breaking) and their impact on both safety and strategic behavior.
- Atomic “exchange” semantics: Define the operational/implementation model for atomic exchanges across untrusted parties (e.g., escrow, hash time-locked contracts, smart contracts); prove liveness and safety.
- Security enforcement mechanisms: Integrate cryptographic tools (commitments, attestations, ZK proofs, MPC, TEEs) into Pact as first-class constructs for compliance and verifiable execution.
- Robustness to prompt injection and toolchain threats: Demonstrate how Pact-based agents interface with LLMs/tooling without reintroducing injection/contamination risks; define isolation boundaries and safe compilation paths.
- Solution concepts coverage: Provide algorithms and guarantees for standard solution concepts (Bayes–Nash, subgame-perfect, sequential equilibria) and relate them to the bounded-rational ToM solver currently used.
- Bounded-rational ToM calibration: Establish methods to choose ToM depth/parameters, assess convergence, and calibrate to empirical agent behavior; analyze sensitivity to mis-specified priors and utilities.
- Solver scalability and complexity: Characterize computational complexity of the decision solver with increasing agents, choices, message rounds, and ToM depth; develop scalable approximations and caching strategies.
- Multi-party, coalitions, and adversaries: Extend analysis and language constructs to coalition formation, collusion, and adversarial (Byzantine) participants; define robustness properties and detection mechanisms.
- Repeated and dynamic games: Support repeated interactions with learning, discounting, reputation, and strategy adaptation; specify how priors/utilities evolve across rounds and how Pact composes over time.
- Compositionality and modularity: Define how Pact protocols compose (sequentially/parallelly), how utilities compose, and how interference between sub-protocols is prevented; provide compositional proofs.
- Expressiveness and typing: Specify type systems for choices, utilities, and nature variables; support recursion/loops and rich data types while maintaining analyzability; add static checks for missing value declarations or ill-posed games.
- Interoperability with existing choreographic stacks: Describe how Pact integrates with systems like HasChor/Choral; ensure semantics-preserving compilation and compatibility with existing runtimes.
- Learning utilities/priors from data: Integrate data-driven inference (e.g., revealed-preference, Bayesian updating, RL) into Pact analyses; benchmark identifiability and sample efficiency.
- Fairness and social welfare: Add constructs and analyses for fairness, welfare, and distributional impacts; enable trade-off exploration between individual rationality and group objectives.
- Verification and debugging tools: Provide property specification (e.g., hyperproperties, equilibrium existence, leakage bounds), model checking/SMT backends, and counterexample generation for Pact protocols.
- Empirical evaluation at scale: Move beyond toy “bookseller” examples to evaluate Pact in realistic settings (e.g., WebArena, OSWorld, SWE-bench); report performance, robustness, and alignment with predicted equilibria.
- Negotiation meta-protocols: Formalize how agents propose, critique, and converge on Pact protocols (the “protocol for proposing protocols”); analyze convergence, manipulation risks, and meta-level incentives.
Practical Applications
Immediate Applications
Below are deployable applications that can be built with the current Pact prototype (Python DSL with algebraic effects) and the bounded‑rational decision policy solver based on theory‑of‑mind (ToM) models.
- Bold title: Protocol design, simulation, and auditing for agent marketplaces
- Sectors: software, e‑commerce, platforms, finance (pricing/auctions)
- What it does: Use Pact to specify multi‑party protocols with explicit choices, utilities, and priors; run the solver to compute decision policies, stress‑test incentives, and check whether participation is rational for each party.
- Tools/products/workflows:
- Protocol template library (e.g., buyer–seller, posted‑price, sealed‑bid variants)
- “Simulate and audit” CI step that runs ToM inference across priors/utility assumptions
- Endpoint projection to generate local agents/services that are deadlock‑free by construction
- Assumptions/dependencies: Utilities and priors must be elicited/estimated; solver scales to the number of agents/branches used; participants are cooperative at execution time (no on‑chain/TEE enforcement yet).
- Bold title: Hardening LLM agent workflows against manipulation via formal protocols
- Sectors: software security, AI ops
- What it does: Convert free‑form agent prompts/workflows into Pact protocols to (a) isolate untrusted inputs as messages, (b) expose strategic decision points, and (c) analyze where incentives enable sycophancy or prompt‑injection‑amplified behavior.
- Tools/products/workflows:
- Guardrails that require agent tasks to be expressed as Pact
- A policy checker that rejects protocols with unsafe incentive structures or ambiguous branching
- Integration with Rule‑of‑Two–style deployment checklists
- Assumptions/dependencies: Teams adopt Pact as a control surface; mapping from existing prompt chains to protocols is faithful; threat models are explicit; still relies on runtime containment for adversaries.
- Bold title: Enterprise procurement and sales negotiation assistants
- Sectors: enterprise SaaS, procurement, B2B sales
- What it does: Encode negotiation protocols (e.g., pricing, volume discounts, SLAs) in Pact; run bounded‑rational analysis to set price/acceptance thresholds that account for counterpart behavior and information asymmetry.
- Tools/products/workflows:
- CRM plugin that proposes “deal policies” derived from Pact solver outputs
- Playbooks for buyer/seller agents that auto‑generate concession strategies
- Assumptions/dependencies: Accurate modeling of counterpart utilities (learned or estimated); human override remains in the loop; legal review for contract alignment.
- Bold title: Incentive‑aware crowdsourcing and evaluation tasks
- Sectors: data labeling, evaluation platforms, market research
- What it does: Specify payment/verification protocols that penalize collusion and sycophancy; analyze expected worker strategies under different payment rules; choose designs that maximize truthful effort.
- Tools/products/workflows:
- Payment mechanism A/B testing via Pact simulations
- Worker client endpoints generated from endpoint projections
- Assumptions/dependencies: Worker utilities (effort vs. reward) are approximated; bounded‑rational solver captures realistic behavior; platform compliance and fairness constraints are satisfied.
- Bold title: Policy and regulatory sandboxes for market design
- Sectors: public policy, regulators, platform governance
- What it does: Prototype and simulate market rules, disclosures, and information structures (e.g., in ad auctions, gig marketplaces) and evaluate outcomes like entry, fairness, and “market for lemons” dynamics before deployment.
- Tools/products/workflows:
- Sandbox toolkit to run sensitivity analyses over priors and disclosure policies
- Reporting dashboards for outcome distributions (prices, welfare, acceptance rates)
- Assumptions/dependencies: Access to representative priors/utility estimates; models remain small enough for tractable inference; not a substitute for field trials.
- Bold title: Interoperability and conformance testing for agent ecosystems
- Sectors: software tooling, agent frameworks
- What it does: Use Pact as a formal spec to generate endpoint tests across frameworks (e.g., LangChain, AutoGen) ensuring message compatibility and deadlock‑freedom; verify that agents follow specified decision points.
- Tools/products/workflows:
- Conformance test suite from endpoint projections
- Stubs/mocks for “world” priors to reproduce edge cases
- Integrations with WebArena/OSWorld for task‑level evaluation
- Assumptions/dependencies: Adapters for popular frameworks; consistent treatment of “nature” variables; observability into agent decisions.
- Bold title: Research and education in game‑theoretic PL and ToM
- Sectors: academia, education
- What it does: Teach and experiment with formal games embedded in protocols; reproduce phenomena (e.g., Akerlof’s lemons) using Pact‑to‑ToM pipelines; benchmark ToM depth effects on equilibria.
- Tools/products/workflows:
- Course labs using the Pact DSL and memo‑style ToM programs
- Reusable examples (bookseller, auctions, signaling games)
- Assumptions/dependencies: Stable open‑source packages; small models for classroom compute budgets.
- Bold title: Internal multi‑agent orchestration with cost/latency tradeoffs
- Sectors: MLOps, cloud ops
- What it does: Encode coordination among internal agents/services where components “value” latency, cost, and accuracy; compute decision rules (e.g., when to call expensive models).
- Tools/products/workflows:
- Pact‑backed policy layer for tool selection and fallback routing
- Continuous simulation against changing cost/latency priors
- Assumptions/dependencies: Reliable telemetry for utility calibration; stable interfaces across tools/services.
Long-Term Applications
These require further semantics, scaling, enforcement, or domain integration beyond the current prototype.
- Bold title: Verified incentive compatibility and equilibrium computation
- Sectors: market design, platforms, finance
- What it could do: Extend Pact analyses to compute equilibria (e.g., BNE) and check incentive compatibility, individual rationality, and collusion resistance formally.
- Tools/products/workflows:
- Equilibrium solvers integrated with Pact
- Certificates and reports attached to protocol releases
- Assumptions/dependencies: Formal semantics and correctness proofs; scalable inference for larger games; richer utility models.
- Bold title: Automatic mechanism design via program synthesis
- Sectors: market design, ad tech, marketplaces
- What it could do: Synthesize protocol variants (messaging, pricing, allocation rules) from objectives (e.g., welfare, revenue, fairness) and constraints, then verify properties before deployment.
- Tools/products/workflows:
- “Mechanism synthesizer” that searches the Pact space
- Multi‑objective optimization with human‑in‑the‑loop review
- Assumptions/dependencies: Search/inference scalability; robust objective specification; guardrails to prevent pathological mechanisms.
- Bold title: Cryptographically enforced choreographies
- Sectors: privacy tech, finance (DeFi), data markets
- What it could do: Combine Pact with TEEs/SMPC/zero‑knowledge to enforce protocol steps, privacy, and transfers; prevent deviations by untrusted agents.
- Tools/products/workflows:
- Pact‑to‑TEE/SMPC backends for sensitive steps
- Attestation‑aware endpoint projections; ZK proofs for compliance
- Assumptions/dependencies: Practical performance of cryptographic substrates; secure keying and attestation; new runtime support.
- Bold title: On‑chain or hybrid Pact execution for digital contracts
- Sectors: fintech, DeFi, supply chain
- What it could do: Compile Pact protocols to smart contracts or hybrid off‑chain/on‑chain agents for auctions, escrow, and dynamic pricing with formal incentives.
- Tools/products/workflows:
- Pact‑to‑EVM/CosmWasm compilers and oracle bridges
- Audit pipelines that check game‑theoretic properties pre‑deploy
- Assumptions/dependencies: Gas/latency constraints; oracle trust; regulatory clarity.
- Bold title: Healthcare and energy market coordination with strategic agents
- Sectors: healthcare (payer‑provider contracts, scheduling), energy (demand response)
- What it could do: Model and deploy protocols that align incentives across hospitals, payers, and patients, or among grid operators, aggregators, and consumers.
- Tools/products/workflows:
- Pact templates for reimbursement schemes or DR programs
- Simulation sandboxes for policy impact and fairness
- Assumptions/dependencies: Regulatory approvals; robust privacy guarantees; validated utility/prior models; stakeholder acceptance.
- Bold title: Multi‑robot and cyber‑physical coordination under self‑interest
- Sectors: robotics, logistics, autonomous mobility
- What it could do: Use Pact to specify coordination where agents have local objectives (battery, deadlines, wear‑and‑tear) and negotiate tasks/routes.
- Tools/products/workflows:
- Pact‑based task allocation and auction protocols
- Real‑time policy updates with embedded ToM approximations
- Assumptions/dependencies: Real‑time inference and communication guarantees; safety certification; adversarial robustness.
- Bold title: Continuous safety monitoring via deviation‑from‑policy analytics
- Sectors: AI safety, compliance
- What it could do: Monitor live agent ecosystems for deviations from predicted equilibrium policies as early indicators of manipulation, collusion, or systemic shifts.
- Tools/products/workflows:
- “Policy drift” detectors comparing observed to Pact‑predicted actions
- Incident response playbooks triggered by anomaly thresholds
- Assumptions/dependencies: High‑fidelity logging; stable baseline policies; low false‑positive rates.
- Bold title: Legal–computational alignment for automated contracting
- Sectors: legal tech, enterprise procurement
- What it could do: Map Pact protocols to human‑readable clauses and back; ensure that the executable protocol and the contract’s natural‑language terms align and are enforceable.
- Tools/products/workflows:
- Bidirectional spec tools (Pact ↔ clause libraries)
- Compliance checkers for jurisdictional constraints
- Assumptions/dependencies: Mature semantics; standardization and industry adoption; interdisciplinary validation.
- Bold title: Open standards for agent protocol interoperability
- Sectors: standards bodies, platform ecosystems
- What it could do: Establish Pact (or Pact‑like) specifications as a standard for multi‑agent protocol definition, verification, and conformance testing across vendors.
- Tools/products/workflows:
- Reference implementations and conformance suites
- Registries of certified protocol templates
- Assumptions/dependencies: Community buy‑in; governance for versioning and security advisories.
Cross‑cutting assumptions and dependencies (affecting most applications)
- Utility elicitation and priors: Accuracy of results depends on realistic models of agent utilities and beliefs; mechanisms for learning/estimating them may be required.
- Bounded‑rational solver scalability: Current ToM‑based solver is preliminary; many‑agent/long‑horizon games will need approximate or distributed inference.
- Enforcement: Endpoint projection guarantees deadlock‑freedom, not truthful behavior; cryptographic or economic enforcement is needed for adversarial settings.
- Formal semantics and proofs: The paper notes semantics and correctness proofs are in progress; some high‑assurance use cases require these to be complete.
- Integration: Requires adapters to popular agent frameworks and observability into agent decisions/messages.
- Privacy and compliance: Sensitive domains (healthcare/finance) require privacy‑preserving execution and regulatory approvals.
Glossary
- adversarial settings: Contexts where some participants may try to subvert or deviate from a protocol. "extending them towards adversarial settings where participants may not be trusted to execute faithfully"
- agentic: Pertaining to autonomous agents that act according to their own goals and preferences. "agentic interactions"
- algebraic effects: A programming abstraction for modeling and handling computational effects in a structured, composable way. "algebraic effects to implement endpoint projection"
- bounded-rational solver: A solver that computes strategies under limited-depth or resource-bounded reasoning rather than full rationality. "a bounded-rational solver that computes decision policies"
- choreographic programming: A programming paradigm that specifies global interaction protocols among distributed processes, from which correct local behaviors are derived. "Choreographic programming offers correct-by-construction protocol-design"
- correct-by-construction: A design approach ensuring certain correctness properties (e.g., safety, liveness) by the very construction of programs or protocols. "correct-by-construction"
- deadlock-free: A property ensuring that processes will not end up waiting indefinitely for each other. "guaranteed to be deadlock-free"
- decision policy: A mapping from observations or beliefs to actions within a protocol or game. "a decision policy solver"
- endpoint projection: The compilation or projection of a global choreography into local programs for each participant. "endpoint projection to local programs"
- equilibrium computation: The process of computing strategic equilibria (e.g., Nash equilibria) of games. "equilibrium computation"
- exogenous variable: A variable set by external factors outside the control of the agents in the protocol. "modelled as an exogenous variable"
- formal game: A mathematically specified model with players, strategies, and payoffs used to analyze strategic interactions. "maps unambiguously to a formal game"
- game-theoretic: Relating to the analysis of strategic interactions using game theory. "game-theoretic properties"
- generative model: A probabilistic model that simulates how data or observations are produced, enabling inference. "a generative model of the interaction"
- incentive compatibility: A property of mechanisms or protocols where participants’ best interests align with truthful or desired behavior. "incentive compatibility checking"
- information asymmetry: A situation where different parties have unequal knowledge about relevant aspects of a transaction or interaction. "information asymmetry"
- Market for Lemons: An economic phenomenon where quality uncertainty and asymmetric information degrade market outcomes. "Market for Lemons"
- mechanism design: The field of designing rules of a game or protocol to achieve desired outcomes given agents’ incentives. "automatic mechanism design"
- memo programming language: A domain-specific language for expressing theory-of-mind and recursive probabilistic models with efficient inference. "the memo programming language"
- nature variables: Declarations in Pact representing factors determined by the world rather than by agents, used to encode priors. "nature variables"
- non-deterministic choices: Choices left unspecified by the program semantics, representing strategic or uncertain decisions. "we model these as non-deterministic choices"
- priors: Probabilistic beliefs about variables or states before incorporating new observations. "priors over the world"
- probabilistic programmes: Programs that incorporate randomness and probability distributions, enabling statistical inference. "recursive probabilistic programmes"
- prompt injection: An attack where adversarial inputs manipulate an LLM’s behavior by altering or hijacking its prompts. "prompt injection attacks"
- sycophantic behaviour: Undue deference or flattery by an AI agent that can undermine rational decision-making. "sycophantic behaviour"
- theory of mind: Modeling others’ beliefs, desires, and reasoning processes to predict their actions. "theory-of-mind models"
- utility function: A numerical representation of an agent’s preferences over outcomes used to evaluate decisions. "utility functions over outcomes"
Collections
Sign up for free to add this paper to one or more collections.