haive-games for Haive framework
Project description
haive-games
LLM-powered games for agent evaluation, learning, and fun.
A curated suite of game environments + AI agents built on the Haive framework.
๐ง Status: Under Active Development
haive-games is currently being migrated to the latest Haive framework APIs.
Expect breaking changes while the package converges on the unified Haive runtime + agent protocol standards.
- โ Core games and agents are usable today
- ๐ APIs, configs, and imports may change during migration
- ๐งช Test coverage is expanding (no-mocks, real integration focus)
๐ฏ Overview
Haive Games is a comprehensive collection of LLM-powered game agents and game environments designed for:
- Agent evaluation in structured, rule-based settings
- Strategy + reasoning demonstrations (planning, deduction, imperfect information)
- Multi-agent coordination experiments (teams, tournaments, meta-controllers)
- Developer examples of Haive patterns (state machines, tool use, graph workflows)
Highlights
- โ 22+ complete games with consistent APIs
- ๐ค LLM-powered players with configurable personalities and difficulty
- ๐๏ธ Rich terminal UI with state visualization
- ๐๏ธ Tournament mode for benchmarking and comparisons
- ๐ Metrics + telemetry hooks (timing, turns, decisions)
Project link: https://tinyurl.com/haive-games
๐ฆ Installation
From PyPI
pip install haive-games
With Poetry
poetry add haive-games
From source (monorepo)
cd haive/packages/haive-games
pip install -e .
๐ Quick Start
Below is a minimal example showing how to run two games with LLM-driven agents.
from haive.games.chess import ChessAgent, ChessConfig
from haive.games.checkers import CheckersAgent, CheckersAgentConfig
from haive.core.models.llm.configs import LLMConfig
# 1) Configure LLMs for players
llm_config = LLMConfig(
model="gpt-4",
temperature=0.7,
max_tokens=1000,
)
# 2) Chess
chess_config = ChessConfig(
aug_llm_configs={
"white_player": llm_config,
"black_player": llm_config,
}
)
chess_agent = ChessAgent(chess_config)
chess_result = chess_agent.run_game(visualize=True)
# 3) Checkers
checkers_config = CheckersAgentConfig(
aug_llm_configs={
"player1": llm_config,
"player2": llm_config,
}
)
checkers_agent = CheckersAgent(checkers_config)
checkers_result = checkers_agent.run_game(visualize=True)
print(f"Chess winner: {chess_result.get('winner')}")
print(f"Checkers winner: {checkers_result.get('winner')}")
๐๏ธ Game Catalog
haive-games includes a wide variety of games across multiple difficulty levels and reasoning types.
๐ Classic Board Games
- Chess โ FEN support, strategic analysis, configurable personalities
- Checkers โ mandatory jumps, king promotion, rich UI
- Go โ territory control and capture mechanics
- Reversi (Othello) โ flipping mechanics + positional play
- Clue โ mystery deduction and hypothesis tracking
๐ฏ Strategy Games
- Tic-Tac-Toe โ position evaluation + forced wins
- Connect 4 โ gravity-based tactics and win detection
- Battleship โ hidden placement, targeting, information gathering
- Risk โ territorial control + dice combat
- Mancala โ sowing/capture mechanics
๐ Card Games
- Poker โ Texas Holdโem + bluffing + hand evaluation
- Texas Holdโem (advanced) โ tournaments + deeper betting model
- Blackjack โ probabilistic play + strategy variants
๐ญ Social Deduction
- Among Us โ tasks, deception, voting mechanics
- Mafia / Werewolf โ role-based day/night play
๐งฉ Puzzle & Logic
- Mastermind โ code-breaking via deduction
- Nim โ mathematical optimal play
- Fox and Geese โ asymmetric strategy
๐ข Economic
- Monopoly โ trading + development + risk management
๐จ Other
- Dominoes โ tile-matching variants
- Debate โ structured argumentation + scoring/judging
๐ง How the Games Are Built
Each game follows a consistent architecture designed for reuse and extensibility:
Game Agent (e.g., ChessAgent)
โโโ Configuration (GameConfig)
โโโ State Management (GameState, reducers, history)
โโโ Player Engines (LLM configs / providers)
โโโ Rules + Validation (legal actions, win conditions)
โโโ UI Layer (Rich rendering, progress, panels)
โโโ Workflow (graph-based game loop / stages)
Core Components
-
Agent Controller
Orchestrates the game loop and delegates decisions to players. -
State System
Tracks turns, legal moves, history, and derived information. -
Player Engines
Configurable LLM-backed players (temperature, prompts, tool access). -
UI/Visualization
Rich terminal UI for live play and debugging.
๐๏ธ Tournament Mode
Run multiple games repeatedly to compare agents, prompts, or models.
from haive.games.tournament import Tournament
tournament = Tournament([
(ChessAgent, chess_config),
(CheckersAgent, checkers_config),
# (ClueAgent, clue_config),
])
results = tournament.run(rounds=10)
print(f"Tournament winner: {results.winner}")
print(f"Leaderboard:\n{results.leaderboard}")
๐ญ AI Personalities & Difficulty
Tune player behavior by adjusting LLM configuration:
from haive.core.models.llm.configs import LLMConfig
aggressive = LLMConfig(
model="gpt-4",
temperature=0.9,
system_prompt="Play aggressively. Take calculated risks and pressure opponents."
)
defensive = LLMConfig(
model="gpt-4",
temperature=0.3,
system_prompt="Play defensively. Avoid losing positions and prioritize safety."
)
analyzer = LLMConfig(
model="gpt-4",
temperature=0.1,
system_prompt="Be objective. Evaluate positions carefully and explain key ideas."
)
๐ Metrics & Monitoring
Many games can collect timing and decision metadata:
config = ChessConfig(
aug_llm_configs=llm_configs,
enable_analysis=True,
log_level="DEBUG",
collect_metrics=True,
)
agent = ChessAgent(config)
result = agent.run_game()
metrics = result.get("metrics", {})
print("avg_move_time:", metrics.get("avg_move_time"))
print("analysis_calls:", metrics.get("analysis_calls"))
๐งช Testing
haive-games follows a production-style testing approach, favoring real components whenever possible.
# Run all tests
poetry run pytest packages/haive-games/tests/ -v
# Run a specific game test suite
poetry run pytest packages/haive-games/tests/test_chess/ -v
Lint / format:
poetry run ruff check packages/haive-games/src/
poetry run black packages/haive-games/src/
๐ Package Structure
haive-games/
โโโ src/haive/games/ # Game implementations
โ โโโ chess/
โ โโโ checkers/
โ โโโ go/
โ โโโ among_us/
โ โโโ mafia/
โ โโโ ...
โโโ examples/ # Demo scripts and usage patterns
โโโ tests/ # Game + integration tests
โโโ project_docs/ # Guides, architecture notes, and references
๐งฉ Adding a New Game
-
Create a game directory:
src/haive/games/your_game/ -
Implement the required components:
agent.pyโ main controllerconfig.pyโ configuration modelsstate.pyโ state + reducers + transitionsmodels.pyโ structured models used by state/actionsREADME.mdโ game docs + examples
-
Add tests:
tests/test_your_game/ -
Register it in the package index (if applicable)
๐บ๏ธ Roadmap
- ๐๏ธ Unified agent config for all games
- ๐ง Better evaluation harness + standardized metrics output
- ๐๏ธ Multi-league tournaments (ELO / TrueSkill)
- ๐ฅ๏ธ Optional web UI for select games
- ๐ Tight integration with Haive MCP + tool ecosystems
๐ค Contributing
Contributions are welcome:
- Fork the repository
- Create a feature branch
- Add tests for changes
- Ensure formatting + lint passes
- Open a PR
๐ License
MIT License โ see LICENSE.
๐ Support
- Issues: open a GitHub issue on the Haive monorepo (or relevant package repo)
- Docs: see the Haive documentation hub
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file haive_games-1.0.0.tar.gz.
File metadata
- Download URL: haive_games-1.0.0.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4be318471da19e187479d0b513a9664b2fc3422aab831b4566db56fd40d32487
|
|
| MD5 |
2f9c962c3ec886620906ee4a619a85a0
|
|
| BLAKE2b-256 |
8e43549f2ccd495110e34236687ba8beb78ca184a85519ecfd3568d4185c0366
|
File details
Details for the file haive_games-1.0.0-py3-none-any.whl.
File metadata
- Download URL: haive_games-1.0.0-py3-none-any.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad865fd5b66ef2692a485a495fee851323ace28b54ff7686478c9a9e244c6e29
|
|
| MD5 |
a1960139917790fcf7e653b7992a59b1
|
|
| BLAKE2b-256 |
2f229e8d1f065208142853297b7fa847dd80901c542cb7b2fec2085a41bde4fc
|