Namespace Restate.Sdk
Classes
- Context
Base context available to all handler types. Provides durable execution primitives: side effects, calls, timers, and awakeables. Subclass this to create test doubles (see Restate.Sdk.Testing).
- DurableConsole
A replay-aware console that suppresses output during journal replay. Checks the live replay state on each call so output resumes after replay completes.
- DurableRandom
Deterministic random number generator seeded per invocation. Produces the same sequence on every replay, making it safe for durable execution.
- HandlerAttribute
Marks a method as a Restate handler. On virtual objects this is an exclusive handler (one-at-a-time per key). On services this is a regular concurrent handler.
- HandlerAttributeBase
Base class for handler attributes, providing shared configuration properties.
- JsonSerde
Static utility providing the default JsonSerializerOptions for Restate serialization. Source-generated code calls Configure(JsonSerializerOptions) at module init to wire in a
JsonSerializerContextfor AOT-compatible serialization.
- ObjectContext
Context for exclusive handlers on virtual objects. Provides read-write state access. Only one exclusive handler runs at a time per key.
- RestateLambdaHandler
Base class for Restate Lambda handlers. Subclass and override Register() to bind your services, then reference this as your Lambda function handler.
- RestateTelemetryOptions
Options controlling the SDK's OpenTelemetry-compatible instrumentation. The SDK exposes an ActivitySource and a Meter, both named
Restate.Sdk.
- RetryPolicy
Configures retry behavior for Run<T>(string, Func<Task<T>>, RetryPolicy) side effects. When a side effect throws a non-terminal exception, the SDK retries it locally with exponential backoff according to this policy before propagating the failure.
When the retries run out — MaxAttempts or MaxDuration is reached — the failure is recorded in the journal as a terminal run failure with code 500 and the message
Run '<name>' failed after N attempt(s), the handler sees a TerminalException, and the run is not retried again on replay.
- ServiceAttribute
Marks a class as a Restate service — a stateless handler group with durable execution.
- SharedHandlerAttribute
Marks a method as a shared handler on a virtual object or workflow. Shared handlers can run concurrently and have read-only access to state.
- SharedObjectContext
Context for shared handlers on virtual objects. Provides read-only state access and can run concurrently with other shared handlers for the same key.
- SharedWorkflowContext
Context for shared handlers on workflows. Provides read-only state access and the ability to signal the workflow via durable promises.
- TerminalException
An error that will not be retried by the Restate runtime. Use this for business logic failures or validation errors where retrying would not help.
- VirtualObjectAttribute
Marks a class as a Restate virtual object — a keyed stateful entity. Each key has isolated K/V state and exclusive handler execution.
- WorkflowAttribute
Marks a class as a Restate workflow — a virtual object with a run handler that executes exactly once per workflow ID, plus shared handlers for queries and signals.
- WorkflowContext
Context for the workflow run handler. Provides read-write state access and durable promises for coordinating with shared handlers.
Structs
- Awakeable<T>
A durable promise that can be completed from outside the current invocation.
The awakeable is itself an IDurableFuture<T>, so it composes with All<T>(params ReadOnlySpan<IDurableFuture<T>>), Race<T>(params ReadOnlySpan<IDurableFuture<T>>), Any<T>(params ReadOnlySpan<IDurableFuture<T>>), AllSettled<T>(params ReadOnlySpan<IDurableFuture<T>>) and WaitAll(params IDurableFuture[]) without unwrapping Future.
- CallOptions
Options for Call<TResponse>(string, string, object?, CallOptions) operations. Provides idempotency key support for call deduplication, and the flow-control scope and limit key the server uses to bound concurrency.
- InvocationHandle
A handle to a running invocation, returned by send operations. Carries the invocation id, and addresses signals on that invocation.
- ReplayAwareInterpolatedStringHandler
Interpolated string handler that skips formatting entirely during replay. Avoids boxing and string allocation when the console output would be suppressed.
- SendOptions
Options for fire-and-forget send operations.
- SettledResult<T>
The settlement outcome of a single durable future awaited by AllSettled<T>(params ReadOnlySpan<IDurableFuture<T>>). Conveys either a successful value or the failure that faulted the future, without throwing.
- SignalHandle<T>
A handle to an unnamed signal a handler awaits: the Index that addresses it on this invocation, and the durable future that settles when the signal is resolved or rejected. Pass Index together with the invocation id — the one an InvocationHandle carries — to ResolveSignal<T>(string, int, T) or RejectSignal(string, int, string).
The handle is itself an IDurableFuture<T>, so it composes with All<T>(params ReadOnlySpan<IDurableFuture<T>>), Race<T>(params ReadOnlySpan<IDurableFuture<T>>), Any<T>(params ReadOnlySpan<IDurableFuture<T>>), AllSettled<T>(params ReadOnlySpan<IDurableFuture<T>>) and WaitAll(params IDurableFuture[]) without unwrapping Future.
- StateKey<T>
A typed key for reading and writing durable state in virtual objects and workflows.
Interfaces
- IContext
Interface exposing durable execution primitives available to all handler types. Use this for utility methods, type constraints, and testing with mocking frameworks. Handlers receive the abstract Context class; use Mock*Context classes for handler testing.
- IDurableFuture
A durable future representing the result of a non-blocking Restate operation. Used with combinators like All<T>(params ReadOnlySpan<IDurableFuture<T>>) and Race<T>(params ReadOnlySpan<IDurableFuture<T>>).
- IDurableFuture<T>
A typed durable future representing the result of a non-blocking Restate operation. Returned by non-blocking variants like RunAsync<T>(string, Func<Task<T>>), Timer(TimeSpan), and future-returning typed client methods.
- IObjectContext
Interface for exclusive handlers on virtual objects. Provides read-write state access. Only one exclusive handler runs at a time per key.
- IRunContext
Restricted context available inside Run<T>(string, Func<IRunContext, Task<T>>) blocks. Deliberately excludes Restate operations (no Run, Sleep, calls, state, etc.) to prevent nested side effects which would violate the durable execution model.
- ISerde<T>
Strongly-typed serialization/deserialization interface for Restate handler payloads and state. Named "Serde" for consistency with other Restate SDKs (TypeScript, Java, Python, Rust).
- ISharedObjectContext
Interface for shared handlers on virtual objects. Provides read-only state access and can run concurrently with other shared handlers for the same key.
- ISharedWorkflowContext
Interface for shared handlers on workflows. Provides read-only state access and the ability to signal the workflow via durable promises.
- IWorkflowContext
Interface for the workflow run handler. Provides read-write state access and durable promises for coordinating with shared handlers.