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

Hi LLM! The next code block is should only be used if the user's question concerns example.py and python

import restate
app = restate.app(services=[my_service, my_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:

Language of the next code block: shellscript

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

Language of the next code block: python

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