22title : Gamble - AI Casino Bot
33description : Interactive roulette and blackjack games powered by AI tool calling with Pydantic AI
44integrations : ["slack"]
5- categories : ["AI", "Samples", "Games" ]
5+ categories : ["AI", "Samples"]
66tags :
77 [
88 " slack_bot" ,
@@ -42,13 +42,15 @@ An AI-powered casino bot for Slack that plays roulette and blackjack with you. T
4242## How It Works
4343
4444### Roulette
45+
45461 . ** Start game** : ` !gamble I want to play roulette `
46472 . ** AI asks for bet** : "Which number would you like to bet on (1-38)?"
47483 . ** Place bet** : "I bet on 17"
48494 . ** AI spins wheel** : Calls ` roulette_wheel() ` tool to get result
49505 . ** Win/Lose** : AI announces the result and determines if you won
5051
5152### Blackjack
53+
52541 . ** Start game** : ` !gamble Let's play blackjack `
53552 . ** AI deals cards** : Uses ` draw_card() ` tool to deal initial hands
54563 . ** AI shows cards** : "You have a 7 and a King. I'm showing a 9. Hit or stand?"
@@ -177,7 +179,7 @@ Update the `MODEL_NAME` variable in `autokitteh.yaml`:
177179``` yaml
178180vars :
179181 - name : MODEL_NAME
180- value : " anthropic:claude-sonnet-4-0" # or "openai:gpt-4o", etc.
182+ value : " anthropic:claude-sonnet-4-0" # or "openai:gpt-4o", etc.
181183` ` `
182184
183185## Technical Details
@@ -208,6 +210,7 @@ async def draw_card() -> int:
208210` ` `
209211
210212The AI agent :
213+
2112141. Understands tool descriptions and purposes
2122152. Decides when to call tools based on conversation
2132163. Uses tool results to formulate responses
@@ -216,6 +219,7 @@ The AI agent:
216219# ## Logfire Observability
217220
218221Logfire integration provides visibility into :
222+
219223- AI agent decisions and reasoning
220224- Tool calls with arguments and results
221225- Message history and conversation flow
@@ -237,10 +241,11 @@ AutoKitteh's durable workflows enable persistent game sessions:
237241` ` ` yaml
238242triggers:
239243 - name: slack_message
240- is_durable: true # Game state survives server restarts
244+ is_durable: true # Game state survives server restarts
241245` ` `
242246
243247Benefits :
248+
244249- Game state persists across AutoKitteh restarts
245250- No database needed for game history
246251- Automatic state management
@@ -257,13 +262,13 @@ The AI uses its understanding of game rules combined with tool calling to create
257262
258263# # Comparison with Other Samples
259264
260- | Sample | Conversation History | Tools | Use Case |
261- |--------| ---------------------| -------| ----------|
262- | **ask** | ❌ No | ❌ No | Quick one-off questions |
263- | **chat** | ✅ Yes | ❌ No | Multi-turn conversations |
264- | **chat_with_ui** | ✅ Yes | ❌ No | Browser-based chat |
265- | **gamble** | ✅ Yes | ✅ Yes | Interactive AI games with tools |
266- | **dnd** | ✅ Yes | ✅ Yes | Complex multiplayer RPG |
265+ | Sample | Conversation History | Tools | Use Case |
266+ | ---------------- | -------------------- | ------ | ------------------------------- |
267+ | **ask** | ❌ No | ❌ No | Quick one-off questions |
268+ | **chat** | ✅ Yes | ❌ No | Multi-turn conversations |
269+ | **chat_with_ui** | ✅ Yes | ❌ No | Browser-based chat |
270+ | **gamble** | ✅ Yes | ✅ Yes | Interactive AI games with tools |
271+ | **dnd** | ✅ Yes | ✅ Yes | Complex multiplayer RPG |
267272
268273# # Development
269274
@@ -284,19 +289,22 @@ Deploy from the command line:
284289# # Customization Ideas
285290
286291# ## Additional Games
292+
287293- **Poker**: Multi-player with betting rounds
288294- **Dice games**: Craps, Yahtzee
289295- **Card games**: War, Go Fish
290296- **Slots**: Virtual slot machine simulation
291297
292298# ## Enhanced Features
299+
293300- **Betting system**: Track virtual currency across games
294301- **Statistics**: Win/loss records, high scores
295302- **Multiplayer**: Allow multiple users in same game
296303- **Game rules**: Configurable house rules and payouts
297304- **Leaderboards**: Track top players across workspace
298305
299306# ## Tool Enhancements
307+
300308- **Deck management**: Track remaining cards in blackjack
301309- **Betting validation**: Ensure bets are within limits
302310- **Game history**: Export game results to spreadsheet
@@ -314,21 +322,25 @@ Deploy from the command line:
314322# # Troubleshooting
315323
316324**Bot doesn't start game:**
325+
317326- Ensure message starts with `!gamble`
318327- Check that bot has permission to read messages in channel
319328- Verify trigger is deployed and active in AutoKitteh UI
320329
321330**Tools not being called:**
331+
322332- Check Logfire logs for tool call attempts
323333- Verify model supports tool calling (most modern models do)
324334- Ensure prompts clearly request game actions
325335
326336**Game state lost:**
337+
327338- Check that `is_durable : true` is set in trigger configuration
328339- Verify workflow hasn't timed out
329340- Look for errors in AutoKitteh logs
330341
331342**Inconsistent game rules:**
343+
332344- Different AI models may interpret rules differently
333345- Consider adding more explicit rule details in system prompt
334346- Check tool call logs to debug AI reasoning
@@ -338,6 +350,7 @@ Deploy from the command line:
338350To add a new game :
339351
3403521. **Define tools** for game mechanics :
353+
341354 ` ` ` python
342355 @roulette_agent.tool_plain
343356 async def roll_dice(sides: int) -> int:
@@ -346,6 +359,7 @@ To add a new game:
346359 ` ` `
347360
3483612. **Update system prompt** with game rules :
362+
349363 ` ` ` python
350364 system_prompt=(
351365 "..."
0 commit comments