Standard library only · runs in your browser
ReAct decides one step at a time, and pays a model call for every step. Plan-and-execute has the model write the whole plan once, then your code runs it: in dependency order, piping outputs into later steps, and skipping work that depends on a failure.
Implement execute_plan(plan). Each step is {"id", "tool", "arguments", "depends_on": [ids]}.
ValueError for duplicate step ids, a depends_on that names an unknown step, or a dependency cycle.plan."ok", the step is {"status": "skipped", "output": None}."$<step id>" becomes that step's output, parsed with json.loads when possible (so "5" becomes 5), or the raw string otherwise.dispatch. If the output starts with error:, the status is "error", otherwise "ok".{"order": [ids in run order], "results": {id: {"status", "output"}}}. Skipped steps appear in order too.execute_plan(plan: list[dict]) -> dict