Handlers are the core building blocks of Restate services. Each service has a list of handlers: durable functions that can be invoked over HTTP, Kafka, or using typed clients.Documentation Index
Fetch the complete documentation index at: https://docs.restate.dev/llms.txt
Use this file to discover all available pages before exploring further.
Writing handlers
Handlers receive a Restate context object (ctx) and a single, optional input:
The input and output can be any JSON-serializable type. For other types, consult the serialization documentation of your SDK.
Context types
The context type you use depends on your service type:Context- Basic Services (stateless handlers)ObjectContext- Virtual Objects (exclusive handlers with state access)ObjectSharedContext- Virtual Objects (concurrent read-only handlers)WorkflowContext- Workflows (main run handler)WorkflowSharedContext- Workflows (signal/query handlers)
Handler behavior
Virtual Objects and Workflows support two handler types: Exclusive handlers (ObjectContext, WorkflowContext) can read and write state but only one runs at a time per key to prevent conflicts.
Shared handlers (ObjectSharedContext, WorkflowSharedContext) can only read state but run concurrently without blocking—useful for querying status during long-running operations.