Functions
Write Python functions, deploy them, and call them over HTTP with secrets, logs and versions.
Functions run your server-side code — webhooks, payments, calls to AI APIs, anything that needs a secret. Each function gets an HTTPS endpoint, versioned deploys, logs and its own secrets. Functions run Python 3 in an isolated sandbox.


Write a function
Define handler(event, context). event is the JSON body of the request; context tells you who called and which version is running. Return any JSON value.
import os
def handler(event, context):
caller = context["caller"] # {"user_id", "role": "authenticated" | "anon" | "service_role", "app_roles"}
if caller["role"] == "anon":
return {"error": "sign in first"}
name = (event or {}).get("name", "world")
return {"message": f"Hello, {name}!", "version": context["version"]}context key | Value |
|---|---|
caller | Who made the request: user id, role and app roles. |
project_id | The project. |
function_name, version, deploy_id | Which deploy is running. |
invocation_id | Unique id for this call — also shown in logs. |
Deploy
sov fn deploy ./hello --name hello --note "first version"
sov fn versions hello
sov fn rollback hello # back to the previous versionEvery deploy creates a new version. Owners and admins are notified when a deploy succeeds or fails; a failed deploy never replaces the version that is serving traffic.
Call it
const result = await sovaria.functions.call('hello', { name: 'Ada' })By default only signed-in users can call a function. Make it public (for webhooks from Stripe, GitHub, etc.) in the function's settings — then verify the sender inside your code, for example by checking the webhook signature.
Secrets
Store API keys as secrets; they are encrypted, never shown again after saving, and available to your code as environment variables.
sov secrets set hello --name OPENAI_API_KEY --value sk-...
sov secrets list hello # values are masked
sov secrets import hello .envNetwork access
Functions can only reach the hosts you allow in the function's settings (for example api.openai.com). Everything else is blocked, which stops a compromised dependency from sending your data elsewhere.
Logs and limits
- Logs: Functions → your function → Logs, or
sov fn logs hello. Each line carries the invocation id. - Timeout, memory and invocations per month depend on your plan.
- Use
--async(orfunctions.invokeAsync) for long work; poll the job or let it notify your app through realtime.