Skip to content

Repository files navigation

Agentic Premier League

An AI-powered cricket intelligence dashboard built for the Agentic Premier League vibe coding challenge.

This project does more than show a scorecard. It watches a live cricket match, turns raw match data into readable intelligence, and layers multiple agents on top of the stream to generate:

  • live score awareness
  • win probability
  • projected score
  • AI commentary
  • fan sentiment
  • tactical strategy suggestions

The result is a demo-first control room for cricket, where the user can understand not just what is happening, but what it means.

Why This Project Stands Out

Most cricket apps stop at score updates.

This one adds an agentic layer:

  • a Live Match Agent fetches the real match state
  • a Prediction Agent estimates outcome probability and projected score
  • a Commentary Agent converts match context into natural language
  • a Sentiment Agent summarizes the emotional state around the game
  • a Strategy Agent suggests what the batting side should do next

Everything is orchestrated into a single dashboard so the experience feels like a live AI-powered match room, not a collection of disconnected widgets.

What It Uses

Frontend

  • React
  • Vite
  • Tailwind CSS

Backend

  • Node.js
  • Express

AI Layer

  • Gemini API for commentary, sentiment, and strategy generation
  • deterministic local fallback logic when Gemini is unavailable

Live Match Data

  • live Cricbuzz page parsing for real match score sync
  • automatic fallback to an internal mock simulator if the live source fails

Testing

  • node --test for lightweight validation of prediction and parsing logic

Core Features

1. Live Match Dashboard

The app displays the current match state with:

  • teams
  • score
  • wickets
  • overs
  • innings state
  • live source indicator

If the live score feed is available, the dashboard reflects the actual match. If the live source drops, the system gracefully falls back to simulated updates so the demo never breaks.

2. Win Predictor

The prediction engine uses rule-based cricket logic instead of relying on an LLM for math-sensitive output.

It looks at:

  • current score
  • wickets in hand
  • overs bowled
  • current run rate
  • required run rate

It then calculates:

  • projected total
  • win probability

This keeps the numbers fast, stable, and explainable.

3. AI Commentary Agent

The commentary agent turns live match context into short broadcast-style commentary.

It uses structured match state, recent events, and pressure context to generate language that feels:

  • readable
  • energetic
  • stadium-ready
  • demo-friendly

If Gemini is not configured, the app still generates sensible local commentary so the dashboard stays useful.

4. Sentiment Agent

The sentiment module estimates the mood around the match.

It produces:

  • a sentiment label like Confident, Tense, or Anxious
  • a short fan mood summary
  • a reaction stream that makes the interface feel socially alive

5. Strategy Agent

The strategy agent answers the practical question:

What should the batting side do next?

It produces short tactical guidance based on:

  • pressure situation
  • wickets remaining
  • current vs required scoring rate

This helps the app feel agentic rather than purely descriptive.

How It Works

End-to-End Flow

  1. The backend tries to fetch the live match state from Cricbuzz.
  2. If live fetch succeeds, the real score is normalized into app-friendly JSON.
  3. If live fetch fails, the system falls back to the internal match simulator.
  4. The orchestrator passes the match context into:
    • the predictor
    • the commentary generator
    • the sentiment generator
    • the strategy generator
  5. The frontend dashboard polls the backend and renders the combined insight feed.

Architecture

Frontend

The frontend is a single-page React dashboard designed for demo impact.

It contains:

  • hero match header
  • score card
  • victory pulse card
  • projected score card
  • commentary feed
  • sentiment meter
  • strategy panel
  • fan reaction stream

Backend

The backend exposes lightweight APIs for:

  • current match state
  • insights
  • full dashboard payload
  • optional manual simulator stepping

It acts as the orchestration layer between live data, rule-based prediction, and LLM output.

API Endpoints

  • GET /api/health
  • GET /api/match-state
  • GET /api/insights
  • GET /api/dashboard
  • POST /api/match-step

Project Structure

server/
  fanReactions.js     Fan sentiment context
  gemini.js           Gemini integration + fallback outputs
  index.js            Express server and API routes
  liveMatch.js        Live Cricbuzz fetch + parsing
  matchSimulator.js   Mock live match fallback engine
  orchestrator.js     Combines data and agent outputs
  predictor.js        Win probability and projection logic

src/
  App.jsx             Dashboard UI
  index.css           Tailwind entry styles
  main.jsx            React entry point

test/
  predictor.test.js   Prediction and parsing tests

Local Setup

1. Install dependencies

npm install

2. Configure environment

Create a .env file from .env.example.

Available variables:

  • GEMINI_API_KEY
  • PORT
  • LIVE_MODE
  • CRICBUZZ_MATCH_URL

3. Start the app

npm run dev

4. Open in browser

  • frontend: http://localhost:5173
  • backend: http://localhost:3001

Scripts

  • npm run dev starts frontend and backend together
  • npm run build creates a production build
  • npm run preview previews the built frontend
  • npm test runs backend tests

Reliability Design

This project was built for a live demo environment, so reliability mattered as much as features.

Key reliability choices:

  • real live score first, simulator fallback second
  • rule-based numeric prediction instead of LLM-only prediction
  • Gemini used only for language-heavy tasks
  • safe fallback commentary, sentiment, and strategy if Gemini fails

This means the app remains presentable even if:

  • the live source changes
  • Gemini is unavailable
  • the network becomes unstable

Example Pitch

Use this if someone asks what the project does:

Agentic Premier League is a live cricket intelligence dashboard. It consumes the current match, then multiple agents analyze it in real time. One predicts the game, one generates commentary, one reads fan sentiment, and one suggests strategy. So instead of only seeing the score, the user gets live AI-powered match intelligence.

Demo Talking Points

  • It is not just a score app, it is an agent-driven decision layer on top of live cricket.
  • Live data is fetched in real time when available.
  • Predictions are stable because math is rule-based.
  • Gemini is used where LLMs add the most value: language, sentiment, and insight.
  • The app is built to survive demo risk through graceful fallback behavior.

Verification

These checks were used while building:

npm test
npm run build

Future Improvements

  • over-by-over historical charts
  • player-specific commentary
  • Hindi and English commentary toggle
  • richer strategy recommendations
  • fantasy cricket assistant mode
  • support for more leagues and match sources

Built For

Build with AI: Agentic Premier League

Watch the game. Ship the agent. Master the play.

About

A real-time cricket intelligence dashboard powered by multiple AI agents for prediction, commentary, sentiment, and strategy.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages