Live
Black Hat USADark ReadingBlack Hat AsiaAI BusinessAI shutdown controls may not work as expected, new study suggests - ComputerworldGoogle News: Generative AIOpenAI Advocates Electric Grid, Safety Net Spending for New AI EraBloomberg Technology27 questions to ask when choosing an LLM - InfoWorldGoogle News: LLMJapan, driven by labor shortages, is increasingly adopting robotics and physical AI, with a hybrid model where startups innovate and corporations provide scale (Kate Park/TechCrunch)TechmemeAnthropic tells OpenClaw users to pay up - The Rundown AIGoogle News: ClaudeANALYSIS: Q1 IPOs ‘Forge’ Ahead as OpenAI, SpaceX Look to Debuts - Bloomberg Law NewsGoogle News: OpenAINew track in artificial intelligence added to Arkansas Tech University curriculum - River Valley Democrat-GazetteGoogle News: AIDeepMind Calls for New Safeguards Against AI Agent Exploitation - The420.inGoogle News: DeepMindChatGPT web service hit by brief disruption, OpenAI investigates - news.cgtn.comGoogle News: ChatGPTAgile Robots and Google DeepMind Partner on AI-Driven Industrial Robotics - ARC AdvisoryGoogle News: DeepMind40 Days of Building HarshAI: What I Learned About AI AutomationDEV CommunityMoving fast with agents without losing comprehensionDEV CommunityBlack Hat USADark ReadingBlack Hat AsiaAI BusinessAI shutdown controls may not work as expected, new study suggests - ComputerworldGoogle News: Generative AIOpenAI Advocates Electric Grid, Safety Net Spending for New AI EraBloomberg Technology27 questions to ask when choosing an LLM - InfoWorldGoogle News: LLMJapan, driven by labor shortages, is increasingly adopting robotics and physical AI, with a hybrid model where startups innovate and corporations provide scale (Kate Park/TechCrunch)TechmemeAnthropic tells OpenClaw users to pay up - The Rundown AIGoogle News: ClaudeANALYSIS: Q1 IPOs ‘Forge’ Ahead as OpenAI, SpaceX Look to Debuts - Bloomberg Law NewsGoogle News: OpenAINew track in artificial intelligence added to Arkansas Tech University curriculum - River Valley Democrat-GazetteGoogle News: AIDeepMind Calls for New Safeguards Against AI Agent Exploitation - The420.inGoogle News: DeepMindChatGPT web service hit by brief disruption, OpenAI investigates - news.cgtn.comGoogle News: ChatGPTAgile Robots and Google DeepMind Partner on AI-Driven Industrial Robotics - ARC AdvisoryGoogle News: DeepMind40 Days of Building HarshAI: What I Learned About AI AutomationDEV CommunityMoving fast with agents without losing comprehensionDEV Community
AI NEWS HUBbyEIGENVECTOREigenvector

How I Built a Multi-Agent Geopolitical Simulator with FastAPI + LiteLLM

Dev.to AIby KaihuaHuangApril 5, 20263 min read1 views
Source Quiz

What happens when you give four LLM agents their own strategic doctrines, red lines, and constraints — then throw them into a geopolitical crisis? I built Strait of Hormuz Simulator to find out. It's a multi-agent sandbox where four nations (Iran, US, Israel, Gulf States) are each controlled by an independent LLM, and the results are surprisingly realistic. The Architecture Each country is a markdown file (a "soul") that defines its strategic doctrine and default parameters: backend/souls/ ├── iran.md # Asymmetric warfare, Strait control ├── us.md # Three bad options, escalation management ├── israel.md # Nuclear red line, preemptive calculus └── gulf_states.md # Oil leverage, diplomatic survival The backend runs each agent sequentially — every round, each nation receives: A shared situati

What happens when you give four LLM agents their own strategic doctrines, red lines, and constraints — then throw them into a geopolitical crisis?

I built Strait of Hormuz Simulator to find out. It's a multi-agent sandbox where four nations (Iran, US, Israel, Gulf States) are each controlled by an independent LLM, and the results are surprisingly realistic.

The Architecture

Each country is a markdown file (a "soul") that defines its strategic doctrine and default parameters:

backend/souls/ ├── iran.md # Asymmetric warfare, Strait control ├── us.md # Three bad options, escalation management ├── israel.md # Nuclear red line, preemptive calculus └── gulf_states.md # Oil leverage, diplomatic survival

Enter fullscreen mode

Exit fullscreen mode

The backend runs each agent sequentially — every round, each nation receives:

  • A shared situation briefing

  • Its own doctrine (system prompt)

  • Rolling memory of prior rounds

  • Active scenario modifiers

Then it decides what to do. No script. No predetermined outcomes.

Why LiteLLM?

I wanted users to bring their own API key and pick any model. LiteLLM gave me a unified interface across GPT-4o, Claude, Gemini, and DeepSeek with zero provider-specific code. One litellm.completion() call handles all of them.

The Chaos Slider

A single float (0-1) injected into every agent's prompt:

  • Low chaos → agents seek diplomatic exits

  • High chaos → bold moves, miscommunication, escalation spirals

Emergent Behavior That Surprised Me

In one run, Israel independently chose not to strike Iranian nuclear facilities — reasoning that US strikes made unilateral action diplomatically counterproductive. Nobody programmed that.

Gulf States withheld spare oil capacity to extract security guarantees, creating price feedback loops the oil market agent had to price in real-time.

The Oil Market Agent

A separate LLM agent watches all military and diplomatic actions, then sets the oil price. Blockade the Strait? Price spikes. Ceasefire talks? Price dips. It adds a layer of economic consequences that feeds back into each nation's decision-making.

Scenario Tags

11 toggleable modifiers that inject additional context:

  • 🚀 Nuclear Brinkmanship

  • 🏴‍☠️ Houthi Wildcard

  • 🇨🇳 China Mediator

  • 💰 Market Patience Clock

  • 🖥️ Cyber Offensive

  • ...and 6 more

Mix and match for different simulation dynamics.

Stack

  • Backend: Python 3.11, FastAPI, LiteLLM, Pydantic

  • Frontend: Vue 3, Vite, TailwindCSS, DaisyUI

  • Streaming: SSE for real-time agent output

  • Deployment: Docker + Cloudflare

Try It

  • 🎮 Play free (20 rounds on DeepSeek V3)

  • 📦 GitHub (MIT license)

Adding a new country is just creating a markdown file in backend/souls/. The system auto-discovers it on restart.

Would love feedback — especially on agent behavior and scenario design.

Was this article helpful?

Sign in to highlight and annotate this article

AI
Ask AI about this article
Powered by Eigenvector · full article context loaded
Ready

Conversation starters

Ask anything about this article…

Daily AI Digest

Get the top 5 AI stories delivered to your inbox every morning.

More about

claudegeminimodel

Knowledge Map

Knowledge Map
TopicsEntitiesSource
How I Built…claudegeminimodelproductmarketchinaDev.to AI

Connected Articles — Knowledge Graph

This article is connected to other articles through shared AI topics and tags.

Knowledge Graph100 articles · 232 connections
Scroll to zoom · drag to pan · click to open

Discussion

Sign in to join the discussion

No comments yet — be the first to share your thoughts!

More in Models