Skip to main content
The execution surface is what your app calls to actually run a Flow. Authentication is the trigger secret for the Flow you’re calling — no PAT needed here.

flows.run

Options:
  • variables — override Flow variables per call. Same shape as the trigger variables field.
  • model — override the agent model for this run only (respects your workspace routing / BYOK).
  • idempotencyKey — send the same key twice and the server returns the first execution instead of running again.
Run-result failures don’t throw. The SDK gives you back a traceId and any partial outputs so you can log, retry, or degrade — always inspect .status and .failure on the return value. Transport / auth / request errors do throw; see Errors.

newTraceRef

Weave traces, signals, and feedback through your own logs with a correlation id you can assert before the trace exists.
Use this when you want the ref in your application logs (or a Slack message) before you have the traceId from the server response.

Common patterns

Degrade on partial

Idempotent retries

If you’re retrying at the HTTP layer (e.g. because your handler timed out but the server may already be processing), pass the same idempotencyKey on the retry. The server returns the original execution’s traceId instead of starting a new run.

Surface notices, not failures

notices[] are things that shaped the run but aren’t failures (tool-call cap hit, retrieval returned nothing, output truncated). Log them or show them to your admin UI, but don’t surface as errors to end users.

MCP / CLI equivalents

While the SDK is pre-publish, the same operation is available via MCP and the CLI:
Both return the same envelope as flows.runtraceId · status · outputs · notices · failure.