Code Decides, LLM Helps: Building an AI Running Coach
Anthropic
The article describes the development of an AI running coach bot in Telegram, named Claude de Pace. The author shares key lessons learned from real user interactions, emphasizing that business invariants must be enforced by code, not left to the language model. The system balances deterministic code with constrained LLM outputs, uses subjective load ratings as a key metric, and includes an AI agent that helps debug and improve the bot.
The author developed an AI running coach bot in Telegram named Claude de Pace. A critical incident occurred when a user requested to move an easy workout to Saturday, but the model mistakenly changed Thursday's workout. This led to a guiding principle: code must enforce business invariants, not the LLM. The system evolved to give the model less freedom, using strict JSON schemas, validation, and deterministic fallbacks. The bot maintains a persona of a French coach, using extracted facts from conversations to personalize responses. Real user testing revealed issues like ignored buttons and misclassification, leading to features like draft confirmations for schedule changes. The author also built an AI agent to analyze logs and suggest code patches, resulting in about 30 improvements. Over 20 active users have provided valuable feedback. Future plans include integrating with smartwatches and adding social features like race calendars and workout sharing.
- Abbreviations
- LLM = Large Language Model — большая языковая модель
- FSM = Finite State Machine — конечный автомат
Source: Habr — хаб ИИ —
original
