Captain Cool πβ‘ β A Multi-Agent AI IPL Strategist Powered by Google Gemini
Cricket is chaos. 120 balls. 22 players. Dew factor, pitch cracks, player match-ups, crowd pressure β and you have mere seconds to make game-changing decisions.
I built Captain Cool, a real-time AI web application that acts like an intelligent cricket coach β analyzing situations, debating strategies, and delivering sharp, actionable recommendations just like MS Dhoni in the middle.
Live Demo: Run locally on http://localhost:5176
GitHub: https://github.com/namde-o/Captain-Cool
Built live at Agentic Premier League - Build with AI by GDG Cloud Pune.
π§ The Core Architecture: 4 Specialized Gemini Agents
This isnβt a single prompt chatbot. Itβs a multi-agent system where four independent Gemini agents debate the match situation before arriving at a final strategy.
Sanjay β The Stats Analyst: Cold, data-driven, and numbers-obsessed.
Rohit β The Batting Strategist: Aggressive and always batsman-first.
Bumrah β The Bowling Tactician: Precision-focused wicket hunter.
Harsha β The Final Commentator: Synthesizes all opinions and delivers the final verdict.
Each agent receives the previous agentsβ outputs as context. This creates a natural agentic debate pipeline β Harsha literally reads Sanjay, Rohit, and Bumrahβs arguments before giving the final strategic recommendation.
π΄ Solving the Live Score Challenge
My initial plan was to scrape live scores from Cricbuzz using Geminiβs URL context tool.
It failed hard β Cloudflareβs bot protection blocked every request, feeding Gemini challenge pages instead of scorecards.
The Solution: Geminiβs Google Search Grounding (real-time web search).
Now I send natural language queries like:
"Royal Challengers Bengaluru vs Punjab Kings live score IPL 2025"
Gemini searches the web in real-time, processes the latest information, and returns clean structured JSON. No blocked URLs, no stale data.
JavaScript// Simplified example from liveScore agent
const response = await fetch(
https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${apiKey},
{
method: 'POST',
body: JSON.stringify({
tools: [{ google_search: {} }],
contents: [{
role: 'user',
parts: [{ text: searchQuery }]
}]
})
}
);
β¨ Key Features
Interactive cricket field visualization with glowing hotspots for field placements
Real-time bowler quota tracker
Smart match conditions analyzer (venue, pitch, dew, impact player)
Dynamic strategy engine with win probability shifts
Clean and modern UI built for live match use
Tech Stack
Frontend: React + Vite + Tailwind CSS
AI Engine: Google Gemini 2.0 Flash with Google Search grounding
Architecture: Multi-agent orchestration with custom chaining
Visualization: Canvas/SVG-based cricket field
What I Learned
Multi-agent systems feel magically collaborative when agents have distinct personalities.
Real-time web grounding is a game-changer for live sports applications.
Passion projects (Cricket + AI) make long coding sessions enjoyable.
Giving agents strong identities dramatically improves output quality and entertainment value.
Captain Cool is more than just a project β itβs a fun proof that agentic AI can add real strategic value in fast-paced, dynamic environments like T20 cricket.
Would love to hear your thoughts! Have you built any multi-agent systems? How do you handle live data challenges in your AI apps?
Drop your feedback below π
Top comments (0)