ctx
) that provide Restate’s core capabilities.
These actions enable durable execution, state management, service communication, and timing control.
Durable steps
Userun
to safely wrap any non-deterministic operation, like HTTP calls or database responses, and have Restate persist its result.
run()
, these operations would produce different results during replay, breaking deterministic recovery.
State management
Available in Virtual Object and Workflow handlers for persistent key-value storage.Get
Retrieve stored state by key.Set
Store state that persists across function invocations.Clear
State is retained indefinitely for Virtual Objects, or for the configured retention period for Workflows. To clear state:Service communication
Request-response calls
Make request-response calls to other services. Your function waits for the result.Sending messages
Make one-way calls that don’t return results. Your function continues immediately.Delayed messages
Schedule handlers to run in the future.Durable timers and timeouts
Pause function execution for a specific duration.Workflow events
Use durable promises to wait for external events or human input in your workflows. Create promises that external systems can resolve to send data to your workflow.To implement a similar pattern in Basic Services or Virtual Objects, have a look at awakeables (TS/Java/Kotlin/Go/Python).