Docs › Prefect with RunVouch
Prefect with RunVouch
A Prefect deployment with a schedule creates flow runs; a worker on the right work pool executes them. When the worker is gone, runs pile up as Late and Scheduled, and the flow's own failure hooks never fire because nothing failed.
How it runs on Prefect
Around the flow: wrap the process that runs the flow (rv run ... -- python flow.py or prefect deployment run), or use the Python client inside the flow function. Prefect's own retries and logging stay untouched.
Store the key
A Prefect Secret block (Secret.load("runvouch-key")) or an environment variable on the work pool's job template.
Wrap the job
from prefect import flow, task
from prefect.blocks.system import Secret
import os, runvouch
@flow(name="nightly-report")
def nightly_report():
os.environ["RUNVOUCH_KEY"] = Secret.load("runvouch-key").get()
with runvouch.vouch("nightly-report", evidence=lambda: {"report": os.path.exists("out/report.html")}) as run:
rows = extract()
run.tool("llm.summarise", {"rows": len(rows)}, cost=0.03)
write_report(rows)
# prefect deploy ... --cron "0 2 * * *"rv fails open: if RunVouch is unreachable the job still runs and you get one warning line.
Register the cadence and caps
rv agent nightly-report --cadence 24h --grace 30m --max-runtime 1h --evidence --cap-run-cost 2
Register the agent once, from anywhere with the key. Cadence is what turns a schedule that stopped into an alert; --evidence makes a run without evidence a failure; the caps pause the agent when it overspends.
What goes silent on Prefect
- Late runs are visible in the UI and in automations you have to create; RunVouch's MISSED needs neither.
- A flow that completes with an empty result is Completed; evidence separates it from a good run.
- Prefect task retries multiply LLM calls; the retry-storm detector sees identical tool inputs across retries.
What RunVouch detects
| Alert | What it means here |
|---|---|
| MISSED | cadence plus grace passed and no run started |
| FAILED | non-zero exit or a reported failure, with the stderr excerpt |
| NO_EVIDENCE | the run said ok but the file, URL or assertion you required is missing |
| STALLED | a run started and never ended within max runtime |
| RETRY_STORM | the same tool called with identical input many times in one run |
| BUDGET_RUN / BUDGET_DAY | cost cap crossed; the agent is paused until you resume it |
| DRIFT | duration or output size far off its 7-run baseline |
Need a key? Get a free key · Stuck? contact