Build, test, and deploy poker bots for the Chipzen AI competition platform
Project description
chipzen-bot
[!WARNING] Beta software (pre-1.0). This SDK is in active development; the public API may change between minor versions before 1.0. Pin to a specific version in production. Report issues at chipzen-ai/chipzen-sdk/issues.
The Python adapter for the Chipzen AI poker
competition platform. Wraps the WebSocket protocol so your bot only
has to implement decide(state) -> action, and ships a validate
CLI that confirms your bot will be accepted by the upload pipeline.
Install
pip install chipzen-bot
Python 3.10+ is supported. The runtime dependency is a single package
(websockets); your bot can pull in whatever else it needs (numpy,
torch, etc.) on top.
Minimal bot
import asyncio
import os
from chipzen import Bot, Action, GameState, run_bot
class MyBot(Bot):
def decide(self, state: GameState) -> Action:
if "check" in state.valid_actions:
return Action.check()
return Action.fold()
if __name__ == "__main__":
# An uploaded bot gets its match URL from the platform via $CHIPZEN_WS_URL.
asyncio.run(run_bot(os.environ["CHIPZEN_WS_URL"], MyBot(),
token=os.environ.get("CHIPZEN_TOKEN")))
To run a bot remotely from your own machine instead of uploading it, use
run_external_bot(...)/chipzen run-external— see Two ways to run a bot.
The SDK handles the Layer-1 transport handshake, Layer-2 game-state
parsing, ping/pong, request-id echoing, action_rejected retries,
and reconnect. Subclass Bot, override decide(), return an
Action. That's the entire surface for a working bot.
Lifecycle hooks (on_match_start, on_round_start, on_phase_change,
on_turn_result, on_round_result, on_match_end,
on_decision_latency) are optional — override them if you need to
maintain per-match or per-hand state between turns or log your decision
timings.
Two ways to run a bot
The same Bot class works on both paths:
-
Upload (containerized). Package your bot as an image and submit it; the platform's executor runs it. This is the
run_bot(...)/chipzen-sdk validate+ Docker path above — best for ranked competition and tournaments. -
External-API (remote play). Run your bot on your own machine and let the platform match and dispatch it over the public token-authed API — no upload, fast iteration:
import asyncio from chipzen import Bot, run_external_bot asyncio.run(run_external_bot(MyBot(), bot_id="<bot-uuid>", env="staging", token="cz_extbot_..."))
It holds one lobby connection and plays every match dispatched to your bot — a single challenge, or each round of a tournament. Put the token in a
chipzen.toml([external_api] token = "cz_extbot_...", optionalbot_id/url) and the CLI is a one-liner:chipzen run-external my_bot.py --env staging
Tunables:
connect_to_chipzen()(env→URL),RetryPolicy(reconnect/backoff),safe_mode=False(crash on adecide()bug instead of folding — for dev/eval). Seedocs/external-api/FIRST-30-MINUTES.md.
CLI
The chipzen-sdk CLI (aliased as chipzen) is installed alongside the package:
| Command | Purpose |
|---|---|
chipzen-sdk init <name> |
Scaffold a new bot project from a starter template. |
chipzen-sdk validate <path> |
Run the same checks the upload pipeline runs (size, imports, sandbox-blocked modules, decide() timeout sniff). The supported go/no-go before docker packaging. |
chipzen run-external <bot.py> |
Run a bot on the external-API remote-play path (lobby → matched → play). |
Run chipzen-sdk <command> --help for the full option list per command.
What the SDK is for (and what it isn't)
The SDK does three things and nothing else:
- Protocol adapter — your bot doesn't hand-roll WebSockets.
chipzen-sdk validate— pre-upload conformance check.- IP-protected Dockerfile recipe — the Cython multi-stage build
that ships in
starters/python/Dockerfile(cythonize -i bot.py && rm bot.py) produces an image containing only compiled.sofiles, not your.pysource.
It does not include a local match simulator, hand evaluator, or
opponent pool. Bot strength testing happens after upload; the platform
runs comprehensive bot-vs-bot evaluation as part of the submission
pipeline. If you want fast local iteration, write your own profiling
harness that calls your Bot.decide() directly with recorded
GameState objects.
Reference
Full developer documentation lives in the chipzen-sdk repo:
- DEV-MANUAL — SDK reference, lifecycle hooks, performance budgets, container contract, troubleshooting.
- QUICKSTART — write a bot, validate it, package it (~10 minutes).
- Protocol spec — Layer 1 (Transport) + Layer 2 (Poker game state). Authoritative.
- Bot runtime security model — what the platform enforces on uploaded bots (sandbox, network egress, resource limits).
Per-package quickstart: QUICKSTART.md.
License
Apache-2.0. See the LICENSE file in the repo.
Project details
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 chipzen_bot-0.3.1.tar.gz.
File metadata
- Download URL: chipzen_bot-0.3.1.tar.gz
- Upload date:
- Size: 105.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f41b8bfcc798ddd102343229d79fb5dcb0afd259f34324cdfcf953eef0803d94
|
|
| MD5 |
87a48b3828c7b3276cea3e19681d760f
|
|
| BLAKE2b-256 |
8d002aea9397dd460f382e1eef19f7d1cbe26f682e76bb2c98fa37c985a6fe79
|
Provenance
The following attestation bundles were made for chipzen_bot-0.3.1.tar.gz:
Publisher:
release-python.yml on chipzen-ai/chipzen-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chipzen_bot-0.3.1.tar.gz -
Subject digest:
f41b8bfcc798ddd102343229d79fb5dcb0afd259f34324cdfcf953eef0803d94 - Sigstore transparency entry: 2168352980
- Sigstore integration time:
-
Permalink:
chipzen-ai/chipzen-sdk@e42d21bc64d0d8403215df21af9df1e83b74e590 -
Branch / Tag:
refs/tags/python-v0.3.1 - Owner: https://github.com/chipzen-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@e42d21bc64d0d8403215df21af9df1e83b74e590 -
Trigger Event:
push
-
Statement type:
File details
Details for the file chipzen_bot-0.3.1-py3-none-any.whl.
File metadata
- Download URL: chipzen_bot-0.3.1-py3-none-any.whl
- Upload date:
- Size: 61.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21510a3ae299543d5c3aa567a5c0086904da9353922cff1a0e707ecc5e8502a7
|
|
| MD5 |
f5a25a364960ec8c90db30576fd1abed
|
|
| BLAKE2b-256 |
fe344e19baffc7873dfc2dc20b583311c42133445d9d94a579c9073d9b78c202
|
Provenance
The following attestation bundles were made for chipzen_bot-0.3.1-py3-none-any.whl:
Publisher:
release-python.yml on chipzen-ai/chipzen-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chipzen_bot-0.3.1-py3-none-any.whl -
Subject digest:
21510a3ae299543d5c3aa567a5c0086904da9353922cff1a0e707ecc5e8502a7 - Sigstore transparency entry: 2168352999
- Sigstore integration time:
-
Permalink:
chipzen-ai/chipzen-sdk@e42d21bc64d0d8403215df21af9df1e83b74e590 -
Branch / Tag:
refs/tags/python-v0.3.1 - Owner: https://github.com/chipzen-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@e42d21bc64d0d8403215df21af9df1e83b74e590 -
Trigger Event:
push
-
Statement type: