Skip to main content
A Flow contains a version, an execution chain, declared inputs, an ordered list of op calls (also called nodes) and an optional epilogue. You choose every name and id in a Flow: input names, node ids and the flow’s own id. Later calls reference node outputs by id, and the compile response keys its records by id too: outputs entries (<nodeId>.<port>), settlements, and the nodeId on fundEscrow actions. Short names like amountIn, swap and zap work well.

Top-level shape

The chainId is the EVM chain the Flow executes on: where the user’s transaction runs and where every input must live. An input whose resource is on another chain is rejected with a validation_error. A Flow can still deliver to another chain through a bridge, a LI.FI Intents order or a continuation; see Future resources and Cross-chain flows. For every wire-format field, see Flow Schema.

Inputs

Each input is either a resource input, which carries a token balance, or a handle input, which carries a typed scalar such as a uint256 or an address. See Resource Model for how each one may be consumed.

Calls (nodes)

A Call is a single op invocation. Each call has:
  • a user-defined id, which later calls reference as <id>.<port>;
  • an op name from the manifest;
  • a bind map that wires its input ports to refs or literal values;
  • op-specific config;
  • optional guards.
Calls run in the order you author them, and a ref can only point to a node that appears earlier. Composer never reorders nodes. If your order makes the compile wait on more quote rounds than the dependencies need, the response carries a preparation_order warning; move independent quoted ops earlier to shorten the compile. Ops declare typed input and output ports; see Ports. See References for the ref grammar and Guards for what guards do.

Epilogue

The optional epilogue runs after the last call and moves balances off the execution proxy: forwards sends the whole balance of named tokens to an address, and remainder sends everything else the flow left there. run.sweepTo on the compile request is shorthand for the remainder. See The flow epilogue for exactly what it moves.

Example

Flow Schema: Complete request shows the wire-format Flow that the Swap and deposit recipe builds: a lifi.swap from WETH to USDC, then a lifi.zap into Aave with a slippage guard. Call builder.build() to see the Flow your own SDK code produces.

See also

  • Resource Model: how resources and handles behave at runtime.
  • References: how input.*, context.* and <nodeId>.<port> refs resolve.
  • Execution Model: how a Flow becomes calldata.
  • Cross-chain flows: a continuation.settle node embeds a second Flow (the destination flow) that runs later from an escrow.