Prefect Ops
Generic Prefect 3 REST skill. The helper uses only the Python standard library, prints UTF-8 JSON to stdout, avoids echoing secrets, and keeps reads and writes clearly separated.
Configuration
Provide the API endpoint through an environment variable or flag:
| Variable | Flag | Required | Notes |
|---|---|---|---|
PREFECT_API_URL |
--api-url |
yes | Prefect API base URL, for example https://prefect.example/api |
PREFECT_API_KEY |
none | no | Optional bearer token; environment-only to avoid shell history/process-list exposure |
PREFECT_ALLOW_WRITE |
none | for writes only | Must be exactly true to enable mutations |
Writes require both:
PREFECT_ALLOW_WRITE=true--confirm-write
Reads never require either gate.
Secret setup
Before configuring credentials, ask which secret manager and local profile the user wants. Follow Secure secret profiles. Do not invent or publish profile names, hosts, templates, or secret references. If the user asks for the author's method, use a per-profile Proton Pass pointer file with process-scoped pass-cli run. Never request or display resolved values.
Run
From this skill directory:
uv run --python 3.13 python scripts/pf.py --api-url https://prefect.example/api server-version
uv run --python 3.13 python scripts/pf.py flow-runs --limit 20
uv run --python 3.13 python scripts/pf.py deployments --limit 50
uv run --python 3.13 python scripts/pf.py deployment --deployment my-flow/my-deployment
uv run --python 3.13 python scripts/pf.py logs --flow-run 00000000-0000-0000-0000-000000000000 --limit 100
uv run --python 3.13 python scripts/pf.py scheduled-runs --deployment my-deployment --limit 10
uv run --python 3.13 python scripts/pf.py blocks --limit 100
uv run --python 3.13 python scripts/pf.py count --state FAILED CRASHED --since-hours 24
uv run --python 3.13 python scripts/pf.py variables --limit 100
Write examples:
PREFECT_ALLOW_WRITE=true uv run --python 3.13 python scripts/pf.py run --deployment my-flow/my-deployment --param retries=2 --confirm-write
PREFECT_ALLOW_WRITE=true uv run --python 3.13 python scripts/pf.py cancel --id 00000000-0000-0000-0000-000000000000 --confirm-write
PREFECT_ALLOW_WRITE=true uv run --python 3.13 python scripts/pf.py pause --deployment my-flow/my-deployment --confirm-write
PREFECT_ALLOW_WRITE=true uv run --python 3.13 python scripts/pf.py add-schedule --deployment my-flow/my-deployment --cron "1 2 * * *" --timezone UTC --confirm-write
PREFECT_ALLOW_WRITE=true uv run --python 3.13 python scripts/pf.py resume-run --id 00000000-0000-0000-0000-000000000000 --confirm-write
PREFECT_ALLOW_WRITE=true uv run --python 3.13 python scripts/pf.py variable-set --name feature_flag --value true --confirm-write
--deployment accepts:
- a deployment UUID
flow_name/deployment_name- a bare deployment name, if it resolves to exactly one deployment
Read commands
flow-runsflow-runtask-runslogsdeploymentsdeploymentschedulesscheduled-runsvariablesvariableautomationsautomationwork-poolsblocks(metadata only; block data is always redacted)countserver-version
Write commands
runcancelretryresume-rundeletedelete-deploymentadd-scheduledelete-schedulepauseresumeset-statevariable-setvariable-delete
Safety contract
- API keys are never printed.
- Every write is double-gated by environment and CLI confirmation.
- Response sizes, timeouts, and list limits are bounded.
blocks, includingblocks --full, always removes the blockdatafield before output.- HTTP failures return concise JSON errors on stderr.
- Deployment lookup is generic and contains no bundled names or infrastructure assumptions.
- Prefer a server-side read-only or least-privilege token when possible.
Tests
From the repository root:
uv run --python 3.13 python skills/prefect-ops/tests/test_pf.py
uv run --python 3.13 scripts/validate_skills.py