# Run, inspect and recover

Follow asynchronous runs, diagnose captured versions and reconcile uncertain effects.

Canonical URL: https://opennodeflow.dev/wiki/agent-execution/
JSON reference: https://opennodeflow.dev/wiki/agent-execution/index.json
Source snapshot: 2026-10-23

Saving, validating and running are separate operations. `onf_run_workflow` queues a real execution. The returned run identity is the starting point for subsequent observation; it is not a statement that every node completed successfully.

## Before execution

Read the saved workflow and relevant definitions, verify input/configuration and check the user's intended scope. Validation does not execute code or contact providers. A library code test does execute code, even when its state/storage sandbox is temporary. Inspect effects and use synthetic or explicitly authorized inputs.

A workflow with multiple trigger nodes needs an explicit `triggerNodeId` for the intended branch. A disabled automation master does not block manual runs, but a paused selected entry cannot run. See [triggers](/wiki/triggers/) for effective entry states.

## Track one accepted run

Call `onf_run_workflow` once for the intended attempt, retaining the returned run ID. Poll `onf_get_run` or use `onf_wait_run`:

~~~json
{"runId":"RUN_ID","timeoutMs":10000,"pollIntervalMs":500}
~~~

The wait tool accepts 0–30,000 ms and returns `{completed,run}`. A timeout means observation finished before the run; it does not cancel or restart work. Pending, queued, running, paused or waiting states are different from terminal success, failure, cancellation or interruption. Durable waits may intentionally suspend until a timer, callback or Inbox decision.

## Diagnose the actual execution

Use `onf_diagnose_run` for a concise failure/skip/attempt summary. Fetch `onf_get_run` for actual node input/output and logs, then `onf_get_run_snapshot` for the immutable workflow and exact definition/type/executor versions captured at admission. Latest code can differ. Missing retained snapshots limit what can be concluded; do not invent historical contracts.

`onf_get_run_logs` supports a selected `nodeId` and bounded paging. Captured messages retain node order but do not have individual timestamps. Use recorded node/run timing for chronology. Run storage history records accepted mutations before/after an attempt, including writes retained when later work fails.

## Recover without duplication

A lost response after a run or provider write is an uncertain outcome. Read the target/run and use stable business correlation before deliberately repeating anything. Calling run again creates another run and can repeat external actions. Cancellation stops current ONF work but cannot undo an already accepted provider effect.

Repair the current graph under its current revision, keeping historical evidence intact. Report what failed, what is known to have committed, the saved fix and any recovery decision still needed. [Durable storage](/wiki/agent-storage/) provides versioned records and queue state for explicit reconciliation; it does not make external execution transactional.

---

## Documentation provenance

- `docs/MCP.md`
- `server/mcp-tools.ts`
- `docs/DEBUGGING-AND-WAITS.md`
- `docs/RUN-STORAGE-HISTORY.md`

This page describes maintained source, not a live inventory or an authorization to perform actions.
