Hybrid AI-powered NBA betting intelligence with real data validation
NBA GamePredict AI Agent is an intelligent betting prediction system that combines real data with AI validation. The system uses:
Hybrid Architecture:
- Real ESPN API Data: Actual H2H game scores (no fake/fallback data)
- Dual AI Validation: GPT-4o + Amazon Bedrock Claude for data verification
- Agentic AI Agent: Autonomous decision-making and contextual analysis
- 75%+ Confidence Threshold: Only recommend high-quality bets
The Goal: Professional NBA betting intelligence with real data, AI validation, and user capital protection.
- π‘οΈ Capital Protection: 75% confidence threshold - only high-quality predictions
- π Real Data Only: ESPN API H2H data - no fallback/simulated data
- π€ Dual AI Validation: GPT-4o + Amazon Bedrock Claude for data verification
- π― Agentic AI Agent: Autonomous decision-making with LLM intelligence
- β‘ Hybrid Approach: ESPN API (real scores) + Dual AI validation layers
- π Player Props: Individual player predictions (Points, Rebounds, Assists, PRA)
- π° Free NBA Data: ESPN API (no authentication required)
- βοΈ AWS Bedrock: Real-time AI validation for betting safety (~$0.07/month)
| Component | Status | Details |
|---|---|---|
| Real H2H Data | β Complete | ESPN API only - fallback removed |
| GPT-4o Validation | β Complete | Validates ESPN data accuracy |
| Bedrock AI Validation | β Complete | Claude 3 Haiku for betting safety |
| Agentic AI Agent | β Complete | Autonomous decision-making |
| LLM Integration | β Complete | Dual AI layers (GPT-4o + Bedrock) |
| Player Props | β Complete | Points, Rebounds, Assists, 3PT, PRA |
| Confidence Filtering | β Complete | 75%+ threshold enforced |
| API Service | β Complete | FastAPI with Swagger docs |
| AWS Deployment | β Complete | Serverless architecture on AWS |
| Cost Optimization | β Complete | Free Tier compliant, $0-$22/month |
| Infrastructure as Code | β Complete | SAM template for automated deployment |
Production-ready serverless deployment in 20 minutes:
# Install AWS tools
pip install awscli aws-sam-cli
aws configure
# Deploy to AWS
cd aws
chmod +x deploy.sh
./deploy.shSee QUICK_START.md for details
Cost: $0 (Free Tier) or $0.15-$22/month after
Installation:
# Clone repository
git clone https://github.com/bowale01/AI-Agents.git
cd AI-Agents/gamepredict_ai_agent
# Activate virtual environment
.venv\Scripts\activate # Windows
source .venv/bin/activate # Mac/Linux
# Install dependencies
pip install -r requirements.txt
# Optional: Set up AI enhancement (GPT-4)
cp .env.example .env
# Edit .env and add your OPENAI_API_KEYRun the System:
Get Today's Predictions (Recommended):
python get_today_nba_predictions.py
# Features included:
# β
Real ESPN H2H data
# β
Injury analysis (automatic)
# β
Current form analysis (automatic)
# β
Bedrock AI validation
# β
GPT-4o validation
# β
Table output format
# β
75% confidence filterLocal API Service:
python api_service.py
# Access at:
# http://localhost:8000/docs (Swagger UI)
# http://localhost:8000/daily-predictions
# http://localhost:8000/healthDirect NBA Module:
cd nba
python predictor.pyflowchart TD
Start([User Request: Predict NBA Game]) --> FetchGames[ESPN API: Fetch Today's Games]
FetchGames --> H2H[ESPN API: Get H2H History<br/>8-10 Historical Games]
H2H --> CheckData{Sufficient<br/>Real Data?}
CheckData -->|No < 4 games| Skip[Skip Game - No Prediction]
CheckData -->|Yes β₯ 4 games| Calculate[Calculate Statistics]
Calculate --> Bedrock[Amazon Bedrock Claude<br/>Validate H2H Data Quality]
Bedrock --> BedrockCheck{Data<br/>Quality?}
BedrockCheck -->|SKIP_GAME| Skip
BedrockCheck -->|USE_CAUTION| AdjustDown[Reduce Confidence -10%]
BedrockCheck -->|TRUST_DATA| GPT4o[GPT-4o Validation LLM<br/>Historical Context]
AdjustDown --> GPT4o
GPT4o --> Validate{Historical<br/>Context<br/>Valid?}
Validate -->|Questionable| Adjust[Adjust Win Probabilities<br/>Β±15% based on context]
Validate -->|Accurate| Agent[Agentic AI Agent<br/>Autonomous Decision Making]
Adjust --> Agent
Agent --> Predict[Generate Predictions:<br/>- Moneyline<br/>- Over/Under<br/>- Player Props<br/>- Spreads]
Predict --> Filter{Confidence<br/>β₯ 75%?}
Filter -->|No| Reject[β Reject Prediction<br/>Protect User Capital]
Filter -->|Yes| Approve[β
High-Confidence Prediction]
Approve --> Output[Output to User:<br/>API Response or Terminal]
Skip --> End([End])
Reject --> End
Output --> End
style Start fill:#4CAF50,stroke:#333,stroke-width:2px,color:#fff
style End fill:#f44336,stroke:#333,stroke-width:2px,color:#fff
style Bedrock fill:#FF6F00,stroke:#333,stroke-width:2px,color:#fff
style GPT4o fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff
style Agent fill:#FF9800,stroke:#333,stroke-width:2px,color:#fff
style Approve fill:#4CAF50,stroke:#333,stroke-width:2px,color:#fff
style Reject fill:#f44336,stroke:#333,stroke-width:2px,color:#fff
style Filter fill:#9C27B0,stroke:#333,stroke-width:2px,color:#fff
style Validate fill:#9C27B0,stroke:#333,stroke-width:2px,color:#fff
style CheckData fill:#9C27B0,stroke:#333,stroke-width:2px,color:#fff
style BedrockCheck fill:#9C27B0,stroke:#333,stroke-width:2px,color:#fff
| Step | Component | Action |
|---|---|---|
| 1οΈβ£ | ESPN API | Fetch today's games + H2H history (real data only) |
| 2οΈβ£ | Data Check | Verify β₯4 games available (skip if insufficient) |
| 3οΈβ£ | Bedrock Claude | Validate H2H data quality and detect anomalies |
| 4οΈβ£ | GPT-4o LLM | Validate historical context and provide insights |
| 5οΈβ£ | AI Adjustment | Adjust predictions if data questionable |
| 6οΈβ£ | Agentic AI | Autonomous analysis & prediction generation |
| 7οΈβ£ | Confidence Filter | 75% threshold gate (reject low confidence) |
| 8οΈβ£ | Output | High-confidence predictions to user |
- Diamond (β): Decision gates with Yes/No paths
- Rectangle (β): Processing steps
- Rounded (β¬): Start/End points
- Colors:
- π’ Green = Start/Approved
- π Orange = Bedrock AI Validation
- π΅ Blue = GPT-4o Processing
- π Orange = Agentic AI Agent
- π£ Purple = Decision Points
- π΄ Red = Rejected/End
gamepredict_ai_agent/
βββ api_service.py # FastAPI service
βββ check_today_nba.py # Today's games checker
βββ check_tomorrow_games.py # Future games utility
βββ get_today_nba_predictions.py # Get predictions
β
βββ nba/ # NBA module
β βββ predictor.py # Main predictor
β βββ nba_h2h_collector.py # H2H data collector
β βββ agentic_ai_enhancer.py # AI enhancement
β βββ nba_betting_odds_api.py # Odds integration
β
βββ CONFIDENCE_BREAKDOWN.md # Confidence scoring docs
βββ PREDICTION_METHODOLOGY.md # Methodology details
βββ requirements.txt # Dependencies
1. Real Data Collection (ESPN API)
- Fetches today's NBA games from ESPN API
- Collects 8-10 historical H2H games between teams
- Gets actual scores, dates, winners - NO fake/fallback data
2. Bedrock AI Validation Layer (First Pass)
- Amazon Bedrock Claude validates H2H data quality
- Checks for anomalies and data inconsistencies
- Detects roster changes that affect H2H relevance
- Provides betting advice: TRUST_DATA / USE_CAUTION / SKIP_GAME
- Cost: ~$0.07/month for typical usage
3. GPT-4o Validation Layer (Second Pass)
- AI validates if ESPN data makes sense historically
- Example: "Does it make sense that Grizzlies beat Lakers 7/10 times?"
- Provides historical context (e.g., "Lakers historically dominate this matchup")
- Adjusts predictions if ESPN data is questionable
4. Statistical Analysis
- Calculates win probabilities from validated H2H data
- Analyzes scoring trends, home/away patterns
- Generates predictions for multiple markets
5. Agentic AI Agent
- Autonomous decision-making (no human intervention needed)
- Combines ESPN data + Dual AI insights (Bedrock + GPT-4o)
- Filters predictions: only shows 75%+ confidence bets
- Protects user capital by rejecting low-confidence picks
- Autonomous: Makes decisions without human intervention
- Goal-Directed: Optimizes for accurate predictions
- Multi-Source: Combines ESPN API + Bedrock + GPT-4o + Statistical models
- Dual Validation: Two AI layers catch different types of issues
- Reasoning: Both AIs provide context and explanations
GET / # Welcome message
GET /health # System health
GET /daily-predictions # All high-confidence predictions
POST /predict # Single game prediction
Body: {
"home_team": "Lakers",
"away_team": "Celtics"
}
Interactive Docs: http://localhost:8000/docs
The system uses GPT-4o (latest OpenAI model) for H2H validation and contextual analysis:
Setup:
- Get API key from https://platform.openai.com/
- Add to
.envfile:OPENAI_API_KEY=sk-your_key_here OPENAI_MODEL=gpt-4o AI_ENHANCEMENT_ENABLED=true
What GPT-4o Does:
- Validates ESPN API data: Checks if H2H results make historical sense
- Provides context: Injuries, roster changes, coaching factors
- Corrects discrepancies: Adjusts predictions when ESPN data is questionable
- Natural language explanations: Why the prediction makes sense
Example Validation:
ESPN API: Grizzlies won 7/10 vs Lakers
GPT-4o: "Questionable - Lakers historically dominate this matchup"
System: Adjusts prediction to favor Lakers
Cost: ~$0.01-0.03 per game (GPT-4o is 50% cheaper than GPT-4)
Note: System works with real ESPN data even without GPT-4o, but validation layer adds accuracy.
The system uses Amazon Bedrock Claude 3 Haiku for real-time betting safety validation:
What Bedrock Does:
- H2H Data Quality Check: Validates historical data makes sense
- Anomaly Detection: Catches data inconsistencies before you bet
- Roster Change Detection: Identifies when old H2H data is outdated
- Betting Advice: TRUST_DATA / USE_CAUTION / SKIP_GAME recommendations
Example Validation:
H2H Data: Wizards beat Lakers 10/10 games
Bedrock: "QUESTIONABLE - Doesn't match historical trends"
System: Reduces confidence from 85% to 75%
Cost: ~$0.07/month (typical usage) or ~$0.50/month (heavy usage)
Deployment:
# Windows PowerShell
cd aws
./deploy_with_bedrock.ps1
# Linux/Mac
cd aws
./deploy_with_bedrock.shBenefits for Real Money Betting:
- β Catches data anomalies before you bet
- β Identifies misleading H2H data
- β Prevents bets on questionable predictions
- β Provides second opinion on close calls
See BEDROCK_AI_VALIDATION.md for detailed documentation.
- Basic Service: $20-30/month per user
- AI-Enhanced: $75/month per user
- Enterprise API: Custom pricing
100 users Γ $25/month = $30,000/year
100 users Γ $75/month = $90,000/year (with AI)
- Environment variables for sensitive data
- No hardcoded API keys
- Input validation with Pydantic
- Graceful error handling
- ESPN API requires no authentication
Example: Lakers -5.5 vs Bulls
Team must win by more than the spread. This is the #1 NBA bet in the US because it evens out mismatches.
- β Very popular with casual and serious bettors
- β Core market for AI prediction tools
- π² Status: Planned for future release
Example: Over 221.5 total points
Includes:
-
Full game totals β
-
1st half totals β
-
Team totals (planned)
-
β Extremely popular
-
β Strong use case for models based on pace, efficiency, H2H, recent form
-
β Currently supported in our system
Example: Celtics to win
Simple: pick the winner.
β οΈ Less popular in NBA because favorites are often heavily priced- β Currently supported in our system
Examples:
-
Player points (Over/Under 26.5)
-
Rebounds, Assists
-
3-pointers made
-
Points + Rebounds + Assists (PRA)
-
π₯ Huge in the US
-
π₯ Especially popular on mobile apps
-
π₯ Bettors love stars (LeBron, Curry, Jokic)
-
β Currently supported for star players
Examples:
-
Lakers win + Over 228.5 + LeBron over 25.5 points
-
π₯ One of the most bet products
-
π₯ Sportsbooks heavily promote these
-
β οΈ High house edge -
π² Status: Planned for Phase 3
- Point Spread: Home/Away spread predictions β
- Moneyline: Winner prediction β
- Over/Under: Total points β
- Halftime Over/Under: First half points β
- Player Props: Star player performance (Points, Rebounds, Assists, 3PT, PRA) β
- Excellent: 90%+
- Good: 80-89%
- Solid: 75-79%
- Rejected: <75% (not shown to users)
- Language: Python 3.13+
- LLM: OpenAI GPT-4o (validation & context)
- Cloud AI: Amazon Bedrock Claude 3 Haiku (betting safety)
- Agentic AI: Autonomous decision-making agent
- API Framework: FastAPI, Uvicorn
- Data Source: ESPN NBA API (real data only)
- Data Processing: pandas, numpy, requests, tabulate
- No Fallback Data: Only real ESPN API results used
- β ESPN API Integration: Real H2H data collection (no fallback/fake data)
- β GPT-4o Validation: LLM validates ESPN data accuracy
- β Bedrock AI Validation: Claude 3 Haiku for betting safety (~$0.07/month)
- β Agentic AI Agent: Autonomous decision-making system
- β Dual AI Layers: Bedrock + GPT-4o for comprehensive validation
- β Data Validation: AI catches discrepancies (e.g., Lakers vs Grizzlies)
- β Player Props: Points, Rebounds, Assists, 3PT, PRA for star players
- β Confidence System: 75% threshold for capital protection
- β Multi-Market Support: Moneyline, Over/Under, Halftime, Player Props
- β Table Output: Clean formatted tables for easy scanning
- β 48-Hour Window: Analyzes today + tomorrow games (catches midnight games)
- π FastAPI Service: REST API with Swagger documentation
- π Testing & Validation: Verifying prediction accuracy
- π² Production Deployment: Server setup and monitoring
- π² User Authentication: Secure access system
- π² Same Game Parlays: Multi-bet combination recommendations
- π² Advanced Player Props: Deep-bench players and more stat types
- π² Real Injury Data: Live injury report integration
- π² Advanced Analytics: Visualization dashboards
- π² Alert System: Real-time notifications for high-confidence bets
- π² Mobile App: iOS/Android applications
- π² Commercial Launch: Subscription-based service
# Get today's predictions with all features
python get_today_nba_predictions.py
# Features automatically included:
# - Real ESPN H2H data
# - Injury reports (ESPN API)
# - Current form analysis (last 10 games)
# - Bedrock AI validation
# - GPT-4o validation
# - 75% confidence filter
# Test specific features
python test_injury_check.py # Test injury & form analysis
# Check today's games schedule
python check_today_nba.py
# Check tomorrow's games
python check_tomorrow_games.py- CONFIDENCE_BREAKDOWN.md: Detailed confidence scoring explanation
- PREDICTION_METHODOLOGY.md: How predictions are calculated
- API Docs: Available at
/docswhen service is running
This is a proprietary system for sports betting intelligence. For partnerships or enterprise licensing, please contact through GitHub.
This system is for informational and entertainment purposes only. Sports betting involves risk. Never bet more than you can afford to lose. This is not financial advice.
- GitHub: AI-Agents Repository
- Issues: Use GitHub Issues for bug reports
Most betting systems try to give you predictions for every game. We don't. We only recommend bets we're 75%+ confident in.
- Real H2H Intelligence: We analyze actual historical matchups between teams (not just overall stats)
- Dual AI Validation: Bedrock (data quality) + GPT-4o (historical context) = comprehensive safety
- Capital Protection First: Automatically reject predictions below 75% confidence
- Free Data Sources: ESPN NBA API (no expensive data subscriptions)
- Cloud AI Integration: Amazon Bedrock for real-time validation (~$0.07/month)
- Transparent Methodology: Open about how predictions are made
- 48-Hour Analysis: Catches all games including midnight matchups
- A trusted NBA betting intelligence system
- Subscription service ($25-75/month) for serious bettors
- Professional-grade API for developers
- Mobile app for easy access
π Start making smarter NBA betting decisions today! π°
Last Updated: December 2025