| | --- |
| | 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 |
| |
|