assess plan adjust critique revise END issues → revise clean → done

A self-correcting LangGraph agent

Marathon Training Plan Agent

Tell it your race, goal and fitness. It drafts a periodized plan, tailors it to your course and the weather, then critiques and revises its own work until the plan passes real safety checks.

By Jeremy Lee · built with LangGraph + Claude

Why an agent, not a prompt?

Ask an LLM for a training plan and you get a plausible table that might ramp mileage too fast, skip the taper, or prescribe a 26-mile long run. Here the model runs inside a graph with a feedback loop: a critique node runs deterministic safety checks, a revise node fixes what it flags, and it re-checks. The plan you get has survived review — not just generation.

• assess → feasible=false, target 3:12:00, peak 45 mpw • plan → drafted 16 weeks • adjust → tailored to Boston hills & 74°F heat • critique → 2 issues: week 6 jumps >20%; insufficient taper • revise #1 → addressed 2 issues • critique → clean ✔ passed all safety checks
🧠

Assesses realism

Judges whether your goal time fits your current fitness and timeline — and proposes a smarter target if not.

🗺️

Race-specific

Tailors the plan to your course and race-day heat using my own marathon analyses — Boston isn't Berlin.

🔁

Critiques itself

Deterministic safety checks plus an LLM review catch bad ramps, missing tapers and monster long runs — then a revise loop fixes them.

🔍

Shows its work

Every run prints an agent trace so you can see each node act and each issue it caught.

The graph

assess ─▶ plan ─▶ adjust ─▶ critique ─┬─ issues & budget ─▶ revise ─┐ │ │ └────────── clean ──────▶ END │ revise ─▶ critique ◀──────┘

How to use it

  1. Give it your race, goal time, current mileage, longest run, weeks to go and days/week.
  2. It assesses feasibility, drafts a periodized plan, and tailors it to the course + weather.
  3. It critiques the plan against safety rules and revises until clean (or the budget runs out).
  4. You get a week-by-week plan plus the full agent trace.
Under the hood: built with LangGraph; generation runs on the Claude CLI by default (your Claude subscription, no per-token cost) or the Anthropic API. Educational tool, not professional coaching advice.
Get it on GitHub Read the setup guide