Add: climate negotiation multi-agent LLM example #453
Open
BhoomiAgrawal12 wants to merge 4 commits intomesa:mainfrom
Open
Add: climate negotiation multi-agent LLM example #453BhoomiAgrawal12 wants to merge 4 commits intomesa:mainfrom
BhoomiAgrawal12 wants to merge 4 commits intomesa:mainfrom
Conversation
e6d4d4c to
eee2e14
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new LLM example under
llm/climate_negotiation/, a multi-agent simulation of international climate treaty negotiations. Six country agents (USA, EU, China, India, Brazil, Russia), each driven by an LLM, negotiate on a shared emissions-reduction target over multiple rounds until a 2/3 majority treaty is reached.References issue #454
What makes this different from existing examples
The existing mesa-examples cover classic ABM patterns (opinion dynamic, resource competition, spatial movement). This is
llm/directory that uses LLM agents for structured multi-partynegotiation and a qualitatively different use-case where:
speak_to) and domain-specific tools rather than generic actions.The closest existing example is
deffuant_weisbuch(opinion convergence without LLMs). This model demonstrates how LLM reasoning produces qualitatively richer convergence: coalition-building, diplomatic counters, and conditional acceptance behaviours that rule-based agents cannot replicate.Mesa-LLM features demonstrated
STLTMemoryReActReasoningspeak_to(inbuilt tool)@toolfunctionsmake_proposal,accept_proposal,form_coalition,reject_and_countervision=-1DataCollectorTotalProposals,AveragePledge,LargestCoalitionSize,TreatyReachedper roundFeatures
Two LLM hallucination failure modes are explicitly guarded:
form_coalition-partner_idsare filtered against the live agent set; invalid IDs are dropped and logged asWARNING.proposer_idinaccept_proposal- the ID is validated before recording; if wrong, an error listing valid IDs is returned to the LLM for self-correction.Every agent's step prompt also includes an explicit
VALID COUNTRY IDsblock to reduce hallucination at the source.Visualisation (Solara)
Supported LLMs
Works with any LiteLLM-compatible model string. Tested with
openai/gpt-4o(best emergent behaviour),gemini/gemini-2.0-flash(default),openai/gpt-4o-mini,anthropic/claude-haiku-4-5-20251001, andollama/llama3.2.File Structure
llm/climate_negotiation/
├── app.py # Solara visualisation entry point
├── README.md
└── climate_negotiation/
├── init.py # triggers tool registration on import
├── agents.py # CountryAgent + negotiation history helper
├── tools.py # four custom @tool negotiation functions
└── model.py # ClimateNegotiationModel + countries configs
To Try
pip install mesa-llm mesa solara python-dotenv richllm/climate_negotiation/.envpython -m climate_negotiation.model- confirm rounds print and treaty is reached within ~6 rounds withgpt-4osolara run app.py- confirm all four visualisation panels render and update per round