Skip to content

waygraph / runGraph

Function: runGraph() ​

runGraph<TOut>(entry, terminals, context, mem, maxSteps?, options?): Promise<TOut>

Defined in: src/engine/run/run.ts:60

Runs entry against a fresh tab and returns the resulting terminal Checkpoint. The engine owns the tab's lifecycle, not any individual Block: the tab is created before the first act runs and closed in finally, so it closes even if a step throws.

After each Block resolves, its next (if any, from branch()) is followed to the following Block, in the same tab - a Block with no next runs exactly once, unchanged from before branch() existed. next returning the same Block is a self-loop; maxSteps bounds the loop so a routing bug fails loud instead of hanging.

terminals, if given, is a sanity check: the Checkpoint the run stops on must be one of the tags the caller actually expects, or the run fails loud instead of silently returning an unexpected result. Omit it when there is only ever one reachable outcome by construction (as with a map()-built Flow, which has no routing at all) - there is nothing to validate against.

Type Parameters ​

TOut ​

TOut extends Checkpoint<string>

Parameters ​

entry ​

Block<Checkpoint<"__start__">, TOut>

terminals ​

ReadonlySet<string> | undefined

context ​

BrowserContext

mem ​

MemPage

maxSteps? ​

number = 5000

options? ​

RunGraphOptions

Returns ​

Promise<TOut>

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed