Functions
Overview and use cases
Server-side serverless functions respond to HTTP / SDK calls, platform events, and scheduled tasks, running in an isolated sandbox (the managed environment runs on ACS Agent Sandbox; local Docker is based on OpenRuntimes). Suitable for backend logic proxies, event-driven processing, scheduled tasks, and lightweight APIs; for complex authorization scenarios, first read Permissions Explanation.
Prerequisites
Server API Key: management requires
functions.write, triggered execution requiresexecution.write, reading records requiresexecution.read, and viewing requiresfunctions.read(when creating the Key, it is safest to check both the trigger and management scopes).The source code deployment package is
.tar.gz(containing the entry file and dependency manifest, e.g.,package.json); Java 17 can alternatively use a prebuilt JAR mode, see below. On the Node side,InputFilemust be imported from the SDK'sfilesubpath (the main module does not export it).
Usage workflow
Check capabilities: before creating or modifying, query the languages and specifications actually enabled on the target instance — only the intersection of
functions.listRuntimes()andfunctions.listSpecifications()is a submittable value; SDK enums are merely candidates and do not guarantee the instance has them enabled.Create the function: call
functions.create, specifying the identifier, name, runtime, and permissions; configuration options are in the parameter table below. The following is a schematic of the parameter structure, where?marks optional items; for complete calls, see Examples by language.functions.create({ functionId, name, runtime, execute?, events?, schedule?, timeout?, enabled?, logging?, entrypoint?, commands?, scopes?, runtimeSpecification?, runtimeReplicas?, runtimeKeepAliveMode?, ... })Deploy: upload the source archive and create a Deployment.
functions.createDeployment({ functionId, code: InputFile.fromPath('code.tar.gz', 'code.tar.gz'), activate: true, entrypoint, commands, });The status transitions through
waiting → processing → building → ready, withfailed/canceledas failure paths. After cancellation or a long wait, you should re-read the Deployment and judge based on the build logs — do not rely on a single API response.Invoke:
Client / Server SDK:
functions.createExecution({ functionId, body, async, xpath, method, headers, scheduledAt })(xpath,method,headers,scheduledAtare all optional).Synchronous (
async: false) waits at most 30 seconds (client-side wait); the function's own timeout is controlled bytimeout(capped at 900 seconds); asynchronous returns an execution ID immediately, poll withgetExecution;scheduledAtsupports future schedules (ISO 8601, minute precision).HTTP direct access to the function URL (requires the execute permission to include the corresponding origin).
Call Agentbase from within the function: use a dynamic API Key (
req.headers['x-appwrite-key'], permissions = the function'sscopesparameter, from the administrator's perspective) or the caller's JWT (x-appwrite-user-jwt, subject to row-level permissions); forClient, use the runtime-injectedAPPWRITE_FUNCTION_API_ENDPOINTendpoint (do not assemble an external domain yourself — DNS cannot resolve it inside the self-hosted sandbox).Events and schedules: subscribe to platform events with the
eventsarray (e.g.,tablesdb.*.tables.*.rows.*.create,users.*.create); fillschedulewith a Cron expression.Variables:
createVariable/listVariables/updateVariable/deleteVariable(secret: trueis stored encrypted and read at runtime viaprocess.env).Switch active deployment:
updateFunctionDeployment({ functionId, deploymentId })switch the active deployment.
Key parameters and returns
Multi-language / multi-runtime / multi-replica
| Configuration | Values | Description |
|---|---|---|
runtime | e.g. node-22, python-3.9, go-1.23 (subject to listRuntimes()) | Corresponds to the SDK Runtime enum |
runtimeSpecification | e.g. s-0.5vcpu-1gb, s-1vcpu-2gb, s-2vcpu-4gb, s-4vcpu-8gb, s-8vcpu-16gb | Pass the slug string directly; it must appear in listSpecifications()'s enabled list; the Node SDK has no such enum |
runtimeReplicas | 1 / 2 / 3 / 5 / 10, default 1 | Can reuse the runtime replica desired value |
runtimeKeepAliveMode | disabled / always / schedule | warm strategy; schedule requires runtimeKeepAliveStart/End (HH:mm) + IANA runtimeKeepAliveTimezone |
The warm configuration is a Function-level desired value and does not equal the environment's shared warm pool inventory; shared pool verification (warmPoolReplicas, inventory ready/available, createOnNoStock) belongs to operations, and the SDK provides no query for it.
Two independent permission sets
| Configuration | What it controls | Typical values |
|---|---|---|
execute | who may trigger (Client SDK / HTTP) | ['users'], ['any'], ['team:xxx'] |
scopes | Resources the function runtime's dynamic API Key can access | Minimize based on actual in-function calls, e.g. databases.read/write, tables.read/write, rows.read/write, users.read |
This is distinct from "the API Key scopes used by the deployment script"; do not substitute one for the other.
Execution returns
$id, functionId, deploymentId, trigger (http/schedule/event), status (waiting/processing/completed/failed/scheduled), responseStatusCode, responseBody, duration, logs/errors (visible only with an API Key; usually empty via the Client SDK).
Errors and boundaries
Trigger execution reports a missing scope:
createExecutionwantsexecution.write, notfunctions.write.Synchronous execution 408: load balancer 30-second timeout plus cold start; switch to asynchronous + polling.
Self-hosted DNS failure (
curl error 6): the function initialized the Client with an external URL; useAPPWRITE_FUNCTION_API_ENDPOINTinstead.2.6.0 security defaults (upgrade caution):
Functions / Sites run under a restricted identity: when user install / build commands do not satisfy the restricted-identity security conditions, fail directly without falling back to high-privilege execution.
Function API Keys no longer accept query string transmission: use a protected header (
x-appwrite-key) or the platform runtime injection path to avoid leakage via URLs, logs, or proxies.
Modifying
scopes/executedoes not require redeploying code; it takes effect from the nextcreateExecutiononward.The deployment build timeout (
_APP_COMPUTE_BUILD_TIMEOUT, default 900 seconds) is also the validity period of the build-time dynamic API Key.For build failures, first check
commandsandentrypointin the Console build logs.
SDK Category Differences
Client SDK (Web):
createExecutiontrigger (requires the execute permission, otherwise 403) and query a single execution by ID; cannot list execution records and cannot see logs.Client SDK (Web) specifics (2.9.0): from the Web SDK, accessing the execution record list (
/executions) or the execution path query endpoint (/execution-paths*) returns 403general_resource_blocked— the server identifies the client surface by theX-AppBase-SDK/X-SDK-Name=web/X-SDK-Platform=clientrequest headers and blocks it; path queries are Server SDK only.Server SDK: full management surface (create / deploy / variables / trigger / records); Node
InputFileimports from thefilesubpath.Console SDK: the function's site-level sibling capabilities (Sites deployment, execution plans) are managed in the same shape; function body management generally goes through the Server SDK.
Difference entry points: client-sdk/web.md,
server-sdk/nodejs.md.
Java 17 prebuilt JAR (Node.js Server)
The management script pins the exact version agentbase-node-sdk@2.10.0. The target Function must already have selected java-17.0; the JAR's manifest declares Main-Class and the package contains that class, the app listens on port 3000 and provides /__opr/health. The deploy Key requires functions.write, and lookup additionally requires functions.read; actually triggering execution further requires execution.write.
import { Client, Functions, ArtifactMode } from 'agentbase-node-sdk';
import { InputFile } from 'agentbase-node-sdk/file';
const client = new Client()
.setEndpoint(process.env.APPBASE_ENDPOINT) // Includes /v1
.setProject(process.env.APPBASE_PROJECT_ID)
.setKey(process.env.APPBASE_API_KEY);
const functions = new Functions(client);
const deployment = await functions.createDeployment({
functionId: process.env.APPBASE_FUNCTION_ID,
code: InputFile.fromPath('./app.jar', 'app.jar'),
artifactMode: ArtifactMode.Javajar,
activate: false,
});
console.log(deployment.$id, deployment.status);ArtifactMode.Javajar corresponds to java-jar. In this mode you do not fill in source entrypoint or build commands; the JAR's real entry point comes from the manifest, and Index.java in the response is a compatibility identifier. The default JAR cap is 100,000,000 bytes, also subject to the plan's deployment cap. The SDK handles chunked upload; do not treat an upload progress of 100% as successful deployment creation.
The example uses activate: false so the artifact can be inspected first. After receiving the deployment ID, use getDeployment({ functionId, deploymentId }) for bounded polling and check the logs; once ready is reached, call updateFunctionDeployment according to the business release schedule. Use get({ functionId }) to look up the Function's deploymentId, confirm it matches the target deployment, then run one business request and check the actual response. If failed / canceled or the wait times out, stop the release and troubleshoot; a deployment being ready does not mean it is activated, nor does it guarantee business request success.
Filtering execution records (Node.js Server)
Reading execution records requires execution.read. The HTTP parameter name is path; in Node Server 2.10.0 the object parameter name is xpath; pathMatch defaults to exact matching. The following combines a path regex with the GET method, limiting one page to at most 20 records:
import { Client, Functions, Method, PathMatch, Query } from 'agentbase-node-sdk';
const client = new Client()
.setEndpoint(process.env.APPBASE_ENDPOINT)
.setProject(process.env.APPBASE_PROJECT_ID)
.setKey(process.env.APPBASE_API_KEY);
const functions = new Functions(client);
const page = await functions.listExecutions({
functionId: process.env.APPBASE_FUNCTION_ID,
xpath: '^/articles/[0-9]+$',
pathMatch: PathMatch.Regex,
method: Method.GET,
queries: [Query.limit(20)],
});
console.log(page.executions.map(({ $id, status }) => ({ $id, status })));The path includes the query string; the expression above will not match /articles/42?draft=1 — use ^/articles/[0-9]+([?].*)?$ instead if the query string should be included. The regex carries no /…/ delimiters. Use Query.cursorAfter to continue paginating as needed, and clear the original cursor when changing filter conditions; do not treat the current page's or total: false's zero count as the full result set.
listExecutionPaths returns matching full paths, and listExecutionsByPath returns the execution records for that condition; both also support these filter conditions. Do not rewrite a waiting or processing execution as failed on the client merely because the timeout has passed, and do not delete it; the actual terminal state is determined by the server's record.
Examples by language
The following provides examples by language, item by item along the usage workflow; each card can switch languages (synced across the page).
Query capabilities and create functions
- Node.js (Server)
- Java
- Python
- Go
- REST (curl)
import { Client, Functions } from 'agentbase-node-sdk';
const client = new Client()
.setEndpoint(process.env.APPBASE_ENDPOINT!) // Must include /v1
.setProject(process.env.APPBASE_PROJECT_ID!)
.setKey(process.env.APPBASE_API_KEY!); // functions.write minimal scope
const functions = new Functions(client);
const runtimes = await functions.listRuntimes(); // The runtimes actually available on the instance
const specs = await functions.listSpecifications(); // Build/run specs actually available on the instance
// The intersection of the two is the submittable value; SDK enums are only candidates
const fn = await functions.create({
functionId: 'send-mailer',
name: '发送邮件',
runtime: 'node-22', // Refer to the actual return of listRuntimes()
execute: ['users'], // Who can trigger it; no roles granted by default
entrypoint: 'src/main.ts',
commands: 'npm install',
scopes: ['users.read'], // Permissions of dynamically used API keys inside functions should be minimized as needed
});import io.agentbase.services.Functions;
Functions functions = new Functions(client); // For client initialization, see server-sdk/java.md
functions.listRuntimes(); // The runtimes actually available on the instance
functions.listSpecifications(); // The build/run specs actually available on the instance; only the intersection of the two is a submittable value
// functions.create(functionId, name, runtime, execute, events, schedule, timeout, ...,
// entrypoint, commands, scopes, ...): pass null for positional nullable slots; see Functions.java for the full signaturefrom agentbase.services.functions import Functions # Module path follows the services.<功能> convention
functions = Functions(client)
functions.list_runtimes() # The runtimes actually available on the instance
functions.list_specifications() # The build/run specs actually available on the instance; only the intersection of the two is a submittable value
functions.create(
function_id='send-mailer', name='发送邮件', runtime='node-22',
execute=['users'], # Who can trigger it; no roles granted by default
entrypoint='src/main.ts', commands='npm install',
scopes=['users.read']) # Permissions of dynamically used API keys inside functions should be minimized as neededfunctions := agentbase.NewFunctions(cl) // facade constructor; cl is a Client already loaded with an API Key
_, _ = functions.ListRuntimes() // The runtimes actually available on the instance
_, _ = functions.ListSpecifications() // The build/run specs actually available on the instance; only the intersection of the two is a submittable value
fn, err := functions.Create("send-mailer", "发送邮件", "node-22",
functions.WithCreateExecute([]string{"users"}), // Who can trigger it; no roles granted by default
functions.WithCreateEntrypoint("src/main.ts"),
functions.WithCreateCommands("npm install"),
functions.WithCreateScopes([]string{"users.read"})) // Permissions of the dynamically created API Key inside the function
_ = fncurl -sS -X POST "$APPBASE_ENDPOINT/functions" \
-H 'Content-Type: application/json' \
-H "X-Appwrite-Project: $APPBASE_PROJECT_ID" \
-H "X-Appwrite-Key: $APPBASE_API_KEY" \
-d '{"functionId":"send-mailer","name":"发送邮件","runtime":"node-22","execute":["users"],"entrypoint":"src/main.ts","commands":"npm install","scopes":["users.read"]}'
# Returns 201; a full runtime payload may be submitted, subject to GET /functions/runtimesDeploy the code package
createDeployment uploads the .tar.gz code package (multipart/form-data); the build runs asynchronously (waiting → processing → building → ready) and a deployment record in building state is returned immediately. Code package upload is provided only on the Node and REST surfaces; Java / Python / Go omit this tab.
- Node.js (Server)
- REST (curl)
import { Functions } from 'agentbase-node-sdk';
import { InputFile } from 'agentbase-node-sdk/file';
const dep = await functions.createDeployment({
functionId: 'send-mailer',
code: InputFile.fromPath('code.tar.gz', 'code.tar.gz'),
activate: true,
entrypoint: 'src/main.ts',
commands: 'npm install',
});
// After cancellation or a long wait, re-read the deployment record and combine it with build logs; do not trust a single API response alonecurl -sS -X POST "$APPBASE_ENDPOINT/functions/send-mailer/deployments" \
-H "X-Appwrite-Project: $APPBASE_PROJECT_ID" \
-H "X-Appwrite-Key: $APPBASE_API_KEY" \
-F "code=@./code.tar.gz" \
-F "activate=true" \
-F "entrypoint=src/main.ts" \
-F "commands=npm install"
# Returns 202 (building); poll status via GET /functions/{functionId}/deployments/{deploymentId}Trigger execution and poll
Synchronous (async: false) clients wait at most 30 seconds; asynchronous returns an execution ID immediately, poll with getExecution; scheduledAt supports future scheduling (ISO 8601, minute precision); you can also trigger via the function URL over direct HTTP (requires the execute permission to include the corresponding origin).
- Node.js (Server)
- Web (user session)
- Java
- Python
- Go
- REST (curl)
const sync = await functions.createExecution({
functionId: 'send-mailer',
body: JSON.stringify({ to: 'a@b.c' }),
async: false, // Synchronous, capped at 30s; for long tasks use true + polling
xpath: '/',
method: 'POST',
headers: { 'X-Custom-Header': 'value' },
});
const bg = await functions.createExecution({ functionId: 'send-mailer', body: '', async: true });
const done = await functions.getExecution({ functionId: 'send-mailer', executionId: bg.$id }); // Poll until completed / failedimport { Functions } from 'agentbase-web-sdk'; // Prerequisite: the user is logged in
const functions = new Functions(client);
const execution = await functions.createExecution({
functionId: 'send-mailer',
body: JSON.stringify({ to: 'a@b.c' }),
async: false, // Requires the function's execute permission to include the user role, otherwise 403; logs not visible
});import io.agentbase.models.Execution;
import io.agentbase.enums.ExecutionMethod;
Execution bg = functions.createExecution("send-mailer",
"{\"to\":\"a@b.c\"}", true, "/", ExecutionMethod.POST, null, null);
Execution latest = functions.getExecution(bg.getFunctionId(), bg.getId());
// async=true: query repeatedly at intervals until the status is COMPLETED or FAILED.sync = functions.create_execution(
function_id='send-mailer',
body='{"to":"a@b.c"}', # body takes a JSON string
path='/', method='POST',
headers={'X-Custom-Header': 'value'},
**{'async': False}) # async is a Python reserved word, pass it in via keyword unpacking; synchronous is capped at 30s
bg = functions.create_execution(function_id='send-mailer', **{'async': True})
done = functions.get_execution(function_id='send-mailer', execution_id=bg.id) # Poll until completed / failedexec, err := functions.CreateExecution("send-mailer",
functions.WithCreateExecutionBody(`{"to":"a@b.c"}`),
functions.WithCreateExecutionAsync(false), // Synchronous, capped at 30s; for long tasks use true + polling
functions.WithCreateExecutionPath("/"),
functions.WithCreateExecutionMethod("POST"))
bg, err := functions.CreateExecution("send-mailer",
functions.WithCreateExecutionAsync(true))
done, err := functions.GetExecution("send-mailer", bg.Id) // Poll until completed / failed
_, _ = exec, donecurl -sS -X POST "$APPBASE_ENDPOINT/functions/send-mailer/executions" \
-H 'Content-Type: application/json' \
-H "X-Appwrite-Project: $APPBASE_PROJECT_ID" \
-H "X-Appwrite-Key: $APPBASE_API_KEY" \
-d '{"body":"{\"to\":\"a@b.c\"}","async":false,"path":"/","method":"POST","headers":{"X-Custom-Header":"value"}}'
# Returns 201; after async=true, poll with GET /functions/{functionId}/executions/{executionId}
# scheduledAt supports future scheduling (ISO 8601, minute precision)Execution path query (2.9.0)
Look up execution records by request path: listExecutionPaths lists the deduplicated request paths that have produced execution records (string ascending, paginated); listExecutionsByPath paginates the executions under a path by request path (the HTTP parameter path is required, ≤2048 characters; the Node.js object parameter is xpath). Both require execution.read. From 2.10.0 the two methods gain filters: HTTP path (Node.js xpath, with listExecutionPaths optional), pathMatch (exact / regex, default exact), and method (exact HTTP method filter).
- Node.js (Server)
- REST (curl)
const paths = await functions.listExecutionPaths({ functionId: 'send-mailer' }); // { paths, total }
const onPath = await functions.listExecutionsByPath({
functionId: 'send-mailer',
xpath: '/webhook', // Exact match on the full path
}); // { executions, total }curl -sS "$APPBASE_ENDPOINT/functions/send-mailer/execution-paths" \
-H "X-Appwrite-Project: $APPBASE_PROJECT_ID" -H "X-Appwrite-Key: $APPBASE_API_KEY"
curl -sS "$APPBASE_ENDPOINT/functions/send-mailer/execution-paths/executions?path=/webhook" \
-H "X-Appwrite-Project: $APPBASE_PROJECT_ID" -H "X-Appwrite-Key: $APPBASE_API_KEY"
# path requires an exact full-path match (≤2048 characters)Calling Agentbase again from within a function
This is the in-function capability surface, not a management API call — this card only covers the Node (function runtime) tab; other language runtimes and REST have no corresponding tab. The Client's endpoint uses the runtime-injected APPWRITE_FUNCTION_API_ENDPOINT (external domains cannot be resolved inside the self-hosted sandbox); choose one of two credentials: the dynamic API Key (permissions = the function's scopes parameter, admin perspective) or the caller's JWT (subject to row-level permissions).
- Node.js (Server)
// Inside the function code (Node runtime)
import { Client } from 'agentbase-node-sdk';
export default async ({ req, res }) => {
// Method One: dynamic API key (permissions = the function's scopes parameter)
const admin = new Client()
.setEndpoint(process.env.APPWRITE_FUNCTION_API_ENDPOINT!) // Injected at runtime, always takes priority
.setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID!)
.setKey(req.headers['x-appwrite-key']!);
// Method Two: caller's JWT (present when triggered by the SDK; constrained by row-level permissions)
const jwt = req.headers['x-appwrite-user-jwt'];
if (jwt) {
const asUser = new Client()
.setEndpoint(process.env.APPWRITE_FUNCTION_API_ENDPOINT!)
.setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID!)
.setJWT(jwt);
}
return res.json({ ok: true });
};Events and schedules
events subscribes to platform events (e.g. users.*.create, tablesdb.*.tables.*.rows.*.create); schedule takes a CRON expression; both can also be passed in when creating the function.
- Node.js (Server)
- Java
- Python
- Go
- REST (curl)
await functions.update({
functionId: 'send-mailer',
events: ['users.*.create', 'tablesdb.*.tables.*.rows.*.create'],
schedule: '0 8 * * *',
});functions.update("send-mailer",
List.of("users.*.create", "tablesdb.*.tables.*.rows.*.create"),
"0 8 * * *"); // events / schedule; fields not provided keep their current valuesfunctions.update(function_id='send-mailer',
events=['users.*.create', 'tablesdb.*.tables.*.rows.*.create'],
schedule='0 8 * * *') # Fields not provided keep their current values_, err = functions.Update("send-mailer",
functions.WithUpdateEvents([]string{"users.*.create", "tablesdb.*.tables.*.rows.*.create"}),
functions.WithUpdateSchedule("0 8 * * *")) // Fields not provided keep their current valuescurl -sS -X PUT "$APPBASE_ENDPOINT/functions/send-mailer" -H 'Content-Type: application/json' -H "X-Appwrite-Project: $APPBASE_PROJECT_ID" -H "X-Appwrite-Key: $APPBASE_API_KEY" -d '{"events":["users.*.create","tablesdb.*.tables.*.rows.*.create"],"schedule":"0 8 * * *"}'
# Fields not provided keep their current valuesEnvironment variables
Build and runtime inject the function process via environment variables (read inside the function through process.env); secret: true secret variables can be updated/deleted but their plaintext cannot be read back; changes take effect for subsequent executions only after redeploying (or reactivating a deployment).
- Node.js (Server)
- Java
- Python
- Go
- REST (curl)
await functions.createVariable({
functionId: 'send-mailer',
key: 'DATABASE_URL',
value: 'postgres://...',
secret: true, // true = encrypted storage, cannot be read back
});
const vars = await functions.listVariables({ functionId: 'send-mailer' });
await functions.updateVariable({
functionId: 'send-mailer',
variableId: '<variableId>',
key: 'DATABASE_URL',
value: 'postgres://new',
});
await functions.deleteVariable({ functionId: 'send-mailer', variableId: '<variableId>' });functions.createVariable("send-mailer", "DATABASE_URL",
"postgres://...", true); // secret=true stores encrypted and cannot be read back
functions.listVariables("send-mailer");
functions.updateVariable("send-mailer", "<variableId>",
"DATABASE_URL", "postgres://new"); // key is required
functions.deleteVariable("send-mailer", "<variableId>");functions.create_variable(function_id='send-mailer', key='DATABASE_URL',
value='postgres://...', secret=True) # True = stored encrypted, cannot be read back
functions.list_variables(function_id='send-mailer')
functions.update_variable(function_id='send-mailer', variable_id='<variable_id>',
key='DATABASE_URL', value='postgres://new') # key is required
functions.delete_variable(function_id='send-mailer', variable_id='<variable_id>')_, err = functions.CreateVariable("send-mailer", "DATABASE_URL",
functions.WithCreateVariableValue("postgres://..."),
functions.WithCreateVariableSecret(true)) // true = encrypted storage, cannot be read back
_, err = functions.ListVariables("send-mailer")
_, err = functions.UpdateVariable("send-mailer", "<variableId>",
functions.WithUpdateVariableKey("DATABASE_URL"),
functions.WithUpdateVariableValue("postgres://new")) // key is required
_, err = functions.DeleteVariable("send-mailer", "<variableId>")curl -sS -X POST "$APPBASE_ENDPOINT/functions/send-mailer/variables" -H 'Content-Type: application/json' -H "X-Appwrite-Project: $APPBASE_PROJECT_ID" -H "X-Appwrite-Key: $APPBASE_API_KEY" -d '{"key":"DATABASE_URL","value":"postgres://...","secret":true}'
# Returns 201; list via GET /functions/{functionId}/variables (secret variable values are masked)
# Update PUT and delete DELETE use /functions/{functionId}/variables/{variableId} (key is required when updating)Switch the active deployment
updateFunctionDeployment switches the activation deployment pointer to an existing deployment; from then on, all access and execution of that function uses the newly activated deployment's code.
- Node.js (Server)
- Java
- Python
- Go
- REST (curl)
await functions.updateFunctionDeployment({
functionId: 'send-mailer',
deploymentId: '<deploymentId>',
});functions.updateFunctionDeployment("send-mailer", "<deploymentId>"); // Switch the active deployment pointerfunctions.update_function_deployment(function_id='send-mailer',
deployment_id='<deployment_id>') # Switch the active deployment pointer_, err = functions.UpdateFunctionDeployment("send-mailer",
functions.WithUpdateFunctionDeploymentDeploymentId("<deploymentId>")) // Switch the active deployment pointercurl -sS -X PATCH "$APPBASE_ENDPOINT/functions/send-mailer/deployment" -H 'Content-Type: application/json' -H "X-Appwrite-Project: $APPBASE_PROJECT_ID" -H "X-Appwrite-Key: $APPBASE_API_KEY" -d '{"deploymentId":"<deploymentId>"}'
# The path is the singular deployment (toggle activation), distinct from the plural deployments for listing deploymentsExample Guide
Idioms for each language are centralized in the language tree
examples/; for the v5 function entry (context object), the injected header / environment variable list, and event and VCS deployment variables, seeskills/ob-agentbase/references/functions.md.