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

推荐订阅源

月光博客
月光博客
C
Check Point Blog
J
Java Code Geeks
腾讯CDC
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
量子位
Google DeepMind News
Google DeepMind News
I
InfoQ
The GitHub Blog
The GitHub Blog
aimingoo的专栏
aimingoo的专栏
N
Netflix TechBlog - Medium
Hugging Face - Blog
Hugging Face - Blog
博客园 - Franky
V
V2EX
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
小众软件
小众软件
博客园_首页
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
IT之家
IT之家

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
Building an AI-Powered Multi-Agent IPL Match Strategist w...
Suswagata Ch · 2026-05-17 · via DEV Community

Suswagata Chakraborty

@gdgcloudpune

Cricket, especially the fast-paced T20 format of the IPL, is a game of quick decisions, intense pressure, and strategic gambles. What if you could bring the analytical power of a professional dugout right to your screen?

In this post, we’ll dive into The Multi-Agent IPL Match Strategist, an MVP built using Python, Streamlit, and Google Gemini, to simulate real-time cricket tactics through multi-agent debate.


🏗️ Architecture Overview

The application utilizes a lightweight, serverless architecture centered around Streamlit and Google's Gemini LLM. Instead of spinning up multiple different LLM calls for each "Agent," we use a single, highly structured prompt to generate a simulated debate in one pass, drastically reducing latency.

flowchart TD
    User([🏏 User Input: Match Context]) --> Streamlit[Streamlit Frontend]
    Streamlit --> Backend[Python Backend logic]

    Backend -->|Compiles Context & Prompt| Gemini[Google Gemini API <br> gemini-2.5-flash]

    Gemini -->|Generates JSON Response| Parser[JSON Parser]

    Parser -->|Agent 1| Strategist[🧠 Core Strategist]
    Parser -->|Agent 2| Advocate[😈 Devil's Advocate]
    Parser -->|Agent 3| Captain[👨‍✈️ Captain Final Call]
    Parser -->|Metric| WinProb[📈 Win Probability]

    Strategist --> StreamlitUI[Streamlit Interactive Dashboard]
    Advocate --> StreamlitUI
    Captain --> StreamlitUI
    WinProb --> StreamlitUI

Enter fullscreen mode Exit fullscreen mode

📝 The Multi-Agent Prompt

To make the AI simulate a "virtual dugout," we instruct the model to adopt multiple personas simultaneously and output the debate as a structured JSON object.

Here is the exact master prompt that orchestrates our agents:

You are simulating an IPL tactical dugout consisting of multiple AI agents analyzing the following match situation:
- Batting Team: {batting_team}
- Bowling Team: {bowling_team}
- Score: {score} in {overs} overs
- Target/Runs Needed: {runs_needed} from {balls_left} balls (Wickets left: {wickets_left})
- Batters at Crease: {striker} (Striker) & {non_striker} (Non-Striker)
- Pitch: {pitch_type}
- Dew Factor: {dew_factor}
- Captain Personality for Final Decision: {captain_personality}

Generate a short, tactical, and realistic response in JSON format. The JSON must contain exactly these keys:
"win_probability": (A percentage string representing the bowling team's chance, e.g. "62%")
"win_prob_float": (A float between 0.0 and 1.0 representing the bowling team's chance)
"strategist": (1-2 sentences of tactical advice from the Core Strategist, focusing on bowling/fielding changes)
"advocate": (1-2 sentences from the Devil's Advocate countering the strategist's idea)
"decision": (1-2 sentences from the Captain, reflecting the selected {captain_personality} personality, making the final call)

Respond ONLY with valid JSON. Do not include markdown formatting like ```

json.


Enter fullscreen mode Exit fullscreen mode

Try it out in Google AI Studio!

You can easily adapt and test this exact prompt directly in Google AI Studio to experiment with different agent personalities and match contexts before writing any code.

🏏 Walkthrough: A Live Match Scenario

Let's put the app to the test with a classic IPL nail-biter.

The Situation:

  • Batting: MI
  • Bowling: CSK
  • Score: 154/4 in 16.2 overs
  • Equation: MI needs 36 runs from 22 balls.
  • Required Run Rate (RRR): 9.82
  • Crease: Suryakumar Yadav (Striker) and Tim David (Non-Striker)
  • Conditions: Turning pitch, but Dew is present.
  • Captain Personality selected: Dhoni

The App's Output:

  1. 📈 Win Probability: 45% (Advantage tilts slightly to MI because SKY is on strike and dew makes gripping the ball harder)
  2. 🧠 Core Strategist: "Bring in your best spinner to exploit the turning pitch against Tim David if he gets on strike, but keep the pacers bowling wide yorkers to Suryakumar Yadav to deny him his sweep shots."
  3. 😈 Devil's Advocate: "With heavy dew on the field, gripping the ball for spin is incredibly risky. A wet ball might result in full tosses which SKY will easily lap over fine leg. Stick to pace off the ball."
  4. 👨‍✈️ Final Decision (Dhoni Mode): "We will trust the spinner for one over but pack the leg-side boundary deep. If the ball slips, we immediately shift to defensive wide pace. Keep it simple, don't panic."

🚀 The Tech Stack & Features

To build this quickly and beautifully, we used:

  • Streamlit: For the frontend. It allowed us to build a responsive, interactive UI entirely in Python. We utilized Streamlit's layout columns and custom CSS to create a sleek, dark-themed "cricket scoreboard" aesthetic.
  • Google Gemini API (gemini-2.5-flash): The brain of the operation. We chose Gemini 2.5 Flash for its blazing-fast response times.
  • Dynamic UI:
    • Smart dropdowns ensure you can't select the same player as both Striker and Non-Striker.
    • Required Run Rate (RRR) calculates instantly as you type in runs and balls left.

Whether you're an AI enthusiast looking to explore prompt engineering or a cricket fan wanting to second-guess your favorite captain, this project demonstrates the incredible potential of LLMs in building interactive, simulation-based applications.