Systems

vserverless

Runs a handler script in its own process, with a real timeout.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/serverless.ven"

Local function as a service style invocation: a Venutian handler script is run in its own isolated operating system process, with a real wall clock timeout enforced by the operating system itself, using the language's own process launching builtin. It runs locally, on the machine that calls it, not on a remote or hosted service.

vserverless.ven
rt = serverless_new(["bin/venutian"], "/var/serverless")
print rt.build_dir
print rt.cold_invocations
Reference (9 functions)

API reference

serverless_new(runner, build_dir)

Builds a fresh ServerlessRuntime with an empty .vbc cache and zeroed counters.

rt = serverless_new(["bin/venutian"], "/var/serverless")
print rt.build_dir
print rt.cold_invocations

handler_vbc_path(runtime, handler_path)

Gives back the deterministic .vbc path a given handler compiles to under this runtime.

rt = serverless_new(["bin/venutian"], "/var/serverless")
print handler_vbc_path(rt, "examples/serverless/handler_add.ven")

serverless_prepare(runtime, handler_path)

Compiles handler_path to a cached .vbc file, unless this runtime has already done so.

rt = serverless_new(["bin/venutian"], "/var/serverless")
vbc = serverless_prepare(rt, "examples/serverless/handler_add.ven")
print vbc
print file_exists(vbc)

invocation_result(ok, timed_out, cold, duration_ms, exit_code, stdout, stderr)

Builds the result Map every invocation function in this module returns.

print invocation_result(yes, no, yes, 12.5, 0, "{\"sum\": 7}\n", "")

run_entry(runtime, entry_path, input_json, timeout_ms, cold, memory_limit_mb = 0)

Runs a compiled or source handler as a real, timed OS subprocess and reports the outcome.

rt = serverless_new(["bin/venutian"], "/var/serverless")
r = run_entry(rt, "examples/serverless/handler_add.ven", "{\"a\": 3, \"b\": 4}", 15000, yes)
print r["ok"]
print r["stdout"]

serverless_invoke_cold(runtime, handler_path, input_json, timeout_ms, memory_limit_mb = 0)

Runs handler_path cold: parse, compile, and execute from source, all inside the timed window.

rt = serverless_new(["bin/venutian"], "/var/serverless")
r = serverless_invoke_cold(rt, "examples/serverless/handler_add.ven", "{\"a\": 3, \"b\": 4}", 15000)
print r["ok"]
print r["stdout"]
print length(map_keys(rt.vbc_cache))

serverless_invoke_warm(runtime, handler_path, input_json, timeout_ms, memory_limit_mb = 0)

Runs handler_path warm: reuses (or first builds) its compiled .vbc, skipping parse/compile.

rt = serverless_new(["bin/venutian"], "/var/serverless")
r = serverless_invoke_warm(rt, "examples/serverless/handler_add.ven", "{\"a\": 10, \"b\": 32}", 15000)
print r["ok"]
print r["cold"]
print r["stdout"]

serverless_invoke(runtime, handler_path, input_json, timeout_ms, memory_limit_mb = 0)

Invokes handler_path, cold on its first call through this runtime and warm on every call after.

rt = serverless_new(["bin/venutian"], "/var/serverless")
a1 = serverless_invoke(rt, "examples/serverless/handler_add.ven", "{\"a\": 1, \"b\": 1}", 15000)
a2 = serverless_invoke(rt, "examples/serverless/handler_add.ven", "{\"a\": 2, \"b\": 2}", 15000)
print a1["cold"]
print a2["cold"]

serverless_stats(runtime)

Summarizes runtimes cold and warm invocation counts and average durations so far.

rt = serverless_new(["bin/venutian"], "/var/serverless")
serverless_invoke(rt, "examples/serverless/handler_add.ven", "{\"a\": 1, \"b\": 1}", 15000)
serverless_invoke(rt, "examples/serverless/handler_add.ven", "{\"a\": 2, \"b\": 2}", 15000)
stats = serverless_stats(rt)
print stats["cold_invocations"]
print stats["warm_invocations"]

Get notified when vserverless changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.