DEV Community

Cover image for Captain Cool - Building a Multi-Agent IPL Strategy Engine with Google Gemini
Rushauti Bhogle
Rushauti Bhogle

Posted on

Captain Cool - Building a Multi-Agent IPL Strategy Engine with Google Gemini

🏏 Captain Cool β€” AI That Thinks Like an IPL Captain

What happens when you combine cricket strategy, multi-agent reasoning, and the Google Gemini ecosystem in a 3-hour hackathon sprint?

You get Captain Cool β€” an AI-powered IPL match strategist where multiple Gemini agents debate tactical cricket decisions like a real dressing room before making the final captain’s call.

Instead of building a generic chatbot with cricket terminology sprinkled on top, we wanted to simulate something much closer to a real IPL strategy room:

  • analysts studying matchups,
  • captains balancing risk,
  • assistant coaches challenging decisions,
  • and commentators explaining the logic to fans.

Built entirely on the Google AI ecosystem, Captain Cool became our attempt at turning agentic AI into a tactical cricket brain.


⚑ The Core Idea

During an IPL match, captains constantly make micro-decisions:

  • Who bowls the next over?
  • Should the spinner continue despite dew?
  • Is it the right moment for the Impact Player?
  • Do we attack or delay Bumrah’s final over?
  • Which field setup reduces boundary probability?

Captain Cool processes the live match state and lets multiple AI agents argue over the best tactical decision before producing a final recommendation.

The result feels surprisingly close to a real cricket strategy meeting.


🧠 Multi-Agent Architecture

Instead of relying on a single prompt, we decomposed the system into specialized Gemini-powered agents.

πŸ•΅οΈ Match Analyst Agent

Responsible for:

  • venue conditions
  • batter vs bowler matchups
  • dew impact
  • phase analysis
  • tactical statistics

This agent also performs tool execution to fetch structured cricket insights.


πŸ’‘ Strategist Agent

The β€œcaptain brain” of the system.

Inspired by tactical IPL leadership styles, this agent:

  • proposes bowling changes,
  • plans death overs,
  • controls field aggression,
  • and balances risk vs reward.

πŸ”₯ Devil’s Advocate Agent

This became the most interesting part of the project.

Its sole responsibility:
challenge the strategist.

Example:

β€œIf we use Bumrah now, who controls the 19th over against Tim David?”

This created genuine multi-agent reasoning instead of fake roleplay.


πŸŽ™οΈ Commentator Agent

The final layer converts raw AI logic into human cricket language.

Instead of:

β€œProbability optimization suggests pace utilization.”

The system explains:

β€œThe pitch is gripping slightly, so bowling pace-off cutters into the surface makes more tactical sense than feeding spin into the arc.”

This dramatically improved explainability.


πŸ”„ The Agentic Debate Loop

Our orchestration flow:

Match State
    ↓
Analyst Agent
    ↓
Strategist Proposal
    ↓
Devil’s Advocate Critique
    ↓
Strategist Revision
    ↓
Commentator Explanation
    ↓
Final Captain's Call
Enter fullscreen mode Exit fullscreen mode

The important part:
the disagreement is visible.

We intentionally expose the internal tactical debate instead of hiding the reasoning.


🧩 Full Runtime Architecture

[ User Inputs Live Match State via Streamlit UI ]
                              β”‚
                              β–Ό
               [ app.py parses to Pydantic Schema ]
                              β”‚
                              β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚      agents.py Orchestrator  β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β–Ό                    β–Ό                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Match Analyst   β”‚  β”‚    Strategist    β”‚  β”‚ Devil's Advocate β”‚
β”‚  (Gemini Flash)  β”‚  β”‚  (Gemini Flash)  β”‚  β”‚  (Gemini Flash)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                     β”‚                     β”‚
         β–Ό                     β”‚                     β”‚
[ NATIVE TOOL CALL ]           β”‚                     β”‚
 (get_matchup_stats)           β”‚                     β”‚
         β”‚                     β”‚                     β”‚
         └──────────────► Multi-Turn Loop β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                               β–Ό
                    [ Ultimate Captain Decree ]
                               β”‚
                               β–Ό
                 [ Rendered via Streamlit Chat ]
Enter fullscreen mode Exit fullscreen mode

This architecture became the backbone of the project.

Instead of a single LLM generating tactical responses, the orchestrator coordinates multiple Gemini-powered specialist agents that challenge, refine, and evolve the decision before presenting the final tactical recommendation.

The visible disagreement between agents transformed the experience from β€œAI answering questions” into a realistic cricket strategy war-room.


πŸ› οΈ Tech Stack

AI & Agent Layer

  • Google Gemini API
  • google-genai SDK
  • Multi-agent orchestration inspired by Google ADK
  • Gemini function/tool calling

Backend

  • Python
  • FastAPI
  • Pydantic

Frontend

  • Streamlit dashboard
  • Custom dark-mode tactical UI

Development Workflow

  • Built using Google Antigravity
  • AI-assisted vibe coding
  • Autonomous file scaffolding and iteration

🏏 Example Match Scenario

We tested Captain Cool using a pressure scenario:

Match Situation

  • RCB vs PBKS
  • 150/2 after 14.2 overs
  • Virat Kohli on strike
  • Yuzvendra Chahal bowling
  • Heavy dew expected later

πŸ“Š Analyst Insight

The Match Analyst agent triggered native tool execution and identified:

  • Kohli performs strongly against traditional spin,
  • but his scoring rate drops against googly-heavy leg-spin variations on slower surfaces.

🧠 Internal Debate

Strategist

β€œAttack with leg-spin now before the dew settles in.”

Devil’s Advocate

β€œRisky. If Kohli survives the first six balls, the short boundary becomes a major issue.”

Strategist Revision

β€œFair. We hold the spinner back for one over and use hard-length pace into the surface first.”


πŸ† Final Captain’s Call

β€œBring back the pace bowler from the Pavilion End. Use cross-seam hard lengths into the pitch and protect square boundaries. Delay spin until the new batter arrives.”


⚑ Biggest Learnings

The most interesting realization from this build:

Multi-agent systems feel dramatically more intelligent when disagreement is visible.

The Devil’s Advocate agent consistently improved decisions by forcing counterfactual thinking.

Instead of:
β€œone smart AI”

the project started feeling like:
β€œa real strategy room.”


πŸ“Έ Screenshots

Streamlit Tactical Dashboard

(Add your UI screenshot here)

Antigravity Development Workflow

(Add your Antigravity + code screenshot here)

Multi-Agent Debate Output

(Add your debate screenshot here)


πŸš€ Future Improvements

If we continue developing Captain Cool, the next additions would be:

  • Live Cricbuzz/ESPN integration
  • Real-time win probability engine
  • Voice commentary using Gemini Live API
  • Memory across overs
  • Multimodal pitch image analysis
  • Full Google ADK orchestration

πŸ“‚ GitHub Repository

πŸ‘‰ https://github.com/So-rush/captain-cool


🏏 Final Thoughts

Cricket is ultimately a captain’s game.

Captain Cool was our attempt to explore what happens when tactical sports intelligence meets agentic AI reasoning inside the Google Gemini ecosystem.

And honestly…

watching AI agents argue about death-over bowling plans was way more fun than expected. πŸ†

Top comments (0)