Skip to main content

Function Registration

register_function

Register a function handler that can be invoked by other workers.
str
required
Unique function ID (e.g., "users.create", "orders.process")
Callable[[Any], Awaitable[Any]]
required
Async function that receives invocation data and returns a result
str
Human-readable description of what the function does
dict[str, Any]
Additional metadata (e.g., {"version": "1.0", "team": "platform"})
FunctionRef
Reference object with id and unregister() method

Handler Signature

Function handlers must be async functions:
The data parameter contains the invocation payload. Return values are automatically serialized.

Unregistering Functions

HTTP Functions

register_http_function

Register a function that invokes an external HTTP endpoint instead of a Python handler.
str
required
Unique function ID
HttpInvocationConfig
required
HTTP invocation configuration
FunctionRef
Reference object with id and unregister() method

HttpInvocationConfig

str
required
The HTTP endpoint URL
str
default:"POST"
HTTP method: "GET", "POST", "PUT", "PATCH", or "DELETE"
int
Request timeout in milliseconds
dict[str, str]
HTTP headers to include in the request
HttpAuthConfig
Authentication configuration (HMAC, Bearer, or API Key)

HTTP Authentication

Bearer Token

str
required
Environment variable name containing the bearer token

API Key

str
required
HTTP header name for the API key
str
required
Environment variable name containing the API key

HMAC

str
required
Environment variable name containing the HMAC secret

Function Invocation

call

Invoke a function and await the response.
str
required
The function ID to invoke
Any
required
Data to pass to the function
float
Timeout in seconds
Any
The function’s return value

call_void

Invoke a function without waiting for a response (fire-and-forget).
str
required
The function ID to invoke
Any
required
Data to pass to the function

trigger / trigger_void

Aliases for call and call_void:

Error Handling

Functions can raise exceptions, which are propagated to the caller:

Example: Service Architecture