Flow
Flow execution proxy with execute, streaming, and run methods.
Flow
Proxy object for executing a single flow. Obtained via noukai.flow(slug).
Methods
async execute(options) -> ExecuteResult | PausedResult
Execute the flow to completion and return the result.
Parameters:
message(string, optional): User message — the flow's primary input. Can be omitted ifparameterscontains all required inputs.parameters(object, optional): Flat object of flow-level initial inputs (not nested by block). Default:{}blockOverrides(object, optional): Per-step config overrides, format{ "step_id": { "field": value } }. Default:{}attachments(array, optional): Up to 10 media attachments (HTTPS URLs). Default:[]tools(array, optional): OpenAI-format tool definitions. Max 64. Default:[]toolChoice(string or object, optional):"auto"|"none"|"required"|{ type: "function", function: { name: ... } }. Default:undefinedtoolHandler(function, optional): Async function(toolCalls) => toolResultsfor auto-resume. Default:undefinedmaxToolRounds(number, optional): Safety bound on tool-handler loop. Defaults to 10. Throws if exceeded.trace(boolean, optional): Capture full input/output snapshots in trace. Timing/tokens recorded either way. Default:falseversion(string or number, optional):"draft"(default),"production", or a published version number. Default:"draft"timeout(number, optional): Request timeout in milliseconds. Default:undefinedsignal(AbortSignal, optional): Abort signal for cancellation. Default:undefined
Returns:
ExecuteResulton successful completionPausedResultif the flow pauses for tool calls and notoolHandleris provided
Throws:
FlowNotFoundError: Flow does not existInsufficientCreditsError: Account balance insufficientFlowExecutionError: Server-side execution failureValueError: Invalidversionvalue
Examples:
Basic execution:
With parameters and version:
With tools and auto-resume:
steps(options) -> AsyncIterable<StepCompleted>
Stream completed steps as they finish during execution.
Yields: StepCompleted events with step output and timing
Example:
events(options) -> AsyncIterable<StreamEvent>
Stream all execution events in real-time.
Yields: StreamEvent — discriminated union of RunStarted, StepStarted, StepInput, StepOutput, StepCompleted, StepFailed, StepPaused, ToolCallsRequired, FlowCompleted. Switch on event.type for full TypeScript narrowing.
Example:
run(executionId) -> Run
Get a proxy to inspect a previous execution.
Parameters:
executionId(string): Execution ID from a previousexecute()result
Returns: Run proxy for tracing and inspection
Example:
async executeAsync(options) -> Job
Submit the flow to the server queue for asynchronous execution (long-running flows). Returns immediately with a Job handle.
Accepts same parameters as execute() except toolHandler, maxToolRounds, and attachments are not supported.
Returns: Job with executionId available immediately
Example:
Streaming Parameters
Both steps() and events() accept the same parameters as execute():
Version Values
The version parameter accepts:
| Value | Behavior |
|---|---|
"draft" (default) | Execute the in-progress draft version |
"production" | Execute the currently promoted production version |
N (number, e.g., 3) | Execute a specific published version number |
Strings other than "draft" and "production" (e.g., "main", "dev") throw ValueError.
"production" is currently not implemented server-side and raises NotImplementedError at runtime. Use "draft" or a pinned version number for now.
Examples: