DEV Community

KHAN REHAN
KHAN REHAN

Posted on

🏏 CaptainCool AI — Building a Multi-Agent IPL War Room with Gemini 2.5

Modern T20 cricket is a tactical war room.

Captains constantly calculate:

  • bowling matchups
  • dew impact
  • field placements
  • momentum shifts
  • death-over strategy
  • batter weaknesses

So we asked ourselves:

“What if IPL captains had an AI tactical command center?”

That became CaptainCool AI — a Gemini-powered multi-agent IPL strategist that thinks like a real captain under pressure.


🚀 What is CaptainCool AI?

CaptainCool AI is a multi-agent AI system that simulates an IPL captain’s decision-making process in real time.

The user enters:

  • score
  • wickets
  • overs
  • venue
  • pitch conditions
  • dew factor
  • current batters
  • bowlers remaining

Then multiple AI agents debate the best tactical move before generating the final captain’s decision.

Instead of acting like a generic chatbot, the system behaves like a real IPL war room.


🧠 The Core Idea

Most sports AI projects simply generate commentary.

We wanted something deeper:

  • tactical reasoning
  • disagreement between agents
  • live cricket analytics
  • explainable decisions
  • real-time debate

So we designed a multi-agent architecture powered by Google Gemini 2.5 Flash.


⚡ The Multi-Agent System

CaptainCool AI uses 5 specialized agents.

1️⃣ Strategist Agent

Acts like the tactical captain.

Inspired by:

  • MS Dhoni
  • Rohit Sharma
  • Hardik Pandya

Responsibilities:

  • choose next bowler
  • field placements
  • bowling rotation
  • timeout timing
  • impact player decisions

2️⃣ Stats Analyst Agent

The data-driven cricket analyst.

Uses tools to analyze:

  • batter vs bowler matchups
  • win probability
  • pitch behavior
  • dew impact
  • venue patterns

This agent actively performs Gemini tool calling.


3️⃣ Devil’s Advocate Agent

The most important agent.

This agent intentionally challenges the proposed strategy.

Example:

“Bowling leg-spin in heavy dew could backfire because grip reduction is significant.”

This prevents shallow AI reasoning and creates real tactical debate.


4️⃣ Strategist Revision Agent

After criticism, the strategist revises or defends the plan.

This creates genuine multi-turn reasoning instead of fake “multi-agent roleplay.”


5️⃣ Commentator Agent

Transforms tactical reasoning into cinematic IPL-style commentary.

This made the experience feel like:

  • live sports broadcasting
  • tactical television analysis
  • IPL commentary panels

🏗️ Architecture

Our architecture was built using:

  • FastAPI
  • Vanilla HTML/CSS/JS
  • Google Gemini 2.5 Flash
  • SSE Streaming
  • Multi-agent orchestration
  • Gemini tool calling

Flow

User Input
   ↓
FastAPI Backend
   ↓
Orchestrator
   ↓
Strategist Agent
   ↓
Stats Agent + Tools
   ↓
Devil's Advocate
   ↓
Strategist Revision
   ↓
Commentator
   ↓
Oracle Decision Engine
   ↓
Live Streaming Frontend
Enter fullscreen mode Exit fullscreen mode

🔧 Gemini Tool Calling

One of the biggest goals was making the system genuinely “agentic.”

So we implemented real Gemini tool usage.

Tools Used

  • get_matchup_stats()
  • calculate_win_probability()
  • get_pitch_conditions()
  • get_weather_and_dew()
  • fetch_player_recent_form()

These tools allow the AI agents to reason using structured cricket intelligence instead of hallucinating tactics.

Example:

{
  "bowler": "Jadeja",
  "batter": "Rohit Sharma",
  "strike_rate": 162,
  "dismissals": 2
}
Enter fullscreen mode Exit fullscreen mode

🎨 Frontend Experience

We didn’t want a normal dashboard.

We wanted:

“F1 race strategy room meets IPL broadcast studio.”

So we built:

  • futuristic glassmorphism UI
  • tactical war-room aesthetic
  • live AI debate feed
  • streaming agent messages
  • animated tactical cards
  • dynamic field visualization
  • momentum engine
  • confidence meters
  • Gemini health monitor

The frontend was built entirely using:

  • HTML
  • TailwindCSS
  • Vanilla JavaScript

No React.


⚔️ The Debate System

This was the most exciting part.

Instead of a single AI response, agents actually challenge each other.

Example flow:

Strategist

“Bring Bumrah now for wide yorkers.”

Stats Analyst

“Yorkers reduced boundary percentage by 41% tonight.”

Devil’s Advocate

“But the left-hander has a strong scoop-shot range against wide yorkers.”

Strategist Revision

“Adjusting field: deep third goes finer.”

This made the system feel alive.


📡 Real-Time Streaming

We implemented:

  • SSE (Server Sent Events)
  • async FastAPI streaming
  • live agent feed
  • cinematic loading states
  • reconnect handling
  • retry management

The UI streams each tactical message in real time like a live war-room broadcast.


🛡️ Solving Gemini Free-Tier Challenges

One of the hardest parts was handling Gemini rate limits.

Initially:

  • too many agents
  • too many requests
  • quota crashes

We optimized heavily by:

  • reducing prompt size
  • compressing debate context
  • caching responses
  • adding retry queues
  • exponential backoff
  • fallback tactical logic
  • lightweight local synthesis

This made the demo stable enough for hackathon environments.


🎙️ Fun Features

We also added:

  • voice commentary
  • captain personality modes
  • tactical alerts
  • cinematic intro audio
  • animated reconnect states
  • backend diagnostics
  • fallback tactical engine

💡 What We Learned

This project taught us something important:

Multi-agent systems become powerful when agents genuinely disagree.

The Devil’s Advocate agent dramatically improved tactical quality because it forced deeper reasoning.

We also learned:

  • streaming UX matters a lot
  • tool calling makes AI feel trustworthy
  • sports strategy is a perfect use case for agentic AI

🚀 Final Thoughts

CaptainCool AI started as:

“What if Dhoni had AI assistants in his earpiece?”

It evolved into:

  • a tactical cricket simulator
  • a real-time AI debate system
  • a multi-agent sports intelligence platform

And honestly?

Watching AI agents argue about IPL death-over tactics is ridiculously fun.


🏏 Tech Stack

  • Google Gemini 2.5 Flash
  • FastAPI
  • Python
  • Vanilla JavaScript
  • TailwindCSS
  • SSE Streaming
  • Gemini Tool Calling

🔥 Future Improvements

We’d love to add:

  • live Cricbuzz integration
  • real scorecard ingestion
  • multimodal pitch analysis
  • AI-generated field maps
  • voice conversations with captains
  • real-time match simulations

👋 Thanks for Reading

If you love:

  • cricket
  • AI agents
  • sports analytics
  • Gemini-powered systems

then CaptainCool AI was built for you.

🏏⚡
🏏 Built CaptainCool AI — a Gemini-powered multi-agent IPL war room that thinks like a real captain under pressure.

⚡ Strategist Agent
📊 Stats Analyst
😈 Devil’s Advocate
🎙️ Commentator AI

Real tactical debate. Real tool calling. Real-time streaming. Built with Google Gemini 2.5 + FastAPI + Vanilla JS.

“What if Dhoni had AI analysts in his earpiece?” 👀

Huge shoutout to the amazing community and energy around building agentic AI systems 🚀

GoogleGemini #GeminiAI #GDG #GDGPune #GoogleDeveloperGroups #AI #AgenticAI #IPL #Hackathon #FastAPI #Python #WebDevelopment #GenerativeAI #GoogleAI #MultiAgentSystems #BuildWithAI #CloudCommunity #SportsAI

@GDG Pune @GDG Cloud Pune

Top comments (0)