Skip to content

Run a workflow

openadapt flow replay performs every step against the app you point it at, including saves. It never checks the record and ends COMPLETED_UNVERIFIED at best. openadapt flow run is the governed path. Before the first step it checks the program against its policy and, under the Standard and Regulated profiles, its seal and production admission. It refuses to start when a check fails.

1. Write a deployment file

Draft a deployment file bound to the bundle, then fill in every field listed under unresolved:

python -m openadapt_flow.cli_config init bundle --out deploy.yaml

certify and run refuse the draft until unresolved is empty. The fields are described in Configuration. Don't put secret values in the file; it takes environment variable names.

2. Choose a profile

Profile Use it for What it requires Best result
demo Trying things out A bundle. Screen evidence is allowed. COMPLETED_UNVERIFIED
standard Production inside a qualified, encrypted storage boundary Certification, a sealed program, durable checkpoints, a right-record check on every save, a record check that doesn't go through the acting session, and a production admission VERIFIED
regulated Production with regulated data, such as patient records Everything in Standard, plus an encrypted program (OPENADAPT_BUNDLE_KEY), sealed evidence files, and encrypted checkpoints, in a deployment you control VERIFIED

Flags can make a profile stricter but never weaker. Select the profile with --profile or runtime.profile in the deployment file.

openadapt flow certify bundle --config deploy.yaml
openadapt flow run bundle --profile standard --config deploy.yaml \
  --qualification-authority-file /secure/admission.json

3. Choose how saves are approved

Each run has an approval mode. It decides whether the run waits for an answer before each save. Approval modes are separate from admission, which happens once per workflow before production runs.

Mode Before each save
each_item The run waits until that save is approved, then saves exactly what was approved.
problems_only Only problems go to a person. It turns on only after the workflow passes a readiness gate; until then, every save asks.
not_gated No pause. The run report records that the run wasn't gated.

openadapt flow run uses each_item unless --approval-mode or runtime.approval_mode names another mode, under every profile. The MCP server passes the mode its operator set with serve --approval-mode; callers can't change it. Runs that OpenAdapt Cloud dispatches pass not_gated explicitly, and their reports say so. A run that waits longer than --approval-wait (default 900 seconds, at most 14,400) stops before the save; resume can still use an answer given later.

Answer a waiting save

show prints the run's waiting requests as JSON, including each request_id and request_sha256. A person answers one with approve or decline:

openadapt flow item-approval show RUN_DIR
openadapt flow item-approval approve RUN_DIR --request-id ID \
  --request-sha256 SHA256 --decided-by human --route desktop_run_it \
  --unauthenticated

decline takes the same options plus --reason: wrong_values, wrong_record, or screen_problem. --unauthenticated records the answer without a name; to name the approver instead, pass their OpenAdapt Cloud user id with --approver-id and how they signed in with --auth-method cloud_aal2 or cloud_aal1. OpenAdapt Desktop shows the same request as a form in its next build; see Install the desktop app.

Let an agent or system answer

By default only a person may answer. An approver policy lets an agent, a rule, or a system answer some kinds of save. Pass it with --approver-policy on run, resume, or qualify run-case:

{
  "schema_version": "openadapt.approver-policy/v1",
  "allowed": {
    "read_only": ["person", "agent"],
    "reversible": ["person", "agent"],
    "consequential": ["person", "agent"],
    "irreversible": ["person"],
    "clinical_write": ["person"]
  }
}

The policy names every step class: read_only, reversible, consequential, irreversible, and clinical_write. A clinical_write save takes a non-person approver only when clinical_write_opt_in_sha256 pins the customer's signed opt-in. Under the clinical-write and regulated policies, every save is a clinical write. An unreadable policy means person-only.

A delegated approver answers in one of three ways:

  • At the command line. item-approval approve or decline with --decided-by automation, --delegate-kind agent or system, --delegate-id ID, and --route local_cli. --on-behalf-of names the organization or person it acts for.
  • Over MCP. With serve --delegate-approvals AGENT_ID, the agent uses list_approval_requests and answer_approval_request; see Connect an agent.
  • By webhook. --approver-webhook URL with --approver-webhook-id ID asks an https endpoint about each waiting save. --approver-webhook-kind is system (the default) or agent. Each message is signed with HMAC-SHA256 using OPENADAPT_APPROVER_WEBHOOK_SECRET, in the X-OpenAdapt-Signature header. It carries ids, the step class, the mode, digests, and the expiry, never the step's words, a screenshot, or a value. The reply must be signed and say approve, decline with a reason, or pending. Any failure leaves the save to a person.

The run checks every answer against the policy, and the report records who or what approved, by which route. A person can always answer instead.

4. Read the result

run prints a one-line result and writes REPORT.md and report.json to the run directory. The outcome in report.json is one of the values in Run outcomes.

Exit code Meaning
0 Under Standard or Regulated, the run ended VERIFIED. Under Demo, the steps finished.
1 The run started and didn't end as above: it stopped, needs a record checked, or failed.
2 The run was refused before any step ran, for example for a missing admission or a failed policy check.

Under Demo, exit 0 doesn't mean the save was checked. Read transaction_outcome in report.json.

For a plain-language account of any run:

openadapt flow explain runs/<run-dir>

To check a run before it touches anything, add --dry-run. It prints which gates pass and exits without running.

Pause and resume long runs

With --durable (on by default under Standard and Regulated), the run checkpoints each confirmed step. When it stops, it pauses instead of ending, and writes the reason to pending_escalation.json.

openadapt flow approve runs/<run-dir> --approver "jane@clinic.example"
openadapt flow resume runs/<run-dir> --require-approval

resume never performs a confirmed save again. It keeps the run's own approval mode. A run that ended RECONCILIATION_REQUIRED isn't retried by an ordinary approval: after a person checks the record, approve --authorize-uncertain-retry allows one retry of the uncertain step.

Run in a browser you're already signed in to

Start Chromium with remote debugging and pass its local endpoint:

openadapt flow run bundle --browser-cdp-endpoint http://127.0.0.1:9222 \
  --url https://app.example.org ...

The run uses the one open tab on that origin, starts from the screen it shows, and never navigates or closes the browser. Open the task's first screen before each run.

Run on a desktop or remote surface

Pass the same surface options you recorded with, for example --backend macos --macos-app TextEdit, --backend windows --agent-url http://localhost:5001, or --backend citrix. A governed Citrix run also needs --rdp-readiness-text, a stable text that must be visible in the remote frame before any input.