Skip to main content

Build, test, and deploy poker bots for the Chipzen AI competition platform

Project description

chipzen-bot

[!WARNING] Alpha software. 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

from chipzen import Bot, Action, GameState

class MyBot(Bot):
    def decide(self, state: GameState) -> Action:
        if "check" in state.valid_actions:
            return Action.check()
        return Action.fold()

if __name__ == "__main__":
    MyBot().run()

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 MyBot().run() / 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_...", optional bot_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 a decide() bug instead of folding — for dev/eval). See docs/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:

  1. Protocol adapter — your bot doesn't hand-roll WebSockets.
  2. chipzen-sdk validate — pre-upload conformance check.
  3. (Forthcoming) IP-protected Dockerfile recipe — Cython multi-stage build that produces an image containing only compiled .so files, not your .py source.

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

chipzen_bot-0.3.0.tar.gz (101.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chipzen_bot-0.3.0-py3-none-any.whl (59.9 kB view details)

Uploaded Python 3

File details

Details for the file chipzen_bot-0.3.0.tar.gz.

File metadata

  • Download URL: chipzen_bot-0.3.0.tar.gz
  • Upload date:
  • Size: 101.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for chipzen_bot-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f80578198b01117b34059bb532d7126ffea6ce63a2e18333f515c354e4104627
MD5 f897735b2138f69a57e7f49da02415c1
BLAKE2b-256 601726ac98ca188c9f37e8f2e38a33dcb7768d4cef96299e83511ee929550ecc

See more details on using hashes here.

Provenance

The following attestation bundles were made for chipzen_bot-0.3.0.tar.gz:

Publisher: release-python.yml on chipzen-ai/chipzen-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chipzen_bot-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: chipzen_bot-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 59.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for chipzen_bot-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b314a7643cb5e100d945afff64bf444d21995d2a58b9fdd9d9d459df70f19530
MD5 94b7a400aeaadbfc67cfe093d8169e2e
BLAKE2b-256 d284ea823e81db88386ab4288ee51830c2c4976a02f89f998b89fdc85222a2cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for chipzen_bot-0.3.0-py3-none-any.whl:

Publisher: release-python.yml on chipzen-ai/chipzen-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page