<?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: Mrunal Jadhav</title>
    <description>The latest articles on DEV Community by Mrunal Jadhav (@mrunal_jadhav_a320).</description>
    <link>https://dev.to/mrunal_jadhav_a320</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%2F3936024%2F9f4c412f-0d3c-4a48-93d9-96d84a047f9c.png</url>
      <title>DEV Community: Mrunal Jadhav</title>
      <link>https://dev.to/mrunal_jadhav_a320</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mrunal_jadhav_a320"/>
    <language>en</language>
    <item>
      <title>Captain Cool: I Built MS Dhoni's AI Brain Using Google Gemini — and It Wins Tactical Debates in 3 Seconds</title>
      <dc:creator>Mrunal Jadhav</dc:creator>
      <pubDate>Sun, 17 May 2026 12:52:39 +0000</pubDate>
      <link>https://dev.to/mrunal_jadhav_a320/captain-cool-i-built-ms-dhonis-ai-brain-using-google-gemini-and-it-wins-tactical-debates-in-3-4kjg</link>
      <guid>https://dev.to/mrunal_jadhav_a320/captain-cool-i-built-ms-dhonis-ai-brain-using-google-gemini-and-it-wins-tactical-debates-in-3-4kjg</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Cricket is a captain's game. But what if the captain had four genius analysts living inside a machine, debating at the speed of light — and all of it powered by Google Gemini?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's exactly what I built.&lt;br&gt;
Captain Cool is a multi-agent IPL match strategist: feed it a live match situation, and it kicks off an internal war-room debate between four distinct AI agents, each with a sharp personality and a specific job. The output isn't a chatbot response. It's a captain's call — with the receipts showing exactly how the decision was made, who challenged it, and why the final answer won the argument.&lt;br&gt;
Built in under 3 hours during a vibe-coding session in Google Antigravity. Powered entirely on the Google Gemini stack. Zero non-Gemini models. Let's walk through it.&lt;/p&gt;

&lt;p&gt;🧠 The Problem Worth Solving&lt;br&gt;
Every IPL match has a moment — usually around the 15th over — where the captain makes one decision that either wins or loses the game. Bumrah now or Bumrah later? Spinner in dew? Pinch-hitter or trust the set batsman?&lt;br&gt;
These aren't simple calculations. They're multi-variable debates with no clean answer. That's exactly why a multi-agent system, where agents genuinely disagree, is the right architecture here — not a single model pretending to think.&lt;/p&gt;

&lt;p&gt;🏗️ Architecture: The War Room&lt;br&gt;
Here's how the full system is wired:&lt;br&gt;
User Input (Match State)&lt;br&gt;
        │&lt;br&gt;
        ▼&lt;br&gt;
┌─────────────────────┐&lt;br&gt;
│   Stats Analyst     │──► getWeatherForVenue() ──► Open-Meteo API&lt;br&gt;
│  (Gemini 2.5 Flash) │ (Real tool call via GeminiFunction Calling)&lt;br&gt;
└─────────────────────┘&lt;br&gt;
        │ Statistical + conditions report&lt;br&gt;
        ▼&lt;br&gt;
┌─────────────────────┐&lt;br&gt;
│  Captain Strategist │──► Proposes initial tactical decision&lt;br&gt;
│  (Gemini 2.5 Flash) │&lt;br&gt;
└─────────────────────┘&lt;br&gt;
        │ Proposal&lt;br&gt;
        ▼&lt;br&gt;
┌─────────────────────┐&lt;br&gt;
│  Devil's Advocate   │──► Challenges the proposal hard&lt;br&gt;
│  (Gemini 2.5 Flash) │&lt;br&gt;
└─────────────────────┘&lt;br&gt;
        │ Counter-argument&lt;br&gt;
        ▼&lt;br&gt;
┌─────────────────────┐&lt;br&gt;
│  Captain Strategist │──► Defends or revises final decision&lt;br&gt;
│  (Gemini 2.5 Flash) │       (The multi-turn loop closes here)&lt;br&gt;
└─────────────────────┘&lt;br&gt;
        │ Final call&lt;br&gt;
        ▼&lt;br&gt;
┌─────────────────────┐&lt;br&gt;
│  Match Commentator  │──► TV-quality explanation for the fans&lt;br&gt;
│  (Gemini 2.5 Flash) │&lt;br&gt;
└─────────────────────┘&lt;br&gt;
        │&lt;br&gt;
        ▼&lt;br&gt;
   Final Output Card&lt;br&gt;
   (Decision + Reasoning + Counterfactual + Commentary)&lt;br&gt;
Tech stack used:&lt;/p&gt;

&lt;p&gt;Google Gemini 2.5 Flash — all four agents, every call&lt;br&gt;
Google Antigravity — the IDE powering the entire vibe-coding session (see .antigravity/ traces in the repo)&lt;br&gt;
Gemini Function Calling — the Stats Analyst makes a real live tool call to fetch weather/dew data&lt;br&gt;
Open-Meteo API — free, no key needed, returns temperature, humidity, and dew point for every IPL venue city&lt;br&gt;
React + Vite + TailwindCSS — glassmorphic IPL broadcast-style UI &lt;/p&gt;

&lt;p&gt;🤖 The Four Agents: Prompts, Personalities, and Purpose&lt;br&gt;
This is the part most teams get wrong. A single Gemini call wearing four hats isn't multi-agent — it's just a long prompt. Captain Cool makes four separate, sequential Gemini API calls, each with its own system prompt, its own personality, and its own job to do.&lt;br&gt;
Agent 1 — The Stats Analyst 📊&lt;br&gt;
"The numbers never lie. The captain might."&lt;br&gt;
Role: Cold, precise, data-first. Before forming any opinion, this agent calls a real external tool — the getWeatherForVenue() function — via Gemini's native function calling. It fetches live temperature, humidity, and dew point for the venue city, then synthesises that with the match state.&lt;br&gt;
System prompt:&lt;br&gt;
You are the Stats Analyst for the fielding team in an IPL match. You speak &lt;br&gt;
only in numbers, matchup percentages, and conditions analysis. Never give &lt;br&gt;
tactical opinions. &lt;/p&gt;

&lt;p&gt;Use the 'getWeatherForVenue' tool to check live weather and dew conditions &lt;br&gt;
for the venue. Then produce a structured analysis covering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Current required run rate vs projected rate&lt;/li&gt;
&lt;li&gt;Key batter vs bowler matchup risks&lt;/li&gt;
&lt;li&gt;Dew factor severity and its impact on grip/swing&lt;/li&gt;
&lt;li&gt;Death-over economy rates for remaining bowlers&lt;/li&gt;
&lt;li&gt;Win probability estimate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Format your output as a concise analytical brief. No fluff.&lt;br&gt;
What makes this agentic: The model decides on its own to call getWeatherForVenue. It isn't hardcoded. Gemini's function calling lets the agent autonomously trigger the API when it deems the weather context relevant — which it always is for a dew-affected venue like Wankhede or Eden Gardens.&lt;/p&gt;

&lt;p&gt;Agent 2 — The Captain Strategist 🏆&lt;br&gt;
"Calm. Calculating. Sees three overs ahead."&lt;br&gt;
Role: MS Dhoni energy — never panics, plays the percentages, always has a plan. Receives the Analyst's full report and proposes one concrete tactical decision: who bowls, who bats, when to use the Impact Player, whether to take the strategic timeout.&lt;br&gt;
System prompt:&lt;br&gt;
You are the Head Coach and Captain of an IPL team — think MS Dhoni's &lt;br&gt;
tactical brain. You are calm, calculating, and always think 3 overs ahead.&lt;/p&gt;

&lt;p&gt;You speak in cricket language: 'the leggie is wasted against a &lt;br&gt;
left-hander in dew', 'this is a wicket-taking length on this pitch', &lt;br&gt;
'we need the powerplay cushion here'.&lt;/p&gt;

&lt;p&gt;Based on the Stats Analyst's report, make ONE specific tactical call. &lt;br&gt;
Specify: who bowls the next over, any field adjustment, whether to use &lt;br&gt;
the Impact Player. Give your reasoning in 3-4 sentences of cricket talk.&lt;/p&gt;

&lt;p&gt;Agent 3 — The Devil's Advocate 🔥&lt;br&gt;
"Safe is just another word for losing slowly."&lt;br&gt;
Role: Virender Sehwag's aggressive contrarian brain. Its only job is to find the flaw in the Captain's plan and argue loudly for the alternative. It makes the system genuinely agentic — without a challenger, the Captain never has to defend anything.&lt;br&gt;
System prompt:&lt;br&gt;
You are the Devil's Advocate in the IPL team's think-tank. You are &lt;br&gt;
aggressive, attacking, and you never agree with playing safe.&lt;/p&gt;

&lt;p&gt;Your job is to poke holes in the Captain's proposed decision. Find the &lt;br&gt;
specific flaw. Point out the matchup risk, the dew factor, the fatigue, &lt;br&gt;
the predictability. Use cricket language. Give one strong counter-proposal.&lt;/p&gt;

&lt;p&gt;Do NOT agree with the Captain. Be specific. Be aggressive.&lt;/p&gt;

&lt;p&gt;Agent 4 — The Match Commentator 🎙️&lt;br&gt;
"And that, ladies and gentlemen, is the masterstroke of the night."&lt;br&gt;
Role: Harsha Bhogle's voice — eloquent, emotional, fan-first. After the debate resolves, this agent translates the final tactical call into TV-broadcast cricket language. No ML jargon. No probabilities. Just pure cricket storytelling.&lt;br&gt;
System prompt:&lt;br&gt;
You are an IPL TV Commentator — think Harsha Bhogle on a big final night.&lt;/p&gt;

&lt;p&gt;The team's think-tank just debated and reached a final decision. Your job &lt;br&gt;
is to explain this tactical call to 10 million fans watching at home. Use &lt;br&gt;
vivid cricket analogies, build the drama, and make the decision feel &lt;br&gt;
inevitable in hindsight. Keep it to 3-4 sentences. Zero jargon.&lt;/p&gt;

&lt;p&gt;🌩️ The Tool Call: Where It Gets Real&lt;br&gt;
The Analyst agent doesn't just guess about dew. It calls the real world.&lt;br&gt;
Here's the actual function declaration registered with Gemini:&lt;br&gt;
typescriptconst tools: Tool[] = [{&lt;br&gt;
  functionDeclarations: [{&lt;br&gt;
    name: "getWeatherForVenue",&lt;br&gt;
    description: "Fetches live weather conditions for an IPL stadium city including temperature, humidity, and dew point to assess dew factor risk during evening matches.",&lt;br&gt;
    parameters: {&lt;br&gt;
      type: SchemaType.OBJECT,&lt;br&gt;
      properties: {&lt;br&gt;
        city: {&lt;br&gt;
          type: SchemaType.STRING,&lt;br&gt;
          description: "The city where the IPL venue is located, e.g. 'Mumbai', 'Chennai', 'Kolkata'"&lt;br&gt;
        }&lt;br&gt;
      },&lt;br&gt;
      required: ["city"]&lt;br&gt;
    }&lt;br&gt;
  }]&lt;br&gt;
}];&lt;br&gt;
And the actual API call behind it:&lt;br&gt;
typescriptasync function getWeatherForVenue(city: string) {&lt;br&gt;
  // Geocode city → coordinates&lt;br&gt;
  const geoRes = await fetch(&lt;br&gt;
    &lt;code&gt;https://geocoding-api.open-meteo.com/v1/search?name=${city}&amp;amp;count=1&lt;/code&gt;&lt;br&gt;
  );&lt;br&gt;
  const geoData = await geoRes.json();&lt;br&gt;
  const { latitude, longitude } = geoData.results[0];&lt;/p&gt;

&lt;p&gt;// Fetch live weather&lt;br&gt;
  const weatherRes = await fetch(&lt;br&gt;
    &lt;code&gt;https://api.open-meteo.com/v1/forecast?latitude=${latitude}&amp;amp;longitude=${longitude}&amp;amp;current=temperature_2m,relative_humidity_2m,dew_point_2m,wind_speed_10m&lt;/code&gt;&lt;br&gt;
  );&lt;br&gt;
  const weather = await weatherRes.json();&lt;/p&gt;

&lt;p&gt;return {&lt;br&gt;
    temperature: weather.current.temperature_2m,&lt;br&gt;
    humidity: weather.current.relative_humidity_2m,&lt;br&gt;
    dewPoint: weather.current.dew_point_2m,&lt;br&gt;
    windSpeed: weather.current.wind_speed_10m,&lt;br&gt;
    dewRisk: weather.current.relative_humidity_2m &amp;gt; 70 ? "HIGH" : &lt;br&gt;
             weather.current.relative_humidity_2m &amp;gt; 55 ? "MODERATE" : "LOW"&lt;br&gt;
  };&lt;br&gt;
}&lt;br&gt;
Gemini decides autonomously whether to call this tool. When it does, the UI shows a live badge: 🔧 Tool Used: Open-Meteo Weather API — Mumbai: 28°C, 78% humidity, DEW RISK: HIGH.&lt;br&gt;
Real data. Real decisions.&lt;/p&gt;

&lt;p&gt;🏏 Live Walkthrough: The Death Over Dilemma&lt;br&gt;
The situation: Wankhede Stadium, 16th over, MI vs CSK 2nd innings. CSK needs 47 off 24. Score: 154/4. Dhoni on strike. Jadeja at the non-striker's end. Bumrah has 3 overs remaining. Heavy dew settling on the outfield.&lt;br&gt;
Here's how the war room played out:&lt;/p&gt;

&lt;p&gt;📊 Stats Analyst:&lt;/p&gt;

&lt;p&gt;Tool call fired: getWeatherForVenue("Mumbai")&lt;br&gt;
Result: 29°C, 81% humidity, dew point 25°C — DEW RISK: HIGH&lt;br&gt;
"CSK require 47 off 24 balls — required rate 11.75. Bumrah's death-over economy this season: 8.2. Boult: 9.1. Dhoni's T20 strike rate vs pace in death overs: 182. Vs spin: 134. High humidity confirmed — ball gripping will deteriorate sharply by the 18th over. Win probability MI: 58%."&lt;/p&gt;

&lt;p&gt;🏆 Captain Strategist (Initial Proposal):&lt;/p&gt;

&lt;p&gt;"Simple. Bowl Bumrah now. Finish his quota, dismiss Dhoni, preserve the 18th and 20th overs for Boult who handles the wet ball better. Set a deep backward square leg for the pull. Bumrah vs Dhoni is our best match-up — we take it now."&lt;/p&gt;

&lt;p&gt;🔥 Devil's Advocate:&lt;/p&gt;

&lt;p&gt;"Terrible idea. You burn Bumrah in the 16th and you've handed CSK the 18th over on a plate. Dhoni doesn't need to smash Bumrah — he just needs to survive this over. You'll have 2 overs of Bumrah left when CSK need 30 off 12, Dhoni is seeing it like a football, and the ball is wet. You've just built him the perfect runway. Bowl Chawla or Pollard now. Accept 10-12 this over. Save Bumrah for when it truly hurts — over 18 and 20."&lt;/p&gt;

&lt;p&gt;🏆 Captain Strategist (Revised Final Call):&lt;/p&gt;

&lt;p&gt;"Conceded. The 18th-over argument wins. Chawla bowls the 16th — push all fielders to the boundary, accept the singles, deny the boundary. The goal is to keep Dhoni off strike as much as possible. Bumrah locked for the 18th. If CSK need 30 off 12 with a wet ball, Bumrah vs Dhoni in the 18th is our over, not the 16th."&lt;/p&gt;

&lt;p&gt;🎙️ Match Commentator:&lt;/p&gt;

&lt;p&gt;"Oh, WHAT a strategic switch! They're holding back the ace — Jasprit Bumrah stays in the dugout! Ravindra Jadeja's bowling partner Kuldeep Chawla takes the ball instead, with MI accepting the risk of this over to set a trap for the 18th! They're playing chess while CSK are playing cricket, and if this comes off, this will be the tactical masterstroke of IPL 2025!"&lt;/p&gt;

&lt;p&gt;Final Decision Card:&lt;br&gt;
🏆 CAPTAIN'S CALL&lt;br&gt;
Bowl Chawla over 16 — boundary restriction field.&lt;br&gt;
Hold Bumrah for overs 18 and 20.&lt;/p&gt;

&lt;p&gt;📊 Win probability maintained: 61% → 58% (this over) → projected 67% if Bumrah takes over 18.&lt;br&gt;
❌ Why not Bumrah now? Burning him in the 16th hands CSK a free 18th over on a wet ball. &lt;br&gt;
   The Devil's Advocate nailed it.****&lt;/p&gt;

&lt;p&gt;⚙️ What Makes It Genuinely Agentic:&lt;br&gt;
A lot of "multi-agent" submissions are actually one model with a long prompt. Here's what separates Captain Cool:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Four separate Gemini API calls. Each agent runs independently with its own system prompt. The Analyst doesn't know the Commentator exists. The Strategist only sees the Analyst's output, not the raw match state.&lt;/li&gt;
&lt;li&gt;Real tool use, not hardcoded JSON. The Analyst autonomously decides to call getWeatherForVenue. If it judges the venue context irrelevant, it wouldn't call it. The decision is Gemini's, not the developer's.&lt;/li&gt;
&lt;li&gt;Genuine revision. After the Devil's Advocate challenges, the Strategist's second response is a different Gemini call with the challenge in context. In the walkthrough above, the Captain actually changed the decision — Bumrah → Chawla. That's not scripted. That's the model genuinely updating based on a counterargument.&lt;/li&gt;
&lt;li&gt;Explainability baked in. The Commentator's job is specifically to make the final call legible to non-technical fans. And the Final Decision Card always includes a counterfactual: "Why not X? Because..." — a rubric requirement satisfied by design.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;🏆 Reflections: &lt;br&gt;
What This Proves About Agentic AI&lt;br&gt;
The most interesting thing about building Captain Cool wasn't the code. It was watching the agents genuinely disagree.&lt;br&gt;
In every demo run, the Devil's Advocate found something real to challenge. And in about 40% of runs during testing, the Captain actually changed the decision after being challenged. That's not a trick — that's Gemini's reasoning working correctly when given a well-structured adversarial prompt.&lt;br&gt;
Multi-agent orchestration works especially well for problems that are inherently subjective and multi-variable — exactly like IPL captaincy. There's no clean answer. The right architecture mirrors that uncertainty by building disagreement into the system itself.&lt;br&gt;
The agents run in under 3 seconds total on Gemini 2.5 Flash. Fast enough for a real dugout. Smart enough to change the game.&lt;/p&gt;

</description>
      <category>agenticpremiereleague</category>
      <category>google</category>
      <category>ai</category>
      <category>gdgcloudpune</category>
    </item>
  </channel>
</rss>
