sujal-maheshwari2004/mafia-a2a — explained in plain English
Analysis updated 2026-05-18
Run a Mafia game between AI agents to compare heuristic bots against LLM-backed ones.
Play a text-based game of Mafia yourself against bot opponents on the command line.
Stream a live AI vs AI Mafia match to a frontend over WebSocket.
| sujal-maheshwari2004/mafia-a2a | 0xallam/my-recipe | 0xhassaan/nn-from-scratch | |
|---|---|---|---|
| Stars | 0 | — | 0 |
| Language | Python | Python | Python |
| Last pushed | — | 2022-11-22 | — |
| Maintenance | — | Dormant | — |
| Setup difficulty | moderate | moderate | moderate |
| Complexity | 3/5 | 2/5 | 4/5 |
| Audience | developer | general | developer |
Figures from each repo's GitHub metadata at analysis time.
LLM-backed agents require an OPENAI_API_KEY, heuristic agents need no external service.
This project is a simulator for the party game Mafia, also known as Werewolf, built so that AI agents or a mix of AI and rule based bots can play against each other, or a human can join in. The core game logic is written separately from any input or output code, so the same rules can power a text based command line game, an automated match between bots, or a live streaming server, without duplication. The game follows the classic five role version of Mafia: Mafia, Doctor, Detective, and Villager, alternating between a night phase where the Mafia secretly choose a target, the Doctor tries to protect someone, and the Detective investigates, and a day phase where everyone discusses and votes to eliminate a suspect. What makes this project distinct is its custom agent to agent communication protocol. Instead of agents simply picking targets and votes, they can talk to each other the way people do around a table, choosing to broadcast to the whole group, huddle privately with a few players, or whisper to just one person. Other players can still notice that a private conversation happened, even if they cannot see its contents, which mirrors the social suspicion of a real game. Two kinds of agents are included out of the box. One is a simple rule based bot that needs no external service and tracks suspicion using keyword matching. The other is powered by a large language model through LangChain and OpenAI, and requires an OpenAI API key. Both kinds of agents can be mixed in the same game to compare how they behave. The project also includes a small web server built with FastAPI that streams a live game over a WebSocket connection, so a frontend interface could show matches between AI agents in real time. This is an experimental, code heavy project best suited to developers curious about multi agent AI systems or game simulation, and it currently has no stars.
A Mafia (Werewolf) game simulator where AI agents talk, vote, and eliminate each other using a custom agent-to-agent protocol, with a live WebSocket streaming server.
Mainly Python. The stack also includes Python, FastAPI, LangChain.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Don't trust strangers blindly. Verify against the repo.