ADR 005: Run Model and Lifecycle Tracking¶
Context¶
Orchestrating workflow executions across multiple attempts and invocations requires distinguishing between the workflow definition (intent) and execution instances (runs).
Decision¶
- Add an optional keyword-only
run_id: str | None = Noneparameter torun_workflowandrun_workflow_from_file. - If
run_idis omitted, generateuuid.uuid4().hex. run_workflowreturns therun_idas a string (wasNone), providing an additive API change.- Record run start and terminal completion in the
runstable, including start/finish timestamps, final status, and serialized workflow definition JSON. - Provide query functions
get_run_status(conn, run_id)andlist_runs(conn, workflow_id=None)returning runs ordered newest first.
Consequences¶
- Callers can trace specific runs end-to-end.
- Run status can be queried directly from SQLite even without holding in-memory workflow instances.