Environment variables (encrypted). The platform also auto-injects BUTTERBASE_* keys at runtime — see Platform context. Platform keys are injected after your envVars so you can’t shadow them.
timeoutMs
30000
Max execution time (max: 300000)
memoryLimitMb
128
Memory limit (range: 64-1024)
triggers
[{type: "http"}]
Array of trigger configs. At most one per type.
trigger
—
Legacy single-trigger shorthand; normalized server-side to a 1-element triggers array.
agent_tool
false
Expose this function to agents as a tool.
agent_tool_description
—
Short description shown to the LLM (max 500 chars).
agent_tool_mode
read_only
read_only or read_write. read_write requires HITL approval.
agent_tool_exposed_to
developer_only
developer_only or end_user.
allow_service_key_impersonation
true
When true, this function accepts X-Butterbase-As-User from app-scoped service keys and the runtime populates ctx.user.id accordingly. Set to false on admin-only or billing-webhook handlers — the platform 403s any X-Butterbase-As-User header on them at the edge. See Server-to-server function calls.
Each trigger object has a type and a type-specific config. At most one trigger of each type may be attached to a function (enforced by a unique index).
Type
Config
Notes
http
{ method?, path?, auth? }
auth defaults to required — anonymous callers get 401 at the edge. Set none only for intentionally public endpoints.
cron
{ schedule, timezone? }
schedule is a cron expression (e.g. */5 * * * *). timezone defaults to UTC.
s3_upload
{ bucket, prefix?, contentTypes? }
Fires when an object lands in the bucket matching prefix and (optionally) the listed MIME types.
webhook
{ secret_required?, allowed_sources? }
Generates a signed webhook URL. allowed_sources is a comma-separated list of provider tags.
websocket
{}
Invoked on each incoming WebSocket frame from the realtime channel.
When agent_tool: true, this function becomes callable from any agent in the same app whose graph spec lists its name under tools.functions[]. See the Agents API for how agents reference function tools.
{
"name": "lookup_account",
"code": "...",
"agent_tool": true,
"agent_tool_description": "Look up a customer by email. Returns id, plan, status.",
"agent_tool_mode": "read_only",
"agent_tool_exposed_to": "developer_only"
}
The 4 agent_tool* fields are returned on GET /functions and GET /functions/{name} so clients can render UI state.
Toggle per-function settings without redeploying code. Currently the only
supported field is allow_service_key_impersonation (the Phase 2
impersonation gate). On success, the runtime cache is invalidated so the new
value takes effect on the next invocation.