Poker Sharingan bot SDKs
The public sharingan-1 benchmark track and browser table play C@2e10
(SHARINGAN-1) without search. SHARINGAN-2 is the final C@1.83e11 weight release,
which can be self-hosted with the same medium sizing and buckets-200 tables.
The public inference API adds turn/river search to C@2e10; search is Rust code,
not part of either weight file. See the model cards.
Plug any bot into the arena in about 20 lines. Both SDKs speak the Table API (REST + WebSocket /v1/play; webhook mode is optional and off on arena.sharingan.poker) and share one shape:
Python (poker-sharingan, imports as sharingan) |
TypeScript (poker-sharingan) |
|
|---|---|---|
| Path | python/ |
typescript/ |
| Deps | websockets (REST is stdlib) |
none in browsers / Node >= 22, optional ws |
| Bot | class MyBot(Bot): def act(self, s) -> Action |
class MyBot extends Bot { act(s): Action } |
| Run | run(MyBot(), url, token) |
await run(new MyBot(), url, token) |
| Examples | random, calling_station, tight_aggressive, llm_bot | same |
| Tests | pytest |
vitest |
Fastest path (Python)
pip install "git+https://github.com/markokraemer/poker-sharingan#subdirectory=sdk/python" # PyPI is coming
sharingan eval mybot.py # ladder-v1 benchmark; one line: score in mbb/game ± 95% CI over N duplicate hands
sharingan submit mybot.py --contact you@example.com --profile https://x.com/you # hosted job: VERIFIED score (a full 20,004-hand run ranks)
sharingan benchmark mybot.py --track sharingan-1 # bot runs on your machine: unverified
sharingan token mybot.py # print the saved bot token
sharingan connect mybot.py --server URL --token T # already-registered bot, answer until the server closes
sharingan play mybot.py --vs sharingan-1
sharingan serve mybot.py --port 9000 # bot as a webhook URL
mybot.py only needs an act(state) function or a Bot subclass. The TypeScript package has no CLI yet.
Model
ArenaClientregisters a bot (POST /v1/players, token shown once), creates/joins tables.Runneropenswss://host/v1/play?token=..., sendshello(withresumeon reconnect), keeps the connection alive, and for everyyour_turncallsbot.act(state).- You return an
Action:fold,check,call, orraise_to(n). Amounts are "to" (your total street contribution). The runner clamps them to the legal range unless you opt into strict mode, and falls back to check/fold on exceptions or deadline overruns. - Optional hooks (
on_hand_start,on_action,on_street,on_hand_end,on_error) let stateful bots track hands.hand_endcarries every player's hole cards. In hostedsubmitruns onlyon_hand_endandon_errorfire, and each rotation of a deal is played by a fresh process, so state lasts at most one rotation (about 1/6 of a run): rebuild it froms.history.
LLM bots
LLMBot(complete) renders the state as text (render_state / renderState), calls your function prompt -> text (any provider, sync or async, no keys in the SDK) and parses a final ACTION: ... line. An LLM bot runs on your machine (sharingan benchmark), so its run is unverified.
Mock arena
Each SDK ships an in-process mock (sharingan.mock.MockArena, poker-sharingan/mock) implementing the contract's essentials: scripted hands, table_seq/seq, act idempotency, illegal_action/bad_amount re-send, hello{resume}, forced disconnects. It is for testing bots, not a rules engine.
Contract notes and ambiguities
Where the contract allows more than one reading, the SDKs accept both (e.g. hand_id is read from the envelope when your_turn.data lacks it, hand_end.hole_cards keys are normalised). The official rulings are in TABLE_API.md section 12b.