File size: 3,307 Bytes
1794757
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
title: Trenches
emoji: ๐ŸŒ
colorFrom: red
colorTo: gray
sdk: docker
app_port: 7860
---

<img width="512" height="512" alt="Image Background Remover (1)" src="https://github.com/user-attachments/assets/a1ab0df2-435f-444b-b8a1-36b1a64b55e8" />

# Trenches

A multi-agent crisis simulator built on [OpenEnv](https://github.com/openenv-ai/openenv). LLM agents navigate a fog-of-war geopolitical scenario โ€” negotiating coalitions, managing deception, and responding to live global events โ€” while a dedicated oversight agent monitors for dangerous escalation.

## Overview

Trenches drops six LLM-powered actors into a volatile 2026 Middle East crisis. Each agent operates under partial observability with role-specific intelligence, tools, and incentives. A scalable oversight mechanism intervenes when escalation risk crosses critical thresholds.

| Agent             | Role                                            | Model    |
| ----------------- | ----------------------------------------------- | -------- |
| ๐Ÿ‡บ๐Ÿ‡ธ United States  | Hawkish superpower balancing polls & projection | Qwen3-8B |
| ๐Ÿ‡ฎ๐Ÿ‡ฑ Israel         | Regional actor with strike autonomy             | Qwen3-8B |
| ๐Ÿ‡ฎ๐Ÿ‡ท Iran           | Adversary leveraging proxies & deception        | Qwen3-8B |
| ๐Ÿช– Hezbollah      | Non-state militia with asymmetric tactics       | Qwen3-8B |
| ๐Ÿ›ข๏ธ Gulf Coalition | Economic bloc protecting oil & stability        | Qwen3-8B |
| ๐Ÿ” Oversight      | Monitors all actors, intervenes on escalation   | Qwen3-8B |

## Key Features

- **Fog of War** โ€” agents see only their role-filtered intel, never the full world state
- **Live News Injection** โ€” real-time RSS/OSINT feeds drive stochastic in-sim events
- **Scalable Oversight** โ€” Bayesian risk scoring triggers interventions before runaway escalation
- **Tool Use** โ€” agents call `query_intel`, `propose_negotiation`, `impose_sanctions`, etc.
- **Multi-component Rewards** โ€” coalition stability, escalation penalty, market impact, belief alignment

## Stack

| Layer    | Tech                                                 |
| -------- | ---------------------------------------------------- |
| Frontend | Next.js 16 ยท Tailwind v4 ยท Mapbox GL ยท Framer Motion |
| Backend  | FastAPI ยท OpenEnv Core ยท NumPy                       |
| Infra    | Docker ยท Bun ยท uv                                    |

## Quick Start

```bash
# Frontend
bun install
bun run dev          # โ†’ http://localhost:3000

# Backend
cd backend
uv sync
source .venv/bin/activate
uvicorn trenches_env.server:app --reload --port 8000
```

Set your environment variables in `.env.local`:

```
NEXT_PUBLIC_MAPBOX_TOKEN=...
NEXT_PUBLIC_API_URL=http://localhost:8000
```

## Project Structure

```
trenches/
โ”œโ”€โ”€ app/              # Next.js app router + API routes
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/   # Globe, NewsFeed, ActivityLog, ChatPanel
โ”‚   โ”œโ”€โ”€ hooks/        # React hooks
โ”‚   โ””โ”€โ”€ lib/          # Types, utils, bootstrap
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ src/          # FastAPI server, OpenEnv environment
โ”‚   โ””โ”€โ”€ tests/        # Backend test suite
โ”œโ”€โ”€ entities/         # Agent identity configs (US, Israel, Iran, etc.)
โ””โ”€โ”€ scripts/          # Utility scripts
```

## License

MIT