An AI-powered Discord bot for intelligent media downloads and social media management. Built with LangChain, LangGraph, and multi-agent orchestration for advanced content analysis and strategy optimization.
- Multi-Agent Architecture: LangGraph-orchestrated AI agents for intelligent decision making
- Smart Content Analysis: AI-powered quality assessment, engagement prediction, and audience insights
- Intelligent Strategy Selection: AI chooses optimal download strategies with confidence scoring
- Advanced Workflows: LangGraph state machines for complex multi-step AI processes
- π― LangGraph Assistant Management: Complete CLI for managing AI assistants with LangGraph Cloud integration
- Multi-Platform Support: Twitter/X, Reddit, Instagram, YouTube with strategy pattern architecture
- Dual-Mode Operations: API-direct and CLI-based downloads with automatic fallback
- Quality Control: Smart format selection and quality optimization
- Batch Processing: Queue management with intelligent prioritization
- Feature Flag Control: Gradual AI rollout with environment variable configuration
- Graceful Degradation: Robust fallback to traditional methods when AI unavailable
- Comprehensive Testing: 873+ tests including 243 AI/Assistant tests (100% passing)
- Performance Monitoring: Built-in metrics and agent performance tracking
- Python 3.12+
- UV package manager
- Discord Developer Account
- Docker (optional, for containerized deployment)
-
Clone the repository:
git clone https://github.com/yourusername/boss-bot.git cd boss-bot -
Set up environment:
# Create Python 3.12+ virtual environment python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install UV if not already installed curl -LsSf https://astral.sh/uv/install.sh | sh # Install dependencies uv sync
-
Configure environment variables:
cp sample.env .env # Edit .env with your Discord token and other settings -
Run tests:
uv run pytest
-
Configure AI capabilities (optional):
# Add to your .env file for AI features AI_STRATEGY_SELECTION_ENABLED=true AI_CONTENT_ANALYSIS_ENABLED=true # Add model provider API key (choose one) OPENAI_API_KEY=your-openai-api-key ANTHROPIC_API_KEY=your-anthropic-api-key GOOGLE_API_KEY=your-google-api-key # LangGraph Assistant Management (optional) LANGGRAPH_DEPLOYMENT_URL=https://your-deployment.langraph.ai LANGGRAPH_API_KEY=your-langgraph-api-key
-
Start the bot:
uv run python -m boss_bot
AI-powered content analysis with advanced insights.
$smart-analyze https://twitter.com/user/status/123456789
Features: Quality scoring, engagement prediction, audience insights, AI reasoning
AI-enhanced download with strategy optimization.
$smart-download https://youtube.com/watch?v=VIDEO_ID
Features: Intelligent strategy selection, confidence scoring, AI recommendations
Show AI agent status and performance metrics.
$ai-status
Features: Real-time agent metrics, feature flag status, troubleshooting info
Traditional download now uses AI strategy selection when enabled.
$download https://instagram.com/p/POST_ID/
# Shows: "π€ AI selected Instagram strategy (confidence: 95%)"
Metadata extraction enhanced with AI content analysis.
$metadata https://youtube.com/watch?v=VIDEO_ID
# Shows: "π AI Enhanced Content Info" with quality scores
Shows current strategy and AI configuration.
$strategies
# Displays AI feature flags and agent status
$download <url> # Download media from supported platforms
$download-only <url> # Download without uploading to Discord
$metadata <url> # Get content metadata
$status # Show download queue status
$help # Show all available commandsComprehensive CLI for managing AI assistants with LangGraph Cloud integration.
Display all assistants from LangGraph Cloud in rich tables.
# List all assistants
boss-bot assistants list
# Filter and limit results
boss-bot assistants list --graph download_workflow --limit 10Check connectivity to LangGraph Cloud deployment.
boss-bot assistants health
# Shows: β
LangGraph Cloud connection is healthyGenerate assistant YAML configuration files.
# Create a new assistant configuration
boss-bot assistants create-config "My Assistant" "Downloads media intelligently"
# Specify output location
boss-bot assistants create-config "My Assistant" "Description" --output my-assistant.yamlImport assistants from YAML configuration directory.
# Import all assistants from configs/
boss-bot assistants sync-from ./assistant-configs/
# Dry run to preview changes
boss-bot assistants sync-from ./configs/ --dry-runExport assistants to YAML configuration directory.
# Export all assistants to directory
boss-bot assistants sync-to ./backups/
# Export specific graph assistants
boss-bot assistants sync-to ./configs/ --graph-id download_workflowList available LangGraph graphs.
boss-bot assistants graphs- Environment Setup: Add LangGraph Cloud credentials to
.env - YAML Schema: Auto-generated configurations with metadata tracking
- Rich Output: Beautiful tables and progress indicators
- Error Handling: Graceful failures with detailed error messages
π Complete Documentation - Detailed guide with examples and troubleshooting
-
Install development dependencies:
uv sync --dev
-
Set up pre-commit hooks:
pre-commit install
-
Configure VSCode (recommended):
- Install recommended extensions from
.vscode/extensions.json - Use provided settings from
.vscode/settings.json
- Install recommended extensions from
boss-bot/
βββ src/boss_bot/ # Main package directory
β βββ ai/ # π€ AI Components (NEW!)
β β βββ agents/ # LangGraph AI agents
β β βββ strategies/ # AI-enhanced strategies
β β βββ workflows/ # LangGraph workflows
β βββ bot/ # Discord bot functionality
β β βββ client.py # Main bot with AI integration
β β βββ cogs/ # Discord commands (AI-enhanced)
β βββ core/ # Core utilities
β β βββ downloads/ # Strategy pattern + AI
β β βββ queue/ # Queue management
β β βββ env.py # Settings with AI config
β βββ monitoring/ # Logging and metrics
β βββ storage/ # File storage management
β βββ utils/ # Utility functions
βββ tests/ # Test suite
β βββ test_ai/ # π€ AI test suite (82 tests)
β βββ test_bot/ # Discord integration tests
β βββ test_core/ # Core functionality tests
βββ docs/ # Documentation
β βββ AI_INTEGRATION.md # π€ AI documentation
βββ scripts/ # Utility scripts
# Run all core tests
uv run pytest tests/test_core/ tests/test_bot/ -v
# Run specific test file
uv run pytest tests/test_bot/test_downloads.py -v# Run all AI tests
uv run pytest tests/test_ai/ -v
# Run specific AI component tests
uv run pytest tests/test_ai/test_agents/test_strategy_selector.py -v
uv run pytest tests/test_ai/test_workflows/test_download_workflow.py -v
# Run Discord AI integration tests
uv run pytest tests/test_bot/test_discord_ai_integration.py -v# Generate coverage report
uv run pytest --cov=boss_bot --cov-report=html
# Run with detailed output
uv run pytest -v --tb=short
# Fast test run (skip slow tests)
uv run pytest -m "not slow"- Agent Tests: AI agent functionality (53 tests)
- Workflow Tests: LangGraph coordination (20 tests)
- Integration Tests: Discord AI commands (12 tests)
- Feature Flag Tests: AI configuration testing
- Performance Tests: AI response time validation
- CLAUDE.md: Complete project overview with AI architecture
- AI_INTEGRATION.md: Comprehensive AI integration guide
- CONTRIBUTING.md: Development and contribution guidelines
- AI Commands: See
$smart-analyze,$smart-download,$ai-statusabove - Agent Development: AI_INTEGRATION.md#ai-agents
- LangGraph Workflows: AI_INTEGRATION.md#langgraph-workflows
- Testing AI Components: AI_INTEGRATION.md#testing
# Build documentation site
uv run mkdocs build
# Serve docs locally
uv run mkdocs serve
# View at: http://localhost:8000- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
See CONTRIBUTING.md for detailed guidelines.
- Logging: Structured logging via Loguru
- Metrics: Performance metrics via Prometheus
- Health Checks: Service health monitoring
- Performance Profiling: Request/response profiling
- Agent Performance: Request count, response times, success rates
- Model Usage: API call tracking, token consumption
- Feature Flag Status: Real-time AI capability monitoring
- Fallback Tracking: AI failure and degradation metrics
# View AI agent status
$ai-status
# Check feature flag configuration
$strategies
# View performance metrics in logs
tail -f logs/boss-bot.log | grep "AI"- Python 3.12+: Modern async/await patterns
- Discord.py: Discord bot framework
- Pydantic: Data validation and settings
- UV: Fast Python package manager
- LangChain: AI framework and agent coordination
- LangGraph: Multi-agent workflow orchestration
- LangSmith: AI monitoring and debugging
- Model Providers: OpenAI, Anthropic, Google integration
- Gallery-dl: Multi-platform media extraction
- yt-dlp: YouTube and video platform support
- Strategy Pattern: Flexible download architecture
- Feature Flags: Gradual rollout and A/B testing
- pytest: Comprehensive testing framework
- pytest-recording: VCR for AI interaction testing
- pytest-asyncio: Async test support
- dpytest: Discord bot testing
- File validation and sanitization
- Rate limiting and quota management
- Secure environment variable handling
- Regular dependency updates
- Automated security scanning
- Input validation for AI requests
- Model provider API key security
- AI response sanitization
- Fallback mechanisms for reliability
- Audit logging for AI decisions
- Clone and setup: Follow Quick Start guide above
- Configure AI: Add model provider API keys (optional)
- Test installation: Run
uv run pytest - Start bot: Run
uv run python -m boss_bot - Try AI commands: Use
$smart-analyzeor$ai-status
- β Core Functionality: Complete and stable
- β AI Integration: Production-ready multi-agent system
- β Testing: 407 tests (100% passing)
- β Documentation: Comprehensive guides available
- π Active Development: Ongoing enhancements and features
Boss-Bot: From simple media downloads to intelligent AI-powered social media management. π€β¨