--- title: 12 Angry Agents emoji: ⚖️ colorFrom: red colorTo: gray sdk: gradio sdk_version: 6.0.1 app_file: app.py pinned: false short_description: "Game-theoretic jury simulation with 11 autonomous AI agents" tags: - mcp-in-action-track-creative - agents - game-theory - multi-agent - mcp license: mit --- # ⚖️ 12 Angry Agents > **Can you win over a jury of autonomous AI minds?** A game-theoretic jury deliberation simulation where **11 autonomous AI agents** powered by smolagents debate criminal cases. You are the 12th juror—use strategic persuasion, evidence analysis, and psychological profiling to shift the verdict. ## 🎬 Demo Video [Watch the demo →](YOUR_VIDEO_LINK_HERE) ## 📱 Social Post [See our launch post →](YOUR_SOCIAL_LINK_HERE) --- ## 🎮 How It Works 1. **Case Loading** — Criminal cases loaded from structured YAML with evidence, witnesses, and defendant info 2. **Side Selection** — Choose PROSECUTE (guilty) or DEFEND (not guilty) 3. **Strategic Argumentation** — Use different argument types (logical, emotional, evidence-based, moral, narrative) 4. **Autonomous Deliberation** — AI jurors reason independently using tools to query evidence 5. **Conviction Dynamics** — Game-theoretic conviction scores shift based on archetype vulnerabilities 6. **Verdict** — Unanimous decision required, just like a real jury --- ## 🤖 Autonomous Agent Architecture ### Multi-Agent System Each of the 11 AI jurors is a **fully autonomous smolagents CodeAgent** that: - **Plans** their argumentative strategy based on personality archetype - **Reasons** through evidence using chain-of-thought - **Executes** tool calls to query the case semantically - **Adapts** conviction based on persuasion mechanics ### MCP Integration The Gradio app runs as an **MCP server**, exposing tools for external AI agents to: - Join as a juror (`mcp_join_as_juror`) - Make arguments (`mcp_make_argument`) - Query case evidence (`mcp_query_evidence`) - Check game state (`mcp_get_state`) ```python # MCP server enabled demo.launch(mcp_server=True) ``` --- ## 🎯 Game Theory & Persuasion Mechanics ### Archetype System Each juror has a unique **archetype** that determines their persuasion vulnerabilities: | Archetype | Susceptible To | Resistant To | |-----------|---------------|--------------| | Rationalist | Logical, Evidence | Emotional | | Empath | Emotional, Narrative | Cold logic | | Cynic | Evidence, Questions | Appeals to authority | | Conformist | Majority opinion | Minority arguments | | Contrarian | Minority position | Consensus | | Moralist | Moral arguments | Pragmatic | | Detail-Obsessed | Specific evidence | Broad narratives | ### Conviction Dynamics - **Score Range**: 0.0 (certain NOT GUILTY) → 1.0 (certain GUILTY) - **Hysteresis**: Prevents flip-flopping near decision boundaries - **Stubbornness**: Some jurors resist change more than others - **Influence**: High-influence jurors sway others more effectively ### Nash Equilibrium Considerations The optimal strategy depends on: - Current vote distribution - Which jurors are most persuadable - Your side (prosecution vs defense) - Remaining deliberation rounds --- ## 🛠️ Tech Stack | Component | Technology | Sponsor | |-----------|------------|---------| | **UI Framework** | Gradio 6 with MCP Server | Gradio | | **Agent Framework** | smolagents CodeAgent | - | | **LLM Provider** | LiteLLM → Gemini | Google | | **RAG/Search** | LlamaIndex VectorStoreIndex | LlamaIndex | | **Embeddings** | Nebius Qwen3-Embedding-8B | Nebius | | **Voice/TTS** | ElevenLabs Judge Narration | ElevenLabs | --- ## 🔧 Agent Tools (RAG-Powered) ### Internal Juror Tools (`agents/tools/`) Jurors autonomously use these smolagents tools during deliberation: | Tool | File | Description | |------|------|-------------| | `EvidenceLookupTool` | `evidence_tool.py` | Semantic search over case evidence | | `CaseQueryTool` | `case_query_tool.py` | General RAG queries about the case | ```python # Semantic evidence search evidence_lookup(query="fingerprint analysis") # General case queries case_query(query="What is the defendant's alibi?") ``` ### MCP Tools (`services/mcp/`) External AI agents can participate via MCP protocol: | Tool | Description | |------|-------------| | `join_jury` | Claim a juror seat, receive persona & case info | | `leave_jury` | Release seat back to AI control | | `view_evidence` | Semantic evidence search | | `make_argument` | Submit argument with direction & type | | `cast_vote` | Vote guilty or not_guilty | | `get_state` | Get current game state & vote tally | Powered by **LlamaIndex** with **Nebius embeddings** for semantic search over: - Case summary & charges - Physical, testimonial, documentary, forensic evidence - Witness testimonies - Defendant background --- ## 📁 Project Structure ``` app.py # Gradio entry point with MCP server services/ embeddings.py # Nebius embedding service mcp/service.py # MCP tools for external agents tts.py # ElevenLabs integration core/ game_state.py # GameState, phases, vote tracking conviction.py # Game-theoretic persuasion math orchestrator.py # Turn management, speaker queue agents/ smolagent_juror.py # Autonomous CodeAgent wrapper tools/ # Evidence & case query tools case_db/ index.py # LlamaIndex vector store cases/ # YAML case files ``` --- ## 🚀 Run Locally ```bash # Install dependencies pip install -r requirements.txt # Set environment variables export GEMINI_API_KEY=your_key export NEBIUS_API_KEY=your_key export ELEVENLABS_API_KEY=your_key # optional # Launch python app.py # → http://localhost:7860 (MCP server enabled) ``` --- ## 🎪 Features Showcase - ✅ **Autonomous Multi-Agent Deliberation** — 11 AI jurors think independently - ✅ **MCP Server Integration** — External agents can participate - ✅ **RAG-Powered Evidence Search** — Semantic queries over case files - ✅ **Game-Theoretic Conviction System** — Archetype-based persuasion - ✅ **Voice Narration** — Judge speaks via ElevenLabs TTS - ✅ **Fair Turn Management** — Weighted speaker queue prevents domination --- ## 👥 Team - [mechanicalOrange](https://huggingface.co/mechanicalOrange) --- ## 🙏 Sponsors & Acknowledgments Built with generous support from the MCP's 1st Birthday Hackathon sponsors: | Sponsor | How We Used It | |---------|----------------| | **Gradio** | UI framework with native MCP server support | | **Google Gemini** | LLM backbone for juror reasoning via LiteLLM | | **LlamaIndex** | RAG pipeline for semantic case/evidence search | | **Nebius** | Qwen3-Embedding-8B for high-quality embeddings | | **ElevenLabs** | Judge voice narration TTS | | **Anthropic** | MCP protocol that powers external agent participation | Thank you for making this hackathon possible! --- ## 📜 License MIT License - Built for MCP's 1st Birthday Hackathon 🎂