This repository contains an example implementation of an AI fitness agent built using LangGraph. The agent helps users analyze their workout data and provides personalized fitness recommendations.
- Interactive conversation to gather workout information
- Analysis of workout patterns
- Personalized recommendations for workout duration and frequency
- Progress tracking capabilities
- Error handling and state management
- Python 3.8+
- AWS Account with Bedrock access
- Required Python packages (see requirements.txt)
- Clone the repository:
git clone https://github.com/mossydidar/ai-fitness-agent.git
cd ai-fitness-agent
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
Create a
.env
file in the root directory with the following variables:
LANGCHAIN_TRACING_V2=true
LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
LANGCHAIN_API_KEY=your_api_key
LANGCHAIN_PROJECT=ai-fitness-agent
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_REGION=us-east-1
- Start LangGraph Studio:
langgraph studio start
-
Load the project in LangGraph Studio using the
langgraph.json
configuration. -
Interact with the agent through the LangGraph Studio interface.
Example conversation:
User: "I want to improve my workout routine"
Agent: "I'd be happy to help you improve your workout routine. Could you please tell me:
1. What type of workout do you currently do (cardio or strength)?
2. How long are your typical workouts (in minutes)?
3. What's your current intensity level (low, medium, or high)?
4. How many times per week do you work out?"
User: "I do cardio for 30 minutes at medium intensity, 3 times per week"
Agent: [Provides personalized analysis and recommendations]
agent.py
: Main implementation of the fitness agentlanggraph.json
: Configuration file for LangGraph Studiorequirements.txt
: Python package dependencies
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.