#Implement an SDK or runtime
Any suitable executable runtime can implement FLOW Run/0 over stdio.
An SDK makes that exchange convenient for authors through handle(handler) and context.call(...).
It owns serialization, validation, cancellation, and accounting for outbound work.
This guide follows one invocation through the wire exchange. Run/0 defines wire behavior. Run SDK/0 defines the authoring projection. Check current support when choosing an existing implementation.
#Receive an invocation
The host selects a component and sends one flow/run request.
This entry request is the same for a directly invoked component and a launched dependency.
Illustrative request:
The host supplies an actual scratch path and finite deadline for the invocation. The values above illustrate the request shape. Validate the complete request before calling the handler. Expose input, settings, attachments, channels, scratch, deadline, and cancellation through the context.
Run/0 IDs are bounded ASCII strings. Frames are bounded, LF-terminated UTF-8 objects with JSON/0 values. Keep the reader active while waiting for replies. Serialize and flush writes. Track request IDs and pending requests throughout the exchange.
#Call a dependency
The author selects a declared slot through context.call(...).
The SDK sends flow/call with a fresh wire request ID and the author's operation identity.
Illustrative request:
The host resolves and authorizes the slot.
When it launches another component, it constructs that component's flow/run context.
A native implementation uses the same call-level input/result boundary.
The host owns package resolution, credentials, runtime settings, and grants.
Run/0 defines optional intent and channels fields.
#Preserve the complete result
Both operations return an outcome and output:
Correlate and validate responses before exposing them to the author. Preserve declared domain outcomes as result data. Expose operational errors separately, as specified by Run SDK/0. Return the complete result so callers can inspect its meaning before using the output.
#Propagate cancellation and settle work
Cancellation targets a pending request by its string ID:
Propagate root cancellation to the handler and pending outbound waits. The host enforces termination. Cancellation leaves already dispatched external effects subject to their actual state. Apply Run/0's distinctions between operational errors, fatal protocol errors, and transport loss.
Settle every owned outbound request and channel operation before emitting the root response. Validate the handler result, flush the response, and exit with the required status. The host also checks process exit, pending work, and trailing stdout. Receiving a result alone leaves those completion checks outstanding.
#Keep protocol output separate
Capture the protocol writer before redirecting ordinary application logging to stderr. Keep stdout for protocol frames. Account for import-time logging, cached stdout references, raw descriptor writes, and child processes inheriting stdout. Run SDK/0 defines the logging behavior expected by authors.
#Exercise an installed SDK
Use this local check after writing the Python or TypeScript classifier. It runs trusted code through the independent protocol peer on Linux or macOS. You need Python 3.11+, the installed SDK, and Node 24 when testing TypeScript. Python is a test-peer dependency, rather than a TypeScript SDK dependency.
Save the public peer's run0_peer.py beside your implementation.
Then save this as try_flow.py:
For TypeScript, replace [sys.executable, "FLOW.py"] with ["node", "FLOW.ts"].
Run the exercise:
The response's result is:
Change the input message to "I cannot login.", then run again.
The result's queue changes to technical.
Next, use {"message": 12} as input.
The method returns an INVALID_INPUT operational error instead of a successful result.
The peer exercises your own component's exchange and process completion. It supplies neither a production host nor descendant containment. It also leaves dependency calls unconfigured. Use the caller/dependency exercise to service a declared slot.
#Qualify the implementation
Use conformance material and the local exercise to check both directions of the exchange. Exercise malformed input, ID reuse, errors, cancellation, abandoned work, process exits, and trailing frames. Qualify channels when your implementation claims that extension.
Your runtime owns the method's internal program or graph. The host owns launching it with supported dependencies and authorized powers. SDK support and host support remain separate qualifications.