kosa8 docs Dashboard
esc
↑ ↓ move↵ openRuns in your browser; nothing you type is sent anywhere.

Serverless

Functions

Deploy a handler once and call it by name. Every call runs in a fresh microVM, so one call can never see another's data. Functions are on the Pro plan and up.

API=https://api.kosa8.com/v1
AUTH="Authorization: Bearer $KOSA8_API_KEY"
JSON='Content-Type: application/json'

# Deploy: code plus a runtime. Each call runs in a fresh microVM.
curl -s -X PUT $API/functions/hello-fn -H "$AUTH" -H "$JSON" -d '{
  "runtime": "python3.12",
  "code": "def handler(event):\n    return {\"greeting\": \"hello \" + event[\"name\"]}\n"
}' | jq '{name, version}'

curl -s $API/functions/hello-fn/invoke -H "$AUTH" -H "$JSON" \
  -d '{"event":{"name":"kosa8"}}' | jq '{ok, result}'

curl -s -X DELETE $API/functions/hello-fn -H "$AUTH"
from kosa8 import Kosa8Cloud

cloud = Kosa8Cloud()

cloud.functions.deploy("hello-fn", {
    "runtime": "python3.12",
    "code": "def handler(event):\n    return {'greeting': 'hello ' + event['name']}\n",
})
out = cloud.functions.invoke("hello-fn", {"name": "kosa8"})   # runs in a fresh microVM
print(out["ok"], out["result"])                                # True {'greeting': 'hello kosa8'}
cloud.functions.delete("hello-fn")
import { Kosa8Cloud } from '@kosa8/sdk';

const cloud = new Kosa8Cloud();

await cloud.functions.deploy('hello-fn', {
  runtime: 'node22',
  code: "exports.handler = async (event) => ({ greeting: 'hello ' + event.name });\n",
});
const out = await cloud.functions.invoke('hello-fn', { name: 'kosa8' }); // a fresh microVM per call
console.log(out.ok, out.result);                                         // true { greeting: 'hello kosa8' }
await cloud.functions.delete('hello-fn');

Deploy#

PUT /v1/functions/{name} with:

FieldWhat it does
runtimepython3.12 or node22
codeThe source. Python defines def handler(event); Node exports exports.handler. Up to 6 MiB.
envEnvironment for every call: up to 64 names (none starting K8_), 16 KiB in all
timeout_sHow long one call may run: default 30 s, up to 90 s
weboff (default), public or key: also answer plain HTTP requests at a URL, open or behind a key
scheduleA five-field cron expression (UTC) to call it on a timetable, or null

Deploying again with the same name replaces it and bumps its version. Deploying needs a key with functions:deploy; calling needs functions:invoke.

Call#

POST /v1/functions/{name}/invoke with {"event": …} answers with ok, result, logs and timings. POST /v1/functions/{name}/map with {"events": [...]} calls it on up to 100 events, up to 16 at a time. GET …/invocations lists recent calls. Every endpoint is in the Functions API.

Functions, one-call runs, or sandboxes?#

You haveUse
The same handler, called again and againA function
Some code or a command to run once, maybe with filesOne-call run, POST /v1/run
State that lasts between calls, or a long taskA sandbox

Something wrong or missing? Edit this page, or write to contact@kosa8.com.

The kosa8 weekly

Agent security news, one industry deep-dive and a hands-on challenge, every Monday. Unsubscribe in one click.

© 2026 kosa8 · kosa8.com · AI Agent Sandbox: Secure and Sovereign for Enterprise · Local models served by llamay · Agent gateway: MAQPNA