LangGraph agent · Claude · Python safety checks
A marathon plan that has to pass review
By Jeremy Lee. Tell it your race, goal, current mileage and weeks to go.
The model drafts the plan; plain Python checks it. critique flags any week that raises
mileage more than 20%, a race week above 75% of peak, a long run over 22.5 miles, or a long run longer than the
week, and merges that with an LLM review. revise fixes what was flagged and loops back, up to two
revisions by default.
One recorded run
Input
- Race
- Boston
- Goal
- 3:05:00
- Weeks to go
- 16
- Current miles / week
- 22
- Longest recent run
- 9 mi
- Days / week
- 5
- Race-day forecast
- 74°F
Recommended target
3:05 3:20
Agent trace
assess → feasible=False, target 3:20:00, peak 45 mpw plan → drafted 16 weeks adjust → tailored plan to course & weather critique → 5 issue(s): week 5 jumps mileage >20% (23→28) revise #1 → addressed 5 issue(s) critique → clean
Verbatim from examples/sample_run.md (status symbols left out). The full 16-week plan is on the writeup page.
The five nodes
- AssessIs the goal realistic for this fitness and timeline? Returns a target time and peak mileage.
- PlanDrafts Base, Build, Peak and Taper weeks as JSON.
- AdjustTailors the plan using course penalties against Berlin, about 1 minute per °F of heat, and the 30 km wall, from my own marathon analyses. The course figures are simulated (an earlier version of a study on a simulated field) and are labeled that way in the code and the prompt.
- CritiqueFour deterministic checks plus an LLM review.
- ReviseFixes the listed issues and sends the plan back to critique.
Runs from the command line or a Streamlit app that streams each node. Generation uses the Claude CLI by
default or the Anthropic API. An evaluation harness (src/eval.py) is written but its results haven't been captured yet.