A specialized AI agent for managing fantasy football teams, built with PydanticAI and integrated with Sleeper API via MCP (Model Context Protocol). KraftBot provides intelligent lineup optimization, waiver wire analysis, trade recommendations, and strategic guidance for your fantasy football league.
- ๐ Fantasy Football Expertise: Specialized AI agent trained for fantasy football strategy and analysis
- ๐ Sleeper Integration: Direct access to your Sleeper league data via MCP server
- ๐ฏ Multiple Strategy Modes: Choose from aggressive, conservative, analytical, or default approaches
- ๐ก Intelligent Recommendations: Lineup optimization, waiver pickups, and trade analysis
- ๐จ Beautiful CLI: Built with Typer and Rich for an excellent command-line experience
- ๐ค Multi-Model Support: Access multiple LLMs through OpenRouter integration
- ๐ Season-Long Strategy: Balance weekly wins with long-term championship goals
- Clone the repository:
git clone https://github.com/your-username/kraftbot.git
cd kraftbot
- Install dependencies:
make install-dev
- Set up environment variables:
cp .env.example .env
# Edit .env with your API keys
Required environment variables:
OPENROUTER_API_KEY
- Get from OpenRouterLOGFIRE_WRITE_TOKEN
- Optional, for observability
Start an interactive chat session:
python main.py chat
Test with a specific prompt:
python main.py test --prompt "Analyze my Week 1 lineup"
List available models:
python main.py models
Check system status:
python main.py status
KraftBot supports multiple fantasy football strategy approaches via built-in prompt files:
default
- Balanced approach for optimal weekly and season-long performanceaggressive
- High-risk, high-reward strategy for championship runsconservative
- Safe, consistent approach to avoid bustsanalytical
- Data-driven decisions based on advanced metrics
# Use a specific strategy
python main.py chat --prompt aggressive
python main.py chat --prompt conservative
python main.py chat --prompt analytical
# List all available prompts
python main.py prompts
# Test with custom strategy
python main.py test --system-prompt aggressive --prompt "Should I start Ja'Marr Chase this week?"
Create your own strategy by adding a .md
file to kraftbot/prompts/
or use any external file:
# Use custom prompt file
python main.py chat --prompt /path/to/my_strategy.md
KraftBot automatically connects to a Sleeper MCP server to access your fantasy football data:
- League Information: Rosters, matchups, standings
- Player Data: Stats, projections, availability
- Waiver Wire: Available free agents and their potential
- Trade Analysis: Evaluate potential trades with other managers
The MCP integration is enabled by default. To disable:
ENABLE_MCP_SERVER=false python main.py chat
Command | Description | Example |
---|---|---|
chat |
Interactive chat session | python main.py chat --prompt aggressive |
test |
Test a specific prompt | python main.py test --prompt "Analyze my lineup" |
models |
List available AI models | python main.py models |
prompts |
Show available strategy prompts | python main.py prompts |
status |
System configuration status | python main.py status |
compare |
Compare responses across models | python main.py compare --prompt "Trade advice" |
mcp |
MCP integration information | python main.py mcp |
python main.py chat --prompt analytical
# Then ask: "Should I start Justin Jefferson or Tyreek Hill this week?"
python main.py test --prompt "Who should I pick up from waivers this week?"
python main.py chat --prompt conservative
# Then ask: "Should I trade my RB1 for two WR2s?"
python main.py compare --prompt "Rank my RBs for this week" --model "anthropic/claude-3.5-sonnet" --model "openai/gpt-4"
Create a .env
file with:
# Required
OPENROUTER_API_KEY=your_openrouter_api_key_here
# Optional
LOGFIRE_WRITE_TOKEN=your_logfire_token
ENABLE_MCP_SERVER=true
MCP_SERVER_COMMAND=python
MCP_SERVER_ARGS=-m sleeper_mcp_server
Popular models for fantasy football analysis:
anthropic/claude-3.5-sonnet
(Recommended for detailed analysis)openai/gpt-4
(Great for strategic thinking)openai/gpt-4-turbo
(Fast responses)meta-llama/llama-3.1-70b-instruct
(Alternative option)
View all available models: python main.py models
make install-dev # Install with dev dependencies
make test # Run tests
make test-coverage # Run tests with coverage
make lint # Run linting (black, isort, mypy)
make format # Format code
make clean # Clean build artifacts
make build # Build package
kraftbot/
โโโ kraftbot/
โ โโโ core/ # Core agent functionality
โ โโโ cli/ # Command-line interface
โ โโโ mcp/ # Sleeper MCP integration
โ โโโ prompts/ # Fantasy football strategy prompts
โ โโโ config/ # Configuration management
โ โโโ utils/ # Utility functions
โโโ main.py # CLI entry point
โโโ pyproject.toml # Project configuration
- Weekly Lineup Decisions: Start/sit recommendations based on matchups and projections
- Waiver Wire Strategy: Identify valuable pickups before others notice
- Trade Analysis: Evaluate trade proposals and find win-win deals
- Season Planning: Balance short-term gains with championship strategy
- Matchup Analysis: Understand opponent weaknesses and exploit them
- Player Evaluation: Deep dives into player performance and trends
- League Strategy: Adapt tactics based on your league's scoring and tendencies
KraftBot's default behavior is optimized for fantasy football management with knowledge of:
- Scoring Systems: PPR, Half-PPR, Standard scoring
- Positional Strategy: RB scarcity, WR depth, streaming strategies
- Matchup Analysis: Vegas lines, pace of play, weather conditions
- Player Health: Injury reports and their fantasy implications
- Advanced Metrics: Target share, red zone usage, snap counts
- Season Trends: Strength of schedule, playoff implications
MIT License - See LICENSE file for details.
Built for fantasy football managers who want to dominate their leagues with AI-powered insights.