Moy Sport Bot
IvanAnis777/moy-sport-bot
Coach IA multi-agente para Telegram com dados Garmin e análise patterns
Ver no GitHubSistema multi-agente de coaching esportivo que integra métricas do Garmin, analisa padrões de treino e recuperação via SQLite time-series, e fornece feedback personalizado através de um bot Telegram powered por Claude. Inclui RAG customizado, relatórios PDF semanais e orquestração de múltiplos agentes especializados com guardrails e observabilidade.
Instalação
npx convez-ai IvanAnis777/moy-sport-bot1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Monitoramento contínuo de métricas de treino e recuperação
- Análise de padrões de estresse/fadiga com recomendações baseadas em dados
- Geração automática de relatórios semanais com gráficos e insights personalizados
- Coaching inteligente com histórico contextualizado via RAG
Veredito

Projeto robusto e bem-engineered de orquestração multi-agente com integração real de dados (Garmin + SQLite). Destaca-se pela implementação seria de tool-calling, RAG grounded em dados históricos e observabilidade end-to-end. Ideal para quem quer aprender padrões production-grade de agentes Claude com contexto real.
README
A tradução para o português deste README ainda está na fila.
moy-sport-bot
Multi-agent AI coaching system — Telegram bot that analyzes Garmin metrics + workouts, identifies patterns, and provides data-grounded coaching feedback. Built with Anthropic Claude, custom RAG, and a SQLite time-series store.
Stack: Python ·
aiogram 3· Anthropic Claude · OpenAI · LangChain-free architecture · SQLite + Alembic-style migrations · WeasyPrint · matplotlib · Playwright (Garmin SSO)
What it does
| Mode | Description |
|---|---|
| 🟢 Analyst (active) | Pulls Garmin daily metrics & workouts → SQLite, computes baselines, trends, stress/recovery patterns. Answers diagnostic queries via LLM grounded on stored data. Produces weekly PDF reports with charts. |
| 🟡 Coach + Motivator (legacy) | Original two-agent model: Coach builds plan, Motivator handles adherence. Kept parallel during Analyst rollout. |
The bot is single-user by design — built as a personal AI coaching experiment.
Architecture
graph TB
User[Telegram user] --> Bot[aiogram bot]
Bot --> Orch[Orchestrator]
Orch --> Analyst[Analyst Agent]
Orch --> Trainer[Trainer Agent]
Orch --> Motivator[Motivator Agent]
Orch --> Vision[Vision Agent]
Analyst -- tool calls --> Tools[Diagnostic Tools]
Tools --> Store[(SQLite store)]
Garmin[Garmin Connect SSO] -- Playwright auth --> Sync[Garmin sync]
Sync --> Store
MFP[MyFitnessPal via Garmin] --> Store
Analyst --> LLM[Claude / OpenAI]
Trainer --> LLM
Motivator --> LLM
Vision --> LLM
Analyst --> RAG[RAG retriever]
RAG --> KB[Knowledge base]
Orch --> Reports[Weekly Reports]
Reports --> PDF[WeasyPrint PDF]
Reports --> Charts[matplotlib charts]
Orch --> Guard[Guardrails]
Orch --> HITL[Human-in-the-loop]
Orch --> Trace[Prompt log & tracing]
Engineering highlights
- Multi-agent orchestration with role-specialized prompts and tool schemas (
src/moy_sport/agents/) - Analyst agent with structured tool-calling (Anthropic function calls) for grounded diagnostics — answers reference real DB queries, not hallucinations (
agents/analyst/) - Garmin integration via Playwright SSO + custom
/gc-api/client with token rotation (integrations/garmin/) - SQLite time-series store with versioned SQL migrations (
storage/migrations/0001-0004_*.sql) and bulk ingestion - RAG pipeline (chunker + retriever) over a personal knowledge base for context-aware responses
- Guardrails + HITL layers — risky outputs require human approval (
core/guardrails.py,core/hitl.py) - Observability: prompt log + tracing (
core/prompt_log.py,core/tracing.py) - Weekly report pipeline: aggregators → trends → charts → PDF rendering (
reports/) - Energy balance computation: Garmin-side consumed/expended calories (migration 0004) with daily/weekly aggregation
- Backfill commands for historical Garmin data with command pattern
- 130+ pytest tests covering agents, storage, RAG, reports, Garmin sync
Tech stack
LLM & AI:
- Anthropic Claude — primary
- OpenAI GPT — alternative provider via
llm_provider.py - Sentence-transformers (embeddings, in
rag/) - Tool-calling / function-calling architecture
Backend:
- Python 3.11+
aiogram3 (Telegram bot, polling mode)- SQLite with manual SQL migrations + runner
- Pydantic v2 for config & profile models
uvfor dependency management
Integrations:
- Garmin Connect SSO via Playwright
browser_cookie3for fallback cookie auth- MyFitnessPal nutrition data (via Garmin daily summary)
Reports & viz:
- matplotlib for charts
- WeasyPrint for HTML→PDF
- Jinja2 templates
Project layout
src/moy_sport/
├── bot/ # aiogram Telegram bot
├── core/ # orchestrator · guardrails · HITL · prompt log · tracing
├── agents/
│ ├── analyst/ # diagnostic agent with tool-calling
│ ├── trainer.py # workout planner (legacy)
│ ├── motivator.py # adherence coach (legacy)
│ ├── vision.py # photo analysis
│ └── llm_provider.py
├── integrations/
│ └── garmin/ # SSO · sync · backfill · readiness · metrics
├── onboarding/ # user profile flow & states
├── processing/ # aggregators · baselines · patterns · stress split · trends
├── profile/ # profile models & store
├── rag/ # chunker · loader · retriever
├── reports/ # charts · pdf · pipeline · weekly · text render
├── storage/ # connection · ingest · migrations · runner
└── web/ # web UI (FastAPI + Jinja2)
tests/ # 35+ test files
docs/ # ADR · architecture · plans
Configuration
Copy .env.example to .env and fill in:
LLM_PROVIDER=anthropic # or gemini
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-... # optional
PINECONE_API_KEY=... # optional
TELEGRAM_BOT_TOKEN=...
GARMIN_EMAIL=...
GARMIN_PASSWORD=...
Garmin auth: run python scripts/garmin_auth.py once to capture SSO tokens via Playwright (tokens persist ~1 year in data/.garmin_tokens/).
Quick start
# Install
uv sync
# Apply migrations
python -m moy_sport.storage.runner
# Auth with Garmin (one-time)
python scripts/garmin_auth.py
# Start bot
python -m moy_sport.bot.app
Status & disclaimer
Personal project, single-user by design. Public release shows architecture and engineering patterns — personalized coaching context (deep behavioral patterns, individual rules) is loaded from a private profile at runtime, kept out of the public codebase.
Not a production-ready library or product. Use as reference / learning material.
License
MIT