Skip to main content

RPC for external read + write

Why you need it

External callers need to read durable state, mutate it, and optionally move the Flow — atomically from the caller’s point of view.

Code examples

Choose an SDK (preference is sticky in this browser; default Python).

@rpc
def nudge(self, context, message: str) -> RPCResult:
status.set(context, "nudged")
unblock.publish(context, message)
return RPCResult(output="ok")

Declare @rpc / RPC methods on the Flow; invoke via client InvokeRPC.

How Dex implements it

The server routes InvokeRPC to the Worker, applies Attribute locks if requested, and commits Attribute/channel side effects with the RPC result.

Traditional workarounds

Without Dex: separate read APIs, write APIs, and “signal” endpoints with careful locking — often inconsistent under concurrency.