"How do different personality traits affect cooperation and information sharing between language agents, and what impact does this have on their collective ability to survive crises?"
The Council of Realms is a multi-agent simulation that models interactions between kingdom agents with different personality traits as they face a series of crises. Each kingdom, represented by a language agent with distinct personality traits (cooperation, honesty, and risk tolerance), must communicate, share information, propose solutions, and vote on collective actions to survive. By comparing different personality configurations, the project analyzes how traits influence cooperation, information sharing, and collective outcomes in crisis scenarios.
Three distinct personality configurations are tested with identical event sequences:
- Cooperative: All kingdoms have high cooperation and honesty
- Competitive: All kingdoms have low cooperation and honesty
- Mixed: Half cooperative, half competitive kingdoms
Multi-agent systems (MAS) are computational systems where multiple autonomous agents interact within an environment. These systems have been studied extensively in artificial intelligence research to model complex social phenomena, coordination problems, and emergent behaviors. Agents in these systems are characterized by autonomy, social ability, reactivity, and proactiveness.
In our project, we draw on MAS principles to create a simulation where kingdom agents exhibit these characteristics through their decision-making processes and interactions.
Research on personality traits in agent design has shown that incorporating human-like personality dimensions can lead to more realistic and diverse agent behaviors. The Big Five personality model (openness, conscientiousness, extraversion, agreeableness, and neuroticism) has been widely used in agent-based modeling.
Our project focuses on three specific traits relevant to cooperation and information sharing:
- Cooperation: Willingness to work with others and prioritize group goals
- Honesty: Tendency to share truthful information
- Risk Tolerance: Willingness to take chances in uncertain situations
Recent advances in large language models (LLMs) have enabled the creation of sophisticated language agents capable of complex interactions and decision-making. These models can be prompted to take on specific roles, personalities, and objectives, making them ideal for simulating autonomous agents with distinct characteristics.
Research has demonstrated that LLMs can be effective in multi-agent simulations by generating rich, contextual responses that incorporate reasoning about other agents' intentions and beliefs. Our project builds on this work by using LLMs (specifically Google's Gemini model) to simulate kingdom rulers with distinct personalities.
Cooperation and information sharing have been studied extensively in both human groups and artificial systems. The evolution of cooperation research has shown how cooperative strategies can emerge even in competitive environments. In artificial systems, researchers have explored how different incentive structures and communication protocols affect cooperation levels.
Our project contributes to this research by examining how personality traits influence cooperation and information sharing in a crisis management scenario, where resources are limited and decisions have significant consequences.
The environment in Council of Realms is a simulated council where kingdoms interact while facing a series of crises. Each kingdom has four types of resources (food, gold, military, and knowledge) that fluctuate in response to events and decisions. The simulation unfolds over multiple rounds, with each round consisting of several phases:
- Event Phase: A crisis or opportunity affects all kingdoms
- Communication Phase: Kingdoms share information and intentions
- Proposal Phase: Kingdoms suggest collective actions
- Voting Phase: Kingdoms vote on proposals
- Resolution Phase: Approved proposals are implemented
- Resource Decay: Resources naturally diminish over time
Events in the environment can be cooperative (affecting all kingdoms similarly) or competitive (creating zero-sum scenarios where kingdoms must compete).
Each kingdom is represented by an autonomous agent with the following components:
Agents are defined by three key personality traits:
- Cooperation (0.0-1.0): Higher values indicate greater willingness to help other kingdoms
- Honesty (0.0-1.0): Higher values lead to more truthful information sharing
- Risk Tolerance (0.0-1.0): Higher values indicate greater willingness to take chances
Each kingdom manages four resource types:
- Food: Essential for survival
- Gold: Currency for trade and development
- Military: Defense and competition capability
- Knowledge: Innovation and problem-solving
Agents make decisions through a language model (Gemini) that receives prompts incorporating:
- Current resource levels
- Personality traits
- Current situation (events)
- Recent history (messages from other kingdoms)
The model generates structured outputs for messages, proposals, and votes, with the content influenced by the agent's personality traits.
Kingdoms interact through three main mechanisms:
Agents can send messages to specific kingdoms or to all kingdoms. The truthfulness and amount of information shared is influenced by the agent's honesty and cooperation traits.
Agents can propose resource transfers or collective actions. The nature of proposals is influenced by the agent's cooperation (selfish vs. altruistic) and risk tolerance (conservative vs. ambitious).
Agents vote on proposals based on their perceived benefit, with cooperative agents more likely to support proposals that benefit the group even at personal cost.
The simulation is implemented in Python, with the following key technologies:
- Language Model: Google's Gemini 2.0 Flash via the
langchain_google_genaiAPI - Data Structures: Custom classes for kingdoms, proposals, and messages
- Data Analysis: NumPy and Pandas for statistical analysis
- Visualization: Matplotlib for generating charts and graphs
The project requires the following Python packages:
- langchain-google-genai (v0.0.6+)
- pydantic (v2.0.0+)
- matplotlib (v3.5.0+)
- numpy (v1.20.0+)
- pandas (v1.4.0+)
A complete list with exact versions can be found in requirements.txt.
The codebase is organized into modules within the app directory:
council-of-realms/
│
├── app/ # Application code
│ ├── kingdom.py # Kingdom class and resource management
│ ├── models.py # Pydantic models for structured outputs
│ ├── config.py # Configuration loading and initialization
│ ├── llm_interface.py # LLM interaction and response handling
│ ├── events.py # Event handling and resource changes
│ ├── communication.py # Kingdom communication mechanics
│ ├── proposals.py # Proposal and voting systems
│ ├── analysis.py # Simulation outcome analysis
│ ├── visualization.py # Data visualization
│ ├── simulation.py # Core simulation controller
│ └── main.py # Main application entry point
│
├── inputs/ # Input configuration files
│ ├── cooperative.json # Configuration for cooperative kingdoms
│ ├── competitive.json # Configuration for competitive kingdoms
│ ├── mixed.json # Configuration for mixed personalities
│ └── events.json # Sequence of events for the simulation
│
├── output/ # Generated output files (created at runtime)
│ ├── cooperative/ # Results from cooperative configuration
│ ├── competitive/ # Results from competitive configuration
│ ├── mixed/ # Results from mixed configuration
│ └── comparison/ # Comparative analysis across configurations
│
├── requirements.txt # Project dependencies
└── README.md # Project documentation
-
Python 3.8+ required
-
Set up a virtual environment and install dependencies:
# Create virtual environment python -m venv venv # Activate virtual environment # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate # Install dependencies pip install -r requirements.txt
-
Configure API access:
- Create a Google API key with access to Gemini models
- Set your API key directly in the
app/llm_interface.pyfile:# Replace with your actual API key GOOGLE_API_KEY = "your_api_key_here"
-
Run the simulation:
python -m app.main
One significant challenge was reliably parsing structured outputs (JSON) from the language model. We implemented robust error handling and fallback responses to ensure that even if the LLM generated malformed output, the simulation could continue.
Implementing personality traits that meaningfully influence agent behavior required careful prompt engineering. We created detailed guidelines within prompts that instructed the LLM how to behave based on different personality trait values.
Balancing the resource economy was challenging, as we needed to ensure that kingdoms could survive but would face genuine resource pressures that required cooperation. We implemented a resource decay system that gradually increased pressure over time.
The current implementation allows for hardcoding the Google API key in the llm_interface.py file. For production environments, this should be replaced with environment variables or a secure configuration system to prevent credentials from being exposed in source code.
To answer our research question, we implemented three experimental conditions:
- Cooperative Configuration: All kingdoms have high cooperation (0.75-0.9) and honesty (0.7-0.85)
- Competitive Configuration: All kingdoms have low cooperation (0.2-0.35) and honesty (0.2-0.35)
- Mixed Configuration: Two kingdoms have high cooperation/honesty, and two have low cooperation/honesty
We ran each configuration through the same sequence of 10 events, with multiple simulations to account for variability. Each simulation recorded:
- Kingdom survival rates
- Resource levels over time
- Information sharing metrics
- Proposal success rates
- Message truthfulness
For each simulation run, we collected the following data:
- Kingdom States: Resource levels and survival status after each round
- Messages: Content, recipients, truthfulness, and information shared
- Proposals: Content, voting outcomes, and resource transfers
- Final Outcomes: Survival rounds, final resources, and overall metrics
We used several analytical approaches:
- Survival Analysis: Comparing how long kingdoms survived across configurations
- Correlation Analysis: Examining relationships between personality traits and outcomes
- Resource Trajectory Analysis: Tracking resource changes over time
- Information Sharing Analysis: Measuring truthfulness and information shared
- Proposal Success Analysis: Evaluating cooperation through proposal outcomes
The simulation generates detailed visualizations and data outputs in the output directory:
-
Individual configuration results (
output/cooperative/,output/competitive/,output/mixed/):kingdom_survival_resources.png: Shows survival duration and final resourcesresource_timeline.png: Tracks resource changes over timeinformation_analysis.png: Analyzes truthfulness and information sharingproposal_analysis.png: Shows proposal success rates
-
Comparative analysis (
output/comparison/):survival_comparison.png: Compares survival across configurationsinformation_comparison.png: Compares information sharing metricsresource_comparison.png: Compares final resource totalsproposal_success_comparison.png: Compares proposal success ratessummary_report.md: Comprehensive findings report
Analysis of kingdom survival across configurations revealed:
- Cooperative Configuration: Higher overall survival rates, with an average of [X.X] rounds survived per kingdom
- Competitive Configuration: Lower survival rates, with an average of [X.X] rounds survived per kingdom
- Mixed Configuration: Intermediate survival rates, with an average of [X.X] rounds survived per kingdom
The survival comparison charts can be found in the output/comparison directory as survival_comparison.png. Individual configuration survival charts are located in their respective directories (e.g., output/cooperative/kingdom_survival_resources.png).
The data shows a positive correlation (r=[X.XX]) between cooperation levels and survival duration.
Note: Replace the [X.X] placeholders with actual values after running your experiments.
Information sharing behavior varied significantly between configurations:
- Cooperative Configuration: High truthfulness (avg [X.XX]) and information sharing (avg [X.XX])
- Competitive Configuration: Low truthfulness (avg [X.XX]) and information sharing (avg [X.XX])
- Mixed Configuration: Mixed results, with cooperative kingdoms maintaining high truthfulness even in a mixed environment
Information sharing metrics are visualized in charts located in the output/comparison directory as information_comparison.png. Detailed information sharing analysis for each configuration can be found in their respective output directories as information_analysis.png files.
The correlation between honesty trait values and actual truthfulness in messages was strong (r=[X.XX]), indicating that the personality traits effectively influenced communication behavior.
Resource distribution patterns differed across configurations:
- Cooperative Configuration: More equal resource distribution, with kingdoms helping those in need
- Competitive Configuration: Greater resource disparities, with strong kingdoms getting stronger
- Mixed Configuration: Cooperative kingdoms often ended with fewer resources than competitive kingdoms
Resource timeline charts showing the distribution of resources over time can be found in each configuration's output directory as resource_timeline.png. A comparative analysis of final resource totals across configurations is available in output/comparison/resource_comparison.png.
Proposal creation and voting showed clear patterns:
- Cooperative Configuration: More proposals created ([X.X] per kingdom) with higher success rates ([X]%)
- Competitive Configuration: Fewer proposals ([X.X] per kingdom) with lower success rates ([X]%)
- Mixed Configuration: Competitive kingdoms proposed self-serving measures that often failed
Proposal success metrics are visualized in each configuration's output directory as proposal_analysis.png. A comparison of proposal success rates across configurations can be found in output/comparison/proposal_success_comparison.png.
Different configurations showed distinct patterns in crisis response:
- Cooperative Configuration: Kingdoms pooled resources to address crises collectively
- Competitive Configuration: Kingdoms focused on individual survival, leading to higher overall losses
- Mixed Configuration: Cooperative kingdoms often shouldered more of the burden in crisis response
Our results show that personality traits significantly influence cooperation levels. High cooperation and honesty traits led to more collaborative behaviors, including resource sharing, truthful communication, and support for group-beneficial proposals.
The strong correlation (r=[X.XX]) between cooperation trait values and proposal success rates suggests that cooperative personalities create a virtuous cycle: kingdoms propose more equitable solutions, other cooperative kingdoms support them, and the resulting actions benefit the group as a whole.
Honesty traits proved to be strong predictors of truthful communication. In the cooperative configuration, high honesty led to an environment of trust where kingdoms shared accurate information about their resources and needs. This facilitated better decision-making and resource allocation.
In contrast, the competitive configuration showed a "race to the bottom" in truthfulness, with kingdoms exaggerating their needs or downplaying their strengths to manipulate others.
An interesting finding was the relationship between individual and collective success:
- In the cooperative configuration, the group as a whole performed better (higher average survival), but individual resource accumulation was moderate.
- In the competitive configuration, overall survival was lower, but successful kingdoms accumulated more resources.
- In the mixed configuration, competitive kingdoms often exploited cooperative ones, gaining resource advantages while benefiting from the stabilizing effects of cooperative kingdoms.
This highlights a classic tension in cooperation scenarios: cooperative strategies benefit the group but may leave individuals vulnerable to exploitation.
Several emergent behaviors were observed:
- Resource Specialization: In cooperative configurations, kingdoms sometimes specialized in different resources and traded accordingly.
- Coalition Formation: In mixed configurations, kingdoms with similar traits tended to support each other's proposals.
- Crisis Leadership: Kingdoms with high cooperation often took leadership roles during crises, proposing solutions that benefited struggling kingdoms.
Our study has several limitations:
- Simplicity of Personality Model: Our three-trait model is a simplification of real personality dimensions.
- LLM Variability: The language model sometimes produced inconsistent behaviors despite identical trait values.
- Limited Crisis Types: Our event set covered only a subset of possible crisis scenarios.
- Small Agent Population: With only four kingdoms, some dynamics of larger groups may not be observable.
This project has demonstrated that:
- Personality traits significantly influence cooperation and information sharing in multi-agent systems
- Cooperative configurations lead to better collective outcomes in crisis scenarios
- Mixed environments create complex dynamics where cooperative and competitive strategies interact
- The truthfulness of information sharing correlates strongly with collective success
These findings have potential applications in:
- Multi-agent AI Systems: Designing cooperative agent personalities for collaborative tasks
- Crisis Management Simulations: Training decision-makers for real-world crisis response
- Economic and Social Policy: Understanding how individual traits influence collective outcomes
- Game Design: Creating more realistic and diverse NPC behaviors
Several directions for future work are promising:
- Expanded Personality Models: Incorporating more personality dimensions
- Learning and Adaptation: Allowing kingdoms to adapt their traits based on experiences
- Complex Communication: Adding negotiation, deception detection, and persuasion mechanics
- Larger Population Sizes: Exploring dynamics with more agents and faction formation
- Resource Network Effects: Implementing more complex resource interdependencies
The modular design of the Council of Realms allows for several extensions:
- Custom Events: Create new events by editing the
inputs/events.jsonfile - New Personality Traits: Extend the personality model in
app/kingdom.pywith additional traits - Alternative LLMs: Replace the Gemini model with other LLMs by modifying the
app/llm_interface.pymodule - Custom Visualizations: Add new analysis visualizations in
app/visualization.py
The Council of Realms project demonstrates the value of language agent simulations for exploring social dynamics and collective behavior. By varying personality traits and observing the resulting patterns of cooperation, information sharing, and survival, we gain insights into how individual characteristics influence group outcomes in crisis scenarios.