Skip to main content

Serving

Restate services can run in a few ways: as an HTTP handler, or as an AWS Lambda handler. For both, you do the following:

  1. Create the app
  2. Bind one or multiple services to it.
example.py
import restate
app = restate.app(services=[my_service, my_virtual_object])

The Python SDK follows the ASGI standard for the serving of the services. The templates and examples use Hypercorn to serve the services. You can run them as follows:

python -m hypercorn --config hypercorn-config.toml example:app

Validating request identity

SDKs can validate that incoming requests come from a particular Restate instance. You can find out more about request identity in the Security docs

app = restate.app(
services=[my_service],
identity_keys=["publickeyv1_w7YHemBctH5Ck2nQRQ47iBBqhNHy4FV7t2Usbye2A6f"]
)