~$Ajay Sogi
← All work
Case study · MyPTHub

AI Workout Generator

A production AI agent that helps coaches turn text, exercise data and images into structured training plans, with human review before delivery to a client.

Headline result
~40%
lower average cost per turn, with reasoning and output quality improving at the same time.
01
$ cat problem.md

The problem

Coaches repeatedly build training plans around their clients’ goals. An AI draft could reduce that manual work, but it still had to fit the app’s existing plan structure and leave the coach accountable for what a client received.

The production challenge was making useful drafts affordable and dependable enough for everyday use. Generated exercises, plan structure and the review experience all had to work together.

02
$ cat constraints.md

Constraints

  • Generated plans had to fit the app’s existing structure so coaches could use them inside the product.
  • Exercise data and media had to come from existing backend services, keeping the draft grounded in available content.
  • Larger images consumed more tokens, while reducing their resolution too far made them harder for the agent to interpret accurately.
  • Coaches needed to review and edit the generated plan before anything reached a client.
03
$ cat ownership.md

What I owned

I was a major contributor on the team that shipped the agent. I owned its UI/UX and interactive experience, and contributed to prompt engineering and multimodal inputs. My optimisation work used upload limits, shorter responses, fewer retries, caching and repeatable evaluations to balance token cost and accuracy.

04
$ cat decisions.md

Key decisions

  • 01Limit uploaded file sizes while preserving enough image detail for reliable interpretation. Smaller files reduced token use, but lowering resolution too far weakened accuracy.
  • 02Limit response length and unnecessary retries, and cache stable data or intermediate results. This reduced repeated work, but cached material still had to remain valid.
  • 03Keep coach review in the main workflow. It adds a deliberate handover, but lets the agent provide a useful draft while the coach retains control over the final plan.
05
$ cat flow.md

How it worked

├─Describe the workoutA coach supplies goals through text and optional images.
├─Plan the agent turnThe graph determines what information the turn needs.
├─Fetch exercise dataTools retrieve exercises and media from existing services.
├─Return a valid planGenerated output is checked against the app’s plan schema.
├─Coach reviews the planThe coach can accept, adjust or regenerate the draft.
└─Deliver to the clientThe reviewed plan appears alongside hand-built workouts.
06
$ cat changes.md

What changed

-uploaded images without a cost-aware file-size limit
-unbounded responses and unnecessary regeneration attempts
+upload and response limits, fewer retries and caching
+repeatable evaluations grouped by failure category
+average cost per turn reduced by approximately 40%

Average cost per turn fell by around 40%. Upload and response limits, fewer retries and caching reduced spend, while repeated evaluations and coach rubrics tracked quality.

07
$ cat reflection.md

Reflection

The useful shift was measuring cost and quality together. Repeated cases and failure categories showed consistency and made regressions easier to investigate.

Automated scores were only part of the evidence. Coaches also judged usefulness, accuracy and safety against a rubric, keeping quality tied to the people reviewing plans.