Abstract
Large Language Models (LLMs) show strong collaborative performance in multi-agent systems with predefined roles and workflows. However, in open-ended environments lacking coordination rules, agents tend to act in self-interested ways. The central challenge in achieving coordination lies in credit assignment—fairly evaluating each agent's contribution and designing pricing mechanisms that align their heterogeneous goals. This problem is critical as LLMs increasingly participate in complex human-AI collaborations, where fair compensation and accountability rely on effective pricing mechanisms. Inspired by how human societies address similar coordination challenges (e.g., through temporary collaborations such as employment or subcontracting), we propose a cooperative workflow, Shapley-Coop. Shapley-Coop integrates Shapley Chain-of-Thought—leveraging marginal contributions as a principled basis for pricing—with structured negotiation protocols for effective price matching, enabling LLM agents to coordinate through rational task-time pricing and post-task reward redistribution. This approach aligns agent incentives, fosters cooperation, and maintains autonomy. We evaluate Shapley-Coop across two multi-agent games and a software engineering simulation, demonstrating that it consistently enhances LLM agent collaboration and facilitates equitable credit assignment.
Introduction
As Large Language Models (LLMs) transition from passive assistants to autonomous agents, they are increasingly deployed in multi-agent environments. While these agents excel when assigned rigid roles (e.g., "You are the coder"), they often struggle in open-ended scenarios where goals conflict and roles are fluid. In these settings, agents frequently fall into social dilemmas: they prioritize immediate individual rewards over collective success, leading to systemic failure.
The core of this issue is credit assignment. Without a mechanism to fairly evaluate and "price" an agent's contribution—especially in support roles that don't generate direct points—self-interested agents have no incentive to cooperate. To address this, we introduce Shapley-Coop, a framework that applies game-theoretic principles to align individual incentives with group goals through structured negotiation and marginal contribution analysis.
The Shapley-Coop Framework
Shapley-Coop is built on the Shapley value, a concept from cooperative game theory that determines the fair distribution of a total reward among players based on their marginal contribution to every possible sub-group (coalition). The framework consists of three primary components:
1. Structured Negotiation Protocol
To prevent ambiguity and facilitate agreement, agents communicate using a standardized XML-style format (e.g., using <s> tags). This protocol allows agents to propose, counter-offer, or accept reward-sharing strategies, turning coordination into a formal market transaction.
2. Short-Term Shapley Chain-of-Thought (CoT)
This is a forward-looking heuristic used during task execution. Before taking an action, an agent performs a qualitative assessment: "Does my action create a positive externality (helping others) or a negative one (hindering others)?" Based on this, the agent decides whether to demand a payment for a helpful act or offer a bonus to others to ensure coordination.
3. Long-Term Shapley Chain-of-Thought (CoT)
This is a retrospective analysis performed after task completion. Agents review the entire trajectory and calculate their actual marginal contributions to the final outcome. This quantitative reasoning serves as the basis for a final, fair redistribution of rewards, ensuring that even those in non-scoring support roles are compensated fairly.
Experimental Evaluation
We evaluated Shapley-Coop across three distinct environments designed to test different facets of cooperation:
- Escape Room: A classic social dilemma where one agent must pay a cost (pulling a lever) to allow another to exit and gain a reward. Without a pricing mechanism, the lever-puller has no incentive to act.
- Raid Battle Game: A complex RPG simulation where four roles (Damage, Heal, Taunt) must defeat a boss. The reward structure is naturally skewed toward damage-dealers, creating a conflict for necessary support roles like the Taunter.
- ChatDEV: A virtual software development simulation where agents (CEO, Programmer, Reviewer) collaborate on real-world coding tasks. This tests the framework's applicability to professional workflows.
Key Insights and Results
Resolving Social Dilemmas
In the Escape Room, standard LLM negotiation often failed to reach an agreement, as agents could not quantify the value of the "sacrifice." Shapley-Coop achieved a 100% success rate, reaching a Pareto-superior outcome where rewards were split equally (4.5 units each), proving that pricing can turn a zero-sum conflict into a win-win scenario.
Valuing Support Roles
In the Raid Battle, standard models ignored the "Taunt" action because it yielded no immediate points. Shapley-Coop revealed that the marginal value of a Taunter is extremely high because they prevent team wipes. Consequently, agents began "paying" the Taunter to maintain that role. This led to significantly higher team survival rates and success in high-difficulty levels where standard models failed.
Alignment with Real-World Metrics
In ChatDEV, the rewards negotiated via Shapley-Coop closely mirrored Weighted Earned Value (WEV), a standard project management metric. For instance, the rewards assigned to the Programmer and Reviewer roles aligned almost perfectly with their actual code output and quality contributions, validating the framework's ability to perform accurate credit assignment in complex tasks.
Discussion and Limitations
Shapley-Coop demonstrates that cooperation does not require programmed altruism; it can emerge as a rational choice when agents can accurately price their contributions. However, several challenges remain:
- Computational Complexity: Calculating marginal contributions for all possible coalitions grows exponentially with the number of agents ($2^N$), limiting scalability for very large groups.
- Static vs. Dynamic Pricing: Currently, prices are largely negotiated before or after tasks. Future work is needed to allow agents to adjust prices dynamically as situational risks change (e.g., a "Heal" becoming more expensive when a teammate is near death).
- World Modeling: The accuracy of the Short-Term CoT depends on the LLM's ability to predict externalities, which remains difficult in highly stochastic or complex environments.
Conclusion
Shapley-Coop provides a principled foundation for credit assignment in multi-agent systems. By treating cooperation as a market-matching problem solved through Shapley-based reasoning, we enable self-interested agents to collaborate effectively while maintaining their autonomy. This approach is a significant step toward building fair and accountable AI societies.
Summary updated