How mr-aicoder/axishealth.ai---your_fitness_agent works
Project Type and Purpose
• From the README and file tree, AxisHealth.ai is a full-stack, Streamlit-based web application that provides a personalized AI-powered fitness dashboard.
• It uses multiple AI “agents” (analysis, coach, nutritionist, trainer) orchestrated via LangChain and powered by Google Gemini and Tavily Search to deliver conversational advice, adaptive planning, and real-time research.
• Persistent data (user profiles, logs, metrics) live in a simple JSON-based database (user_db.json) accessed via database.py.
File Structure
• Top level:
• app.py – Streamlit entry point (UI orchestrator)
• database.py – data access layer for user_db.json
• user_profile_structure.py – model/schema for profile data
• requirements.txt, .devcontainer/ – environment & tooling
• agents/ – Python modules implementing each AI agent (analysis_agent, coach_agent, nutritionist_agent, trainer_agent)
• pages/ – Streamlit “multi-page” UI components (get_started, my_dashboard, log_workout, meal_calculator, bmi_analyzer)
• user_db.json – lightweight file DB storing per-user records
Key Architecture Insights from README
• UI layer (Streamlit) presents tabs/pages to user
• Orchestrator logic in app.py routes UI events to the appropriate Agent
• Agents use LangChain & Google Gemini LLMs plus Tavily Search for external knowledge
• Analysis Agent recalculates and updates plans; other agents provide coaching, meal plans, and exercise advice
• All interactions are tracked per user and persisted via database.py → user_db.json
Main Components
a. Frontend (Streamlit UI)
• app.py + pages/ folder
• Displays tabs, captures user input (login, metrics, queries)
b. Backend Orchestrator
• Controller in app.py
• Routes requests from UI to appropriate Agent module
c. Agent Modules
• Analysis Agent, Coach Agent, Nutritionist Agent, Trainer Agent (agents/ directory)
• Each encapsulates specific logic and calls out to:
• LangChain orchestration layer
• Google Gemini LLM
• Tavily Search API
d. Data Layer
• database.py interacting with user_db.json
• user_profile_structure.py defining the schema
e. External Services
• Google Gemini (LLM)
• Tavily Search API
• (Potential future: OAuth or other external data sources)
Relationships and Interactions
• User (browser) ↔ Streamlit UI
• Streamlit UI → Controller (app.py) → Agent Modules
• Agent Modules → External LLM Service / Search API
• Controller & Agents ↔ Database Layer → user_db.json
• Feedback loop: Analysis Agent updates user plans stored back to the DB, UI reflects updates
Architectural Patterns and Design Principles
• Separation of Concerns: UI, orchestration, agent logic, and data persistence are in distinct modules
• Modular AI Agents: Each agent is a self-contained micro-component, making the system extensible
• Single-process deployment: All modules run together under Streamlit, but conceptually layered
• Configurable through environment variables (Google/Tavily API keys)
Technologies, Frameworks, and Libraries
• Streamlit for the frontend
• LangChain for multi-agent orchestration
• Google Gemini as the LLM engine
• Tavily Search for real-time information
• Python (dataclasses or Pydantic via user_profile_structure.py)
• JSON file database (user_db.json)