Personal running coach powered by Strava + Claude AI
- โ Automatic analysis of your Strava workouts
- โ Personalized advice based on your real data
- โ Race time predictions
- โ Specific workout suggestions
- โ Injury risk detection
- โ Training pace calculator
- โ Free chat with the coach for any questions
- Python 3.8+
- Strava account (with training data)
- Anthropic Claude API Key
- Strava API Application
cd running-coach-agentpython3 -m venv venv
source venv/bin/activate # On Windows WSL/Linux
# or
venv\Scripts\activate # On Windows CMDpip install -r requirements.txt-
Create a new application:
- Application Name: Running Coach Agent
- Category: Training
- Website: http://localhost
- Authorization Callback Domain: localhost
-
Copy your credentials:
Client IDClient Secret
- Go to: https://console.anthropic.com/
- Generate an API Key in the "API Keys" section
- Copy your API Key
IDs and secrets are not stored in code; they're loaded from a .env or .env.dev file that is NOT uploaded to GitHub.
- Copy the template:
cp .env.example .env
- Edit
.env(or.env.dev) and fill with your real credentials:
# Strava API - https://www.strava.com/settings/api
STRAVA_CLIENT_ID=12345
STRAVA_CLIENT_SECRET=abc123...
STRAVA_REDIRECT_URI=http://localhost:8000/authorized
# Claude API - https://console.anthropic.com/
CLAUDE_API_KEY=sk-ant-api...# Activate virtual environment first (if using venv)
source venv/bin/activate # Linux/WSL
# or venv\Scripts\activate # Windows CMD
python main.py- The application will display a URL in the terminal
- Copy and paste the URL into your browser
- Click "Authorize" on the Strava page
- Copy the complete URL from the address bar after redirection
- The URL will look like:
http://localhost:8000/authorized?state=&code=XXXXX&scope=... - Even if the browser shows an error, the URL contains the necessary code
- The URL will look like:
- Paste the complete URL (or just the code) in the terminal when prompted
- The token will be saved in
strava_token.jsonfor future use
๐ก WSL Note: If running from Windows Subsystem for Linux, the HTTP server won't work automatically. That's why we use the manual copy/paste method for the code.
1. View training summary
2. Complete coach analysis
3. Predict race time
4. Suggest workout
5. Injury prevention tips
6. Ask the coach a question
7. Calculate training paces
8. View Strava statistics
9. Exit
The coach will automatically analyze:
- Weekly volume and trends
- Load progression (10% rule)
- Pace distribution
- Potential risks
Based on your recent workouts, predicts times for:
- 5K
- 10K
- Half Marathon
- Marathon
Generates detailed plans for:
- Intervals
- Tempo runs
- Long run
- Recovery
- Fartlek
Ask anything about running:
- "How can I improve my 5K pace?"
- "Am I training too much?"
- "What strength exercises do you recommend?"
โโโโโโโโโโโโโโโ
โ Strava โ โ Training data
โโโโโโโโฌโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Training Analyzer โ โ Metrics analysis
โโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Running Coach โ โ Agent with Claude
โโโโโโโโฌโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Main App CLI โ โ User interface
โโโโโโโโโโโโโโโโโโโโ
running-coach-agent/
โโโ main.py # Main application
โโโ config.py # Configuration (loads credentials from .env)
โโโ .env # Environment variables (DO NOT commit)
โโโ .env.example # Variables template (copy to .env)
โโโ .gitignore # Files to ignore in git
โโโ strava_client.py # Strava API client
โโโ training_analyzer.py # Data analysis
โโโ running_coach.py # Coach agent with Claude
โโโ requirements.txt # Dependencies
โโโ README.md # This documentation
โโโ CLAUDE.md # Technical documentation
โโโ venv/ # Virtual environment (generated, DO NOT commit)
โโโ strava_token.json # Strava token (generated, DO NOT commit)
In .env (or .env.dev):
WEEKS_TO_ANALYZE = 8 # Analyze last 8 weeksEdit COACH_SYSTEM_PROMPT in config.py to adjust the coach's personality and focus.
In running_coach.py:
self.model = "claude-opus-4-20250514" # For deeper analysis- Make sure to copy the complete URL after clicking "Authorize"
- If only copying the code, it must be the full value after
code= - Verify that
STRAVA_REDIRECT_URIin.envis exactlyhttp://localhost:8000/authorized
- The token refreshes automatically
- If it persists, delete
strava_token.jsonand re-authenticate
- Verify you have running activities in Strava
- Increase
WEEKS_TO_ANALYZEif your workouts are older
- Authentication flow uses manual code entry (not HTTP server)
- Make sure to activate the virtual environment before running
- Generated files (
.env,strava_token.json) are created in the WSL system
This error occurs on modern Linux systems when trying to install packages globally:
# Solution: use virtual environment
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt- NEVER upload the
.envor.env.devfile (already in.gitignore) - Don't share credentials; use
.env.exampleas template without real values - Credentials are only used locally
Ideas for improvements:
- Web interface with Streamlit
- Progress charts
- Integration with more platforms (Garmin, Polar)
- Export training plans
- Automatic notifications
Personal project - Free use
- Strava API for access to training data
- Anthropic Claude for the LLM power
- Jack Daniels for training formulas
Made with โค๏ธ for data-loving runners
Questions? Contact [your email]