cd /news/artificial-intelligence/building-a-fitness-workout-planner-a… · home topics artificial-intelligence article
[ARTICLE · art-48118] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Building a Fitness Workout Planner Agent in typescript with HazelJS

A developer built a fitness workout planner agent using HazelJS, a framework for multi-agent AI systems. The planner uses five specialized agents for intake, exercise search, workout planning, progress tracking, and safety, with HazelJS providing RAG, resilience patterns, and guardrails. The system demonstrates how agentic AI can create personalized, adaptive workout plans more effectively than monolithic approaches.

read4 min views1 publishedJul 4, 2026

Fitness planning is inherently complex. It requires understanding individual goals, physical capabilities, available equipment, and creating progressive workout plans that adapt over time. Traditional fitness apps often provide static templates, but they struggle with personalization and adaptation. This is where agentic AI shines.

In this post, we'll build an intelligent fitness workout planner using HazelJS that demonstrates how multi-agent systems can solve real-world problems more effectively than monolithic approaches.

When someone asks for a workout plan, they're not just requesting exercises. They need:

A single AI model trying to handle all these aspects often produces generic recommendations. Agentic AI, however, allows us to create specialized agents that excel at specific tasks while collaborating seamlessly.

Agentic AI is particularly well-suited for fitness planning because:

HazelJS makes this natural by providing the building blocks for multi-agent systems: the @Agent

decorator for defining agents, @Tool

for capabilities, and @Delegate

for orchestration.

Our fitness planner uses five specialized agents, each with a clear responsibility:

This separation of concerns makes each agent simpler, more testable, and easier to improve independently. When we want better exercise recommendations, we only need to enhance the ExerciseSearchAgent without touching the workout planning logic.

HazelJS's @Delegate

decorator makes agent collaboration straightforward. The FitnessCoachAgent doesn't need to know how to search exercises or track progress—it simply delegates to specialists:

@Delegate({
  agent: 'ExerciseSearchAgent',
  description: 'Retrieve exercises based on goals, muscle groups, and equipment.',
  inputField: 'input',
})
async getExercises(input: string): Promise<string> {
  return '';
}

This declarative approach means the orchestrator stays focused on coordination while specialists handle domain expertise.

Finding the right exercise isn't just keyword matching—it requires understanding muscle groups, equipment needs, and difficulty levels. We use HazelJS's RAG capabilities with a MemoryVectorStore for semantic search:

const rag = new RAGPipeline({
  vectorStore: this.vectorStore,
  embeddingProvider: this.embeddings,
  topK: 3,
});

When a user asks for "chest exercises without equipment," the RAG system understands the semantic meaning and returns relevant exercises like push-ups, even if the exact phrase doesn't appear in the exercise description.

Fitness apps need to be reliable. HazelJS provides built-in resilience patterns:

These features are configured once in the AgentModule and apply across all agents automatically:

AgentModule.forRoot({
  runtime: {
    enableRetry: true,
    enableCircuitBreaker: true,
    rateLimitPerMinute: 120,
    enableObservability: true,
  },
})

Fitness recommendations can have real-world consequences if incorrect. HazelJS's guardrails provide:

This is especially important for fitness apps where users might share sensitive health information.

The FitnessIntakeAgent transforms natural language into structured data. Instead of parsing "I want to lose weight, beginner level, 30 min workouts, no equipment" manually, we use tool-based extraction:

@Tool({
  name: 'extractFitnessProfile',
  description: 'Extract structured fitness planning information from a user request.',
  parameters: [
    { name: 'message', type: 'string', description: 'The raw user request', required: true },
  ],
})
async extractFitnessProfile(input: { message: string }) {
  return {
    goal: this.extractGoal(input.message),
    fitnessLevel: this.extractFitnessLevel(input.message),
    equipment: this.extractEquipment(input.message),
    // ... more fields
  };
}

This structured output becomes the foundation for all subsequent agents, ensuring consistency across the workflow.

The WorkoutPlannerAgent doesn't just pick random exercises—it considers the user's goals:

The agent also balances exercises across muscle groups, ensures adequate rest periods, and provides notes for each day (like "Start with proper warm-up" or "Active recovery day").

The ProgressTrackerAgent goes beyond simple logging—it calculates meaningful metrics and unlocks achievements:

const achievements = [
  {
    id: 'first-workout',
    title: 'First Workout',
    description: 'Completed your first workout session',
    unlocked: true,
  },
  {
    id: 'consistent-week',
    title: 'Consistent Week',
    description: 'Completed workouts for 7 days',
    unlocked: false,
  },
];

Gamification elements like achievements keep users motivated, while metrics provide concrete feedback on progress.

This architecture extends beyond personal fitness:

The multi-agent approach makes these adaptations straightforward—swap the exercise knowledge base, adjust the goal categories, and the same architecture works.

npm install --legacy-peer-deps
npm run build
npm run eval
npm run dev

The eval tests verify each agent works correctly before integration. The development server starts on port 3000 with the HazelJS Inspector available at /__hazel

for real-time monitoring.

curl -s -X POST http://localhost:3000/fitness/intake \
  -H 'content-type: application/json' \
  -d '{"message":"I want to lose weight, beginner level, 30 min workouts, no equipment"}'

curl -s -X POST http://localhost:3000/fitness/supervisor \
  -H 'content-type: application/json' \
  -d '{"message":"I want to lose weight, beginner level, 30 min workouts, no equipment. Plan my week."}'

The supervisor endpoint demonstrates the full workflow: intake → exercise search → workout planning → progress tracking, all orchestrated automatically.

Complete Project: Fitness workout Planner Agent

For production deployment, consider:

This fitness workout planner demonstrates how HazelJS enables building sophisticated AI applications with production-ready patterns. The multi-agent architecture, RAG-powered search, and built-in resilience features make it possible to create reliable, observable, and scalable fitness applications.

More importantly, it shows that agentic AI isn't just theoretical—it solves real problems better than traditional approaches. By breaking complex tasks into specialized components that collaborate, we get systems that are more maintainable, more testable, and ultimately more effective.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @hazeljs 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/building-a-fitness-w…] indexed:0 read:4min 2026-07-04 ·