惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
博客园_首页
罗磊的独立博客
云风的 BLOG
云风的 BLOG
J
Java Code Geeks
Last Week in AI
Last Week in AI
D
DataBreaches.Net
Jina AI
Jina AI
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
V
V2EX
D
Docker
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
H
Help Net Security
T
The Blog of Author Tim Ferriss

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
🏏 Building "Captain Cool": A Multi-Agent IPL Strategist w...
Vaishnavi Ba · 2026-05-17 · via DEV Community

Vaishnavi Bardapure

Cricket is a captain's game. The margin between an IPL trophy and crashing out in the playoffs is often a single, split-second tactical decision: who bowls the 19th over? Do you bring in the spinner against the left-hander? What happens when the dew sets in?

For the APL GDG Hackathon, I wanted to simulate the high-pressure environment of an IPL dugout. I built Captain Cool — a Multi-Agent AI System powered entirely by the Google Gemini stack that debates and makes real-time tactical cricket decisions.

Here is how I built it.


🏗️ The Architecture (The Coaching Staff)

To make this truly agentic, one LLM call wasn't going to cut it. A real captain doesn't operate in a vacuum—they rely on data analysts and vice-captains.

Using Google GenAI SDK and the blazing fast gemini-2.5-flash model, I orchestrated a 3-agent debate loop:

  1. 📊 The Stats Analyst: This agent doesn't guess. It uses Gemini Function Calling to hit my custom Python tools (get_player_stats, get_venue_stats) to pull raw numbers on strike rates, matchups, and pitch conditions based on the live match state.
  2. 🧠 The Strategist (The Captain): Takes the raw match state and the Analyst's data to propose the next tactical move.
  3. ⚖️ The Devil's Advocate (The Vice-Captain): This is where the magic happens. The Vice-Captain is explicitly prompted to find flaws in the Captain's plan, highlight contrarian angles (like dew factor), and prevent groupthink.

The Captain then takes the critique, revises or defends the plan, and makes the Final Call.

graph TD
    M[Live Match State] --> A(Stats Analyst)
    A -->|Function Calling| D[(Cricket Stats API)]
    D -->|Stats| A
    A -->|Stats Summary| S(Strategist - Captain)
    M --> S
    S -->|Initial Proposal| V(Devil's Advocate)
    V -->|Critique & Risks| S
    S -->|Final Decision| O[Final Output UI]

Enter fullscreen mode Exit fullscreen mode


🗣️ The System Prompts

The secret sauce to getting authentic cricket commentary rather than generic ML jargon was in the System Prompts.

The Captain's Prompt:

"You are 'Captain Cool', an elite IPL match strategist (think MS Dhoni or Rohit Sharma). You will receive the current match state and a data summary from your Stats Analyst. Your task is to make the next tactical decision: e.g., who should bowl the next over, field placement, bringing in the Impact Player, etc. Explain your reasoning in authentic cricket terminology. Be decisive and clear in your proposal."

The Vice-Captain's Prompt:

"You are the Devil's Advocate (Vice-Captain) of an IPL team. Your job is to listen to the Captain's tactical proposal and find the flaws in it. Look for contrarian angles: what if the pitch is behaving differently? What if the matchups are misleading? What about dew? Suggest a smart alternative or highlight the primary risk of the Captain's plan. Speak in sharp, analytical cricket terms."


🏏 Walkthrough: An End-to-End Match Scenario

Let's look at how the agents handle a classic death-overs scenario:

The Setup:

  • Innings: 2nd Innings (Run Chase)
  • Score: 145/4 (Over 17.5) | Target: 175
  • Matchup: RCB (Batting) vs MI (Bowling)
  • At the Crease: Virat Kohli (55 off 38) & Dinesh Karthik (12 off 8)
  • Bowling Options: Hardik Pandya is finishing his spell. Jasprit Bumrah has 1 over left.
  • Conditions: Wankhede Stadium. Heavy dew is setting in.

(Insert a screenshot of the Streamlit UI Match Config here!)

The Debate Unfolds:

  1. 📊 Stats Analyst: Pulls data via tools. Highlights that Kohli is vulnerable to left-arm pace outside off, but dominates spin. Bumrah has a 7.8 death overs economy and a massive 82.3% yorker accuracy, having dismissed Kohli 4 times. Wankhede has a heavy dew factor which makes gripping the ball difficult.
  2. 🧠 Captain (Initial Plan): Suggests bringing Bumrah in immediately for the 18th over to get Kohli out before he can launch in the 19th and 20th. Keep Pandya out of the attack.
  3. ⚖️ Vice-Captain (Critique): "Hold on skip. With the heavy dew, the ball is going to resemble a bar of soap. If Bumrah bowls the 18th, who bowls the 19th and 20th? We risk saving our weaker bowlers for the final overs when the dew is at its absolute worst. We need Bumrah for the 19th."
  4. 🏆 Final Call: The Captain agrees with the critique. "Fair point. The dew is a massive factor. We bowl Akash Madhwal for the 18th over, stack the off-side to force Kohli to hit against the spin of the wet ball, and save Bumrah's yorkers for the crucial 19th over."

(Insert a screenshot of the Chat UI showing the final decision here!)


🛠️ The Tech Stack & Google Integration

  • Model: gemini-2.5-flash for lightning-fast, multi-turn reasoning.
  • SDK: Google GenAI Python SDK (google-genai).
  • Tool Use: Native Gemini Function Calling hooked into a custom Python dictionary of IPL stats.
  • IDE: Vibe-coded entirely inside Google Antigravity (Google's agentic IDE).
  • UI & Hosting: Built with Streamlit and deployed live on Streamlit Community Cloud.

🏆 Conclusion

By breaking the problem down into a multi-agent system, the AI was forced to self-correct and consider environmental factors (like dew and bowler workload) that a single zero-shot prompt usually misses.

Check out the live app here: (Insert your Streamlit Cloud URL here!)
Check out the code on GitHub: github.com/VaishnaviBardapure/CaptainCool

Built for the APL GDG Hackathon.

GDGCLOUDPUNE