DEV Community

Dhanashri Ugalmugale
Dhanashri Ugalmugale

Posted on

Captain Cool AI: A Multi-Agent IPL Tactical Strategist Built Powered by Google Gemini

Cricket is often called a batter’s game, but in T20 cricket, it is equally a captain’s game. One tactical mistake—bowling spin into heavy dew, using your best death bowler too early, or making the wrong substitution—can completely change the outcome of a match. That is exactly what made this Google Gemini Hackathon problem statement so interesting to me.

The challenge was to build an agentic AI system that behaves like a virtual IPL captain, capable of making live tactical decisions in high-pressure match situations. Instead of building a simple chatbot that produces generic cricket advice, I wanted to create something that actually thinks through decisions the way a real dugout might. That idea became Captain Cool AI.

Captain Cool AI is a multi-agent tactical cricket strategist built entirely on Google’s AI ecosystem using the google-genai Python SDK, Gemini 2.5 Flash, Streamlit, and Python orchestration. The goal was to simulate how a captain, analyst, and tactical advisor might collectively arrive at the next big decision during a live match.

What made this project especially exciting was the multi-agent design. A single AI prompt might simply say, “Use your best bowler now,” but cricket strategy is rarely that straightforward. Real decision-making involves competing perspectives. One person looks at the numbers, another thinks aggressively, someone else challenges the logic, and only then does the final call emerge. I wanted to recreate that process.

To achieve this, I designed four specialized Gemini-powered agents. The Stats Analyst focuses entirely on match intelligence such as venue conditions, batter vs bowler matchups, chase pressure, and dew factor. The Strategist acts like the captain, making the first tactical recommendation. The Devil’s Advocate exists to challenge that decision, forcing the system to consider risks and alternative scenarios. Finally, the Commentator transforms the outcome into cricket-style explainability so the reasoning feels intuitive and engaging rather than technical.

To make the system more grounded, I added supporting tools instead of relying only on prompting. A cricket tactical engine provides matchup heuristics and venue intelligence, a win probability engine adds confidence scoring and counterfactual analysis, and a live weather API helps factor in environmental conditions like dew, which can dramatically affect death-over planning. This combination made the recommendations feel much more realistic and trustworthy.

For the interface, I built a Streamlit dashboard where users can enter the current match state—innings, score, wickets, over, batting and bowling teams, target, required run rate, striker, venue, dew factor, and Impact Player availability. Once submitted, the system runs the multi-agent debate and produces a tactical recommendation along with reasoning, confidence, and alternative scenario analysis.

One of my favorite simulations involved CSK chasing 195 at Wankhede, with 154/4 on the board, MS Dhoni on strike, and heavy dew expected. The Stats Analyst highlighted historical Bumrah vs Dhoni matchups and the impact of weather conditions. The Strategist initially recommended attacking with Bumrah immediately. The Devil’s Advocate pushed back, arguing that using Bumrah too early could create greater risk later in the innings. The Strategist then revised the decision, saving Bumrah for a more decisive over and adjusting the tactical approach. That visible shift in reasoning was exactly the kind of behavior I wanted this system to demonstrate.

Building this project also came with practical lessons. Multi-agent systems produce much richer reasoning than single-shot prompting, but they also introduce latency and quota challenges because each decision involves multiple model calls. Prompt control became critical because early outputs were too verbose for a live demo. Adding deterministic tools significantly improved trust, since recommendations were grounded in actual logic instead of pure language generation.

This project gave me a much better understanding of agentic AI design—not just how to generate responses, but how to orchestrate structured reasoning between specialized agents. That was the most exciting part of the entire build.

Architecture Diagram

graph TD
UI[Streamlit UI] --> O[Orchestrator]
O --> A[Stats Analyst]
A --> S[Strategist]
S --> D[Devil's Advocate]
D --> R[Strategist Revision]
R --> C[Commentator]
C --> UI
Enter fullscreen mode Exit fullscreen mode

The full source code is available here:
GitHub Repository: https://github.com/DhanashriQAEngineer/captain-cool-ai

This was a genuinely fun hackathon build, and watching AI agents debate how to bowl to MS Dhoni in a death-over chase was far more entertaining than I expected.

Special tag: @antrixsh_gupta

Top comments (0)