惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 聂微东
Y
Y Combinator Blog
WordPress大学
WordPress大学
L
LangChain Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
A
About on SuperTechFans
小众软件
小众软件
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
GbyAI
GbyAI
I
InfoQ
The GitHub Blog
The GitHub Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
罗磊的独立博客
C
Check Point Blog
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
量子位
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
I built a multi-agent IPL captain cool AI on Gemini
Uddhav Bhopl · 2026-05-17 · via DEV Community

Uddhav Bhople

Cricket is a captain's game. And for 3 hours at a Google AI hackathon, I became one — by building Captain Cool, a multi-agent IPL strategist powered entirely by Google Gemini. Not a chatbot. Not a form with a Gemini call. A real debate between AI agents — the way a captain's brain actually works.

The problem

Every IPL captain faces split-second decisions — who bowls the death over, when to bring in the Impact Player, how to set the field against a left-hander in dew. These calls win or lose matches.

I wanted to build an AI that doesn't just answer "who should bowl?" but actually debates it, shows its reasoning, and tells you what happens if you make the wrong call.


Architecture

Instead of one Gemini call wearing 4 hats, I built 4 named agents with distinct roles that talk to each other:

User Input (Cricbuzz URL or manual match state)
                ↓
         Orchestrator
┌─────────────────────────────────────┐
│ Agent 1: Stats Analyst              │ ← Google Search tool call
│ Agent 2: Strategist (persona-based) │ ← Proposes the call
│ Agent 3: Devil's Advocate           │ ← Challenges it hard
│ Agent 4: Commentator                │ ← Final output + counterfactual
└─────────────────────────────────────┘
                ↓
    Decision + Debate UI + Voice Output

Enter fullscreen mode Exit fullscreen mode


The 4 agents

Agent 1 — Stats Analyst

Uses Gemini's built-in Google Search tool to fetch live player form and head-to-head stats. Not hardcoded JSON — real tool use.

System prompt:

You are an IPL stats analyst. Analyze pitch conditions, dew factor,
bowler economy rates, and batter weaknesses. Use Google Search to
fetch current player form. Output structured JSON with: key_stats,
batter_weakness, bowler_recommendation, win_probability (%).

Enter fullscreen mode Exit fullscreen mode

Agent 2 — Strategist (Persona-driven)

The user picks a captain persona — and the entire system prompt personality changes:

🧊 Dhoni mode:

You are MS Dhoni. Ice in your veins. You back your bowlers,
never panic, always think 2 overs ahead. Make ONE decisive call. No hedging.

Enter fullscreen mode Exit fullscreen mode

💥 Rohit mode:

You are Rohit Sharma. Bold and aggressive. Back your instincts
and your big hitters. Make the attacking call others won't.

Enter fullscreen mode Exit fullscreen mode

🔥 Hardik mode:

You are Hardik Pandya. Unconventional and fearless.
Make the call that surprises everyone but works.

Enter fullscreen mode Exit fullscreen mode

Agent 3 — Devil's Advocate

You are a sharp rival captain. Challenge the Strategist's decision hard.
Find the flaw. Propose a specific alternative.
Format: CHALLENGE: [what's wrong] | ALTERNATIVE: [what you'd do instead]

Enter fullscreen mode Exit fullscreen mode

Agent 4 — Commentator

You are Harsha Bhogle. Explain the final call in vivid cricket language
a passionate fan would love. Include: why this decision, why NOT the
alternative, a counterfactual ("if they'd bowled X, win prob drops ~Y%"),
and a confidence score out of 10.

Enter fullscreen mode Exit fullscreen mode


Orchestrator flow

  1. Extract match state from Cricbuzz URL using Gemini's URL context tool
  2. Stats Analyst runs Google Search → structured JSON with win probability
  3. Strategist (selected persona) proposes tactical decision
  4. Devil's Advocate challenges with a specific alternative
  5. Strategist defends or revises → final call
  6. Commentator delivers cricket-language output + counterfactual + confidence score + voice via Web Speech API

One full match scenario

Match state:

  • MI vs CSK · 2nd innings · Over 16 · CSK need 34 off 24 · 4 wickets down
  • Rohit Sharma on strike (67*) · Jadeja non-striker (12*)
  • Bumrah has 2 overs left · Chahal has 1 · Flat pitch · Heavy dew · Wankhede

Stats Analyst: Win prob MI 58% / CSK 42%. Dew negating seam movement. Jadeja vulnerable to pace outside off.

Strategist (Dhoni mode): Bowl Bumrah now — back him to nail yorkers despite the dew.

Devil's Advocate: Dew renders Bumrah's seam movement useless tonight. Save him for over 19. Bowl Chahal now while Jadeja is on strike — he's the weak link against leg spin.

Strategist (final call): Point conceded. Chahal to bowl over 17. Bumrah held for over 19.

Commentator: "In dew-heavy Wankhede, Bumrah's famous seam is rendered ineffective. Rohit holds him back for the 19th — calm, calculated captaincy. If they'd bowled Bumrah here, win probability drops to 51%. Confidence: 8/10." 🎙️


What made us stand out

At the hackathon, 100+ developers were building the same thing — a form that calls Gemini and returns formatted text. Here's what we did differently:

  • Real agent debate visible in the UI — shown as chat bubbles, not hidden or summarized
  • Captain persona selector — same agents, completely different personality per captain
  • Live Cricbuzz scraping — paste a URL, Gemini extracts the match state automatically
  • Counterfactual — we don't just tell you what to do, we tell you what happens if you don't
  • Voice output — the commentator speaks the final call aloud via Web Speech API

Tech stack

Layer Technology
Frontend TypeScript + Vite + CSS
AI model Google Gemini 2.5 Flash
SDK @google/genai
Tool use Gemini built-in Google Search
Voice output Web Speech API
Build environment Google AI Studio

Links


Built by Uddhav Bhople — Associate Microsoft Learn Student Ambassador · Google Student Ambassador · B.Tech Computer Engineering Student @ D.Y. Patil University Pune

googleai #gemini #cricket #apl #hackathon #multiagent #typescript #gdgcloudpune #gdgcloudpune2026