<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Eakansh Kshirsagar</title>
    <description>The latest articles on DEV Community by Eakansh Kshirsagar (@eakansh).</description>
    <link>https://dev.to/eakansh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3936252%2F1b04e1a3-46d3-465f-9c66-6ab84308e49e.jpg</url>
      <title>DEV Community: Eakansh Kshirsagar</title>
      <link>https://dev.to/eakansh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eakansh"/>
    <language>en</language>
    <item>
      <title>🏏 Captain Cool: Building a Multi-Agent IPL Match Strategist on Google Gemini and FastAPI</title>
      <dc:creator>Eakansh Kshirsagar</dc:creator>
      <pubDate>Sun, 17 May 2026 12:54:44 +0000</pubDate>
      <link>https://dev.to/eakansh/captain-cool-building-a-multi-agent-ipl-match-strategist-on-google-gemini-and-fastapi-52dk</link>
      <guid>https://dev.to/eakansh/captain-cool-building-a-multi-agent-ipl-match-strategist-on-google-gemini-and-fastapi-52dk</guid>
      <description>&lt;p&gt;Imagine having the tactical minds of MS Dhoni, Rohit Sharma, and Hardik Pandya arguing inside a virtual "IPL War Room" to decide the &lt;strong&gt;NEXT absolute tactical move&lt;/strong&gt; in a live, high-pressure match. &lt;/p&gt;

&lt;p&gt;That is &lt;strong&gt;Captain Cool&lt;/strong&gt; — an advanced, agentic AI match strategist built for the Google Gemini Hackathon. By combining &lt;strong&gt;Google Gemini 2.5 Flash&lt;/strong&gt;, &lt;strong&gt;Python FastAPI&lt;/strong&gt;, and a sleek &lt;strong&gt;React + TailwindCSS glassmorphism dashboard&lt;/strong&gt;, Captain Cool models a multi-turn agentic debate to recommend bowler rotations, field setups, timeout strategies, and impact player deployments.&lt;/p&gt;

&lt;p&gt;In this blog post, we'll dive deep under the hood of the multi-agent architecture, show the prompt engineering behind our agents, explain how we implemented Gemini Function Calling for statistical calculations, and walk through a live scenario end-to-end.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔗 Project Links &amp;amp; Demos
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;💻 GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/Eakansh05/Captain-Cool" rel="noopener noreferrer"&gt;https://github.com/Eakansh05/Captain-Cool&lt;/a&gt; (100% open-source &amp;amp; fully configured!)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🎨 Live Dashboard UI:&lt;/strong&gt; Sleek, responsive obsidian-themed Cricket Command Center.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🏗️ Multi-Agent Architecture &amp;amp; Flow
&lt;/h2&gt;

&lt;p&gt;A single-prompt LLM wrapper is a generic chatbot with cricket lipstick. To build a true captain-strategist, we decomposed the decision-making pipeline into &lt;strong&gt;4 distinct, named Gemini-powered agents&lt;/strong&gt; executing sequentially in a structured debate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                      +-------------------+
                      |   POST /strategy  |
                      +---------+---------+
                                |
                                v
                   +------------+------------+
                   |  calculate_win_probability | &amp;lt;-------+
                   |      (Python Tool)      |         |
                   +------------+------------+         | (Gemini Function Calling)
                                |                      |
                                v                      |
                   +------------+------------+         |
                   |    Stats Analyst Agent  | --------+
                   |     (analyst.py)        |
                   +------------+------------+
                                |
                                v
                   +------------+------------+
                   | Captain Strategist Agent|  (Initial Plan Proposal)
                   |    (strategist.py)      |
                   +------------+------------+
                                |
                                v
                   +------------+------------+
                   |  Devil's Advocate Agent |  (Aggressive Counter-Argument)
                   |      (devil.py)         |
                   +------------+------------+
                                |
                                v
                   +------------+------------+
                   | Captain Strategist Agent|  (Defends/Revises Plan -&amp;gt; Final Call)
                   |    (strategist.py)      |
                   +------------+------------+
                                |
                                v
                   +------------+------------+
                   |    Commentator Agent    |  (High-Octane Cricket Explainability)
                   |    (commentator.py)     |
                   +------------+------------+
                                |
                                v
                    +-----------+-----------+
                    |  API Response Output  |
                    +-----------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🤖 Meet the 4 Gemini Agents &amp;amp; Their Prompts
&lt;/h2&gt;

&lt;p&gt;Each agent runs on a separate google-genai client thread with unique system instructions and temperature settings:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. 📊 Stats Analyst (&lt;code&gt;analyst.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Role:&lt;/strong&gt; Factual, numbers-driven, analytical.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System Prompt Essence:&lt;/strong&gt;
"You are the Stats Analyst for an elite IPL cricket team. Your job is to take raw match states, analyze them using your mathematical win-probability tool, and highlight tactical mismatches (e.g., batsman vs bowler type, boundary dimensions, dew factor)."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Temperature:&lt;/strong&gt; 0.1 (strict, factual precision).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. 🧢 Captain Strategist (&lt;code&gt;strategist.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Role:&lt;/strong&gt; Decisive, tactical, calm under pressure (Dhoni/Rohit personality).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System Prompt Essence:&lt;/strong&gt;
"You are the Captain Strategist. You propose the initial tactical setup (next bowler, field layout,Timeout, and Impact player) and later revise the plan based on the Devil's Advocate's objections."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Temperature:&lt;/strong&gt; 0.4 (balanced, pragmatic).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. 😈 Devil's Advocate (&lt;code&gt;devil.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Role:&lt;/strong&gt; Highly critical, aggressive opposition strategist.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System Prompt Essence:&lt;/strong&gt;
"You are the Devil's Advocate. Your sole purpose is to find vulnerabilities in the captain's proposed plan. Object aggressively, point out boundary sizes, and suggest high-intensity alternative attacks."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Temperature:&lt;/strong&gt; 0.7 (highly creative, aggressive).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. 🎙️ IPL Commentator (&lt;code&gt;commentator.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Role:&lt;/strong&gt; Passionate, authentic, high-octane speaker.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System Prompt Essence:&lt;/strong&gt;
"You are the legendary IPL Commentator. Synthesize the raw debate logs into a cohesive, high-octane commentary explainer in authentic cricket talk (e.g., 'the leggie is wasted against a left-arm pinch hitter in heavy dew'). Use formatting, emojis, and bold tags."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Temperature:&lt;/strong&gt; 0.85 (fan-friendly entertainment).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛠️ Gemini Function Calling (Tool-Use)
&lt;/h2&gt;

&lt;p&gt;To ensure the AI decisions are grounded in mathematics rather than hallucinations, we equipped the &lt;strong&gt;Stats Analyst&lt;/strong&gt; with a custom python statistical calculation tool: &lt;code&gt;calculate_win_probability&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Rather than hardcoding outputs, we leverage &lt;strong&gt;Gemini Function Calling&lt;/strong&gt;. When presented with a match state, Gemini dynamically decides to call this local tool, gets the parsed metrics back, and integrates it into the debate.&lt;/p&gt;

&lt;p&gt;The tool crunches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current Run Rate (CRR) &amp;amp; Required Run Rate (RRR)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live Win Probability:&lt;/strong&gt; Adjusts based on wickets in hand, chase pressure, dew levels, and pitch par scores.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pressure Index:&lt;/strong&gt; Categorized as &lt;code&gt;LOW&lt;/code&gt;, &lt;code&gt;MEDIUM&lt;/code&gt;, or &lt;code&gt;HIGH&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Suggested Bowler Type:&lt;/strong&gt; Evaluates pitch conditions (turning/flat) and dew levels to suggest pace vs spin.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🏆 Innovation Spotlight: The Dual-Mode Pitch Switcher
&lt;/h2&gt;

&lt;p&gt;One major problem with pitching live LLM applications at hackathons is &lt;strong&gt;API Rate Limiting (429 Quota Exhaustion)&lt;/strong&gt; on free-tier keys. &lt;/p&gt;

&lt;p&gt;To make Captain Cool &lt;strong&gt;100% crash-proof and ready for a flawless live pitch&lt;/strong&gt;, we engineered a &lt;strong&gt;Dual-Mode Switcher&lt;/strong&gt; in the navbar:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Simulated Demo Mode (Default):&lt;/strong&gt; Runs an offline dynamic strategy simulator instantly (in under 0.5s) and &lt;strong&gt;suppresses all rate-limit warning banners&lt;/strong&gt;. The dashboard looks 100% clean and pristine—perfect for a flawless pitch under tight time constraints!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live Gemini Mode:&lt;/strong&gt; Connects in real-time to Google Gemini servers to run the active multi-agent debate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Graceful Fallback:&lt;/strong&gt; If you're in Live mode and run out of quota, the server automatically falls back to simulated mode and displays a helpful gold advisory banner on how to paste a custom key override.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🏏 End-to-End Walkthrough Scenario: Death-Over Chase (MI vs CSK)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The Match State Input:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Situation:&lt;/strong&gt; 2nd Innings, Over 15.2, Score: 118/5, Target: 168 (50 runs needed from 28 balls).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batting Side:&lt;/strong&gt; Mumbai Indians (Hardik Pandya on strike, Krunal Pandya at non-striker).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bowling Side:&lt;/strong&gt; Chennai Super Kings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pitch Condition:&lt;/strong&gt; Turning track with low dew.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bowlers Roster:&lt;/strong&gt; Ravindra Jadeja (3 overs used), Mitchell Santner (2 overs used), Matheesha Pathirana (1.2 overs used).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. The Internal Agent Debate Transcript:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stats Analyst Tool Run:&lt;/strong&gt; Win Probability crunched as CSK (Bowling Team): &lt;code&gt;99%&lt;/code&gt; | MI (Batting Team): &lt;code&gt;1%&lt;/code&gt; (due to high wickets lost and turning track difficulty). Required Run Rate is &lt;code&gt;10.71&lt;/code&gt;. Spin is highly recommended.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strategist (Initial Plan):&lt;/strong&gt; Proposes bowling Ravindra Jadeja next with a conservative deep-cover boundary-riding field to dry up the runs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Devil's Advocate Objection:&lt;/strong&gt; &lt;em&gt;"Objection! Jadeja bowling to two left/right hand batsmen who are strong sweepers is too safe. They will settle. We need to attack the stumps directly. Bring Mitchell Santner on to bowl flat and slow on this turning pitch, and introduce catchers at short fine leg to induce an edge!"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strategist Final Revision:&lt;/strong&gt; &lt;em&gt;"The Devil's Advocate is correct. Squeezing them now is key. We will bowl Mitchell Santner, but with an aggressive catching trap, adding a short fine leg and extra cover. Let's attack the stumps and take the strategic timeout immediately to build pressure."&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. The Commentator Explainer Output on UI:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🧢 CAPTAIN'S CALL
- Next Over Bowler: Mitchell Santner
- Field Setup: Aggressive catching trap, adding short fine leg and extra cover.
- Plan: Bowled flat and slow into the turning pitch, attacking the stumps directly.
- Strategic Timeout: Take immediately!

📌 WHY THIS MOVE
Pressure levels are HIGH. Containing is no longer viable; we must take wickets to break the chase momentum. Mitchell Santner's left-arm orthodox is lethal on a turning pitch with low dew, letting us target Hardik Pandya's front-foot weakness directly!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🚀 How to Run It Locally
&lt;/h2&gt;

&lt;p&gt;Get up and running in under 2 minutes:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Backend FastAPI:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;backend
python &lt;span class="nt"&gt;-m&lt;/span&gt; venv venv
venv&lt;span class="se"&gt;\S&lt;/span&gt;cripts&lt;span class="se"&gt;\a&lt;/span&gt;ctivate
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;span class="nb"&gt;cp&lt;/span&gt; .env.example .env  &lt;span class="c"&gt;# Add your Gemini Key&lt;/span&gt;
uvicorn main:app &lt;span class="nt"&gt;--reload&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Frontend React:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;frontend
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;strong&gt;&lt;code&gt;http://localhost:5173/&lt;/code&gt;&lt;/strong&gt; to interact with the strategist deck!&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 What We Learned Building on Google Antigravity
&lt;/h2&gt;

&lt;p&gt;Building this during a tight vibe-coding session using &lt;strong&gt;Google Antigravity&lt;/strong&gt; allowed us to prototype agents iteratively. The seamless integration of Python schemas, FastAPI routers, and React component bindings let us build a premium, multi-agent product rather than just a minimum viable wrapper.&lt;/p&gt;

&lt;p&gt;We are incredibly excited to share this with the community! Leave a ⭐ on our GitHub Repository if you love the architecture, and let us know your tactical cricket plays in the comments! 🏏🔥🏆&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Shoutout to the amazing team and organizers at *&lt;/em&gt;#gdgcloudpune** for hosting this stellar hackathon initiative!*&lt;/p&gt;

&lt;h3&gt;
  
  
  🏷️ Discover &amp;amp; Share:
&lt;/h3&gt;

&lt;h1&gt;
  
  
  gdgcloudpune #googleai #geminidevelopers #agenticai #ipl2026 #cricketanalytics #fastapi #reactjs #pitchstrategy #devto
&lt;/h1&gt;

</description>
      <category>gdgcloudpune</category>
      <category>googleaichallenge</category>
      <category>geminidevelopers</category>
      <category>antigravity</category>
    </item>
  </channel>
</rss>
