Agent Werewolf

8 AI agents play Werewolf with onchain integrity — 0G Compute, Gensyn AXL P2P, and 0G Chain.

Agent Werewolf

Created At

Open Agents

Project Description

Multi-agent games on a centralized server have a fundamental integrity problem: the server knows everything, including which players are werewolves. Agent Werewolf demonstrates that real social-deduction gameplay is possible when agents play with cryptographically committed game records — every speech, vote, and elimination gets hashed into a Merkle tree and the root is committed onchain.

Eight LLM agents drawn from five distinct persona archetypes (Paranoid, Manipulator, Analyst, Accuser, Peacemaker) plus three behavioral variants play a complete Werewolf game in 3–5 turns. Each agent generates speeches and votes via 0G Compute Sealed Inference (TEE-verified LLM, not a black-box server). Every signed game event is mirrored across two TLS-peered Gensyn AXL nodes — a dedicated witness process polls the destination node, verifies each envelope's signature against the GameMaster wallet, and persists the byte-stream that crossed the Yggdrasil overlay. Game outcomes commit to GameArchive on 0G Galileo testnet, with per-agent reputation tracked in ReputationOracle.

Live demo: https://agent-werewolf.vercel.app

How it's Made

Stack: Node.js 22 + TypeScript ESM gamemaster, Go (Gensyn AXL binary), Solidity (Foundry), static HTML spectator dashboard, deployed to Vercel.

The gamemaster spawns 8 LLM-driven agent objects in a single Node.js process. Each agent has a unique persona prompt and calls 0G Compute via @0gfoundation/0g-compute-ts-sdk for every speech and vote — that's qwen-2.5-7b-instruct running in a TEE on provider 0xa48f01... A global rate limiter enforces a 6.5s gap between calls (the provider caps at 10 req/min).

Real Gensyn AXL P2P: two AXL nodes peered TLS hub-and-spoke (Node A listens on tls://127.0.0.1:9101, Node B dials it). The gamemaster's axl-mirror module subscribes to the EventEmitter and POSTs every signed envelope to Node B's /send endpoint. AXL routes via Yggdrasil overlay to Node A. A separate axl-witness Node.js process polls Node A's /recv every 400ms, verifies each envelope's ECDSA signature against the GM wallet (0x1185...), and prints/persists ✓sig per envelope. Verified: 22+ envelopes per game cross the overlay.

Onchain: viem v2 → 3 Solidity contracts on 0G Galileo (chain 16602): AgentRegistry (ERC-8004 inspired, peer-id + display name registration), ReputationOracle (per-game role/outcome batch), GameArchive (Merkle root + storage root commit). Archives Merkle-rooted with merkletreejs, optionally uploaded to 0G Storage via @0glabs/0g-ts-sdk.

Hacky bits: replay mode in dashboard — falls back from WebSocket to fetch('sample-game.json') after 3 reconnects, plays back at 4× speed so judges see a full game in ~30s without a backend running. Cache-busts the JSON on every load to dodge Vercel CDN staleness. Sample game (91f716b9...) is committed onchain at tx 0x8d63b8fb... — the dashboard shows the same Merkle root that's in the archive that's verifiable on chainscan.

background image mobile

Join the mailing list

Get the latest news and updates

Agent Werewolf | ETHGlobal