explaingit

18597990650-lab/multi-agent-game

24PythonAudience · developerComplexity · 3/5Setup · moderate

TLDR

An AI-powered Werewolf game where every player is a language model agent with role-specific information. Watch AI players reason, argue, and vote in real time through a React interface, and benchmark different models head-to-head.

Mindmap

mindmap
  root((multi-agent-game))
    Game roles
      Werewolf pair
      Seer
      Witch
      Guard
      Villagers
    Information rules
      Role-filtered views
      Concurrent decisions
      Language model reasoning
    Tech setup
      FastAPI backend
      WebSocket game loop
      React frontend
    Evaluation
      Automated game runs
      Performance ranking
      Model comparison
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Run automated Werewolf games with AI agents and observe how language models reason and deceive under strict information asymmetry.

USE CASE 2

Benchmark different AI models or configurations by running evaluation games and comparing performance rankings.

USE CASE 3

Use as a template for building your own multi-agent reasoning game with role-based information isolation.

Tech stack

PythonFastAPIWebSocketsReactOpenAI API

Getting it running

Difficulty · moderate Time to first run · 30min

Requires an OpenAI API key plus separate Python and Node.js environments for the backend and frontend.

No license information is mentioned in the explanation.

In plain English

This repository is an AI-powered version of the social deduction game Werewolf (also known as Mafia). Instead of human players, each seat at the table is filled by an AI agent driven by a large language model. The game assigns each agent a role: Werewolf, Seer, Witch, Guard, or Villager. Each role has its own goals and information, and agents reason through the game entirely via language model calls. A key design feature is strict information isolation. Each agent only sees what its role is allowed to know. Werewolves know each other's identities. The Witch knows how many potions remain and can see who died the previous night when she holds a healing potion. The Seer knows the history of their own investigations. Villagers and Guards see only public speech and who is still alive. This separation is enforced by a function in the game engine that filters what each agent receives before it makes a decision. The system is built with a Python backend using FastAPI and WebSockets to handle the game loop asynchronously. A React frontend lets you watch the game unfold in real time as agents speak, vote, and use their abilities. The README describes the default setup as a 7-player game: one Seer, one Witch, one Guard, two Werewolves, and two Villagers. There is also an evaluation module that runs automated games and tracks performance across different agents or models, with a ranking system to compare how well different AI configurations play the game. Agent decisions run concurrently to keep the game moving quickly. Running the project requires an OpenAI API key, a Python environment for the backend, and Node.js for the frontend. The README is written in Chinese, but the code structure and setup steps are straightforward enough to follow.

Copy-paste prompts

Prompt 1
I cloned 18597990650-lab/multi-agent-game. Walk me through setting up the FastAPI backend and React frontend and starting a 7-player AI Werewolf game.
Prompt 2
How does multi-agent-game enforce information isolation between agents? Show me the code that filters what each agent receives based on its role before it makes a decision.
Prompt 3
I want to swap in Claude instead of OpenAI models in multi-agent-game. How do I change the API configuration and what do I need to watch out for?
Prompt 4
How do I run the evaluation module in multi-agent-game to compare how well two different AI models play the Werewolf game?
Open on GitHub → Explain another repo

← 18597990650-lab on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.