Skip to main content

vlambda

An ASGI-like server for Python lambdas, written in V. Uses vcraft for the V↔Python bridge.

Live at: https://vlambda.ricardorobles.es

What is vlambda?

vlambda lets you write Python functions ("lambdas") and serve them as HTTP endpoints. It's like AWS Lambda, but self-hosted, with no cold starts, and ~0.3ms per invocation.

def handler(request):
    return {"msg": "hello", "path": request.path}

POST that code to /vlambda and it becomes GET /f/<slug> instantly.

Features

  • No cold starts — lambdas are compiled once and cached in memory
  • Fast — ~3,000 req/s (concurrent, free-threaded Python), ~0.3ms/req
  • Auth — JWT-based authentication with per-user ownership
  • Web UI — Dashboard for managing lambdas, code editor, metrics
  • Async invocation — Fire-and-forget with task tracking
  • Sandbox — Restricted Python builtins, blocked dangerous modules
  • Metrics — Prometheus-compatible + Chart.js dashboard
  • Per-lambda method — GET, POST, PUT, PATCH, DELETE
  • Naming — Human-readable names for lambdas
  • Multi-file projects — ZIP uploads, file editor, requirements.txt/pyproject.toml
  • Versions and aliases — rollback and prod/staging aliases
  • PyPI packages — install per lambda/project from the UI
  • Persistent metrics and logs — survive restarts, queryable by slug/name
  • CORS — applied to every /f/ response, with OPTIONS preflight
  • Static files — projects serve index.html, CSS, JS and assets at /f/<slug>/<path>
  • API tokens — long-lived tokens with scopes and revocation
  • Export / import / duplicate — move lambdas and projects as JSON
  • POC templates — HTML + fetch, webhook, JSON API, static site
  • Free-threaded builds — cp314t/cp315t wheels

Installation

uv pip install vlambda

Or with pip:

pip install vlambda

Usage

python -m vlambda --port 8080 --sqlite_path ./vlambda.db --num_coroutines 10

Or with environment variables:

VLAMBDA_PORT=8080 VLAMBDA_DB=./vlambda.db VLAMBDA_COROUTINES=10 python -m vlambda

Then open http://localhost:8080/ in your browser.

Build a POC in five minutes

  1. Open the UI and log in.
  2. Pick a template in New lambda (JSON API + CORS, Webhook receiver, Form receiver, HTML page…) and create it.
  3. Open the invoke URL https://your-host/f/<slug>.
  4. Need files? Upload a ZIP in Upload project; anything in the project is served at /f/<slug>/<path> and any unknown path runs handler(request).

More complete examples live in examples/: a static site, an HTML + fetch POC, a webhook receiver and a JSON API.

API tokens

Create a token in System → API tokens, or with the API:

curl -X POST "$VLAMBDA_URL/tokens" \
  -H "Authorization: Bearer $JWT" \
  -H "Content-Type: application/json" \
  -d '{"name":"ci","scopes":["read","write"]}'

The response contains the token (vl_…) once. Use it as Authorization: Bearer vl_…. Scopes are read, write and admin; revoke a token with DELETE /tokens/<id>. Tokens do not expire.

Docker + Dokploy

The repository includes a production image (Dockerfile, installs from PyPI) and a development image (Dockerfile.dev, builds the local wheel). Both run gofly + vlambda + nsjail inside one container and expose plain HTTP on port 8080.

export VLAMBDA_SECRET="$(openssl rand -hex 32)"
export VLAMBDA_ADMIN_TOKEN="$(openssl rand -hex 32)"
docker compose -f docker/compose.yml up -d --build

With Dokploy, create an application from the image, map the domain to container port 8080, and set VLAMBDA_SECRET and VLAMBDA_ADMIN_TOKEN. Dokploy terminates TLS, so the container does not manage certificates.

See docker/README.md for details, limits and the weekly reset command.

CLI Options

Flag Env Var Default Description
--port VLAMBDA_PORT 8080 Listen port
--sqlite_path VLAMBDA_DB ./vlambda.db SQLite database path
--num_coroutines VLAMBDA_COROUTINES 10 Worker pool size
--max_body_size VLAMBDA_MAX_BODY 1048576 Max request body (bytes)
--rate_limit VLAMBDA_RATE_LIMIT 100 Requests/sec per IP
--invoke_timeout VLAMBDA_TIMEOUT 30 Lambda invocation timeout (s)
--max_memory_mb VLAMBDA_MAX_MEMORY_MB 0 RAM limit (0=unlimited)
--cors_origin VLAMBDA_CORS * CORS allowed origin
--cert VLAMBDA_CERT TLS certificate path
--key VLAMBDA_KEY TLS key path

API

Authentication

  • POST /register — Register user (body: username:password)
  • POST /login — Login (body: username:password) → JWT token

Lambdas (requires auth)

  • POST /vlambda?method=GET&name=my-lambda — Create lambda (body: Python code)
  • GET /vlambda — List lambdas (pipe-delimited)
  • GET /vlambda?format=json — List lambdas as JSON
  • GET /vlambda/<slug> — Get lambda code
  • PUT /vlambda/<slug>?method=POST&name=new-name — Update lambda
  • DELETE /vlambda/<slug> — Delete lambda

API tokens (requires auth)

  • POST /tokens — Create a token: {"name":"ci","scopes":["read","write"]}
  • GET /tokens — List tokens (never returns the secret)
  • DELETE /tokens/<id> — Revoke a token

Tokens are accepted anywhere a JWT is accepted. read allows listing and reading, write allows mutating lambdas/projects, admin allows token management and admin routes.

Export / import

  • GET /vlambda/<slug>/export — Export code or project files as JSON
  • POST /vlambda/import — Create from an exported JSON body
  • POST /vlambda/<slug>/duplicate — Copy a lambda or project

Project exports include text files. Binary files are listed in skipped_files and are not copied.

Invocation

  • GET/POST/PUT/PATCH/DELETE /f/<slug> — Invoke lambda (method must match)
  • OPTIONS /f/<slug> — CORS preflight (returns 204)
  • GET /f/<slug>/<path> — Serve a project file, or invoke the handler if the file does not exist
  • POST /async/<slug> — Async invoke (returns task_id)
  • GET /task/<id> — Get async task result

Projects

  • POST /vlambda?project=1&entry=main.py — Upload a ZIP project (base64 body)
  • GET /project/<slug> — Read project files
  • PUT /project/<slug> — Save project files
  • GET /f/<slug>/ — Serve index.html
  • GET /f/<slug>/<path> — Serve a static file (vendor/, .git/ and .. blocked)

Versions and aliases

  • GET /vlambda/<slug>/versions — List versions
  • GET /vlambda/<slug>/version/<n> — Read a version
  • POST /vlambda/<slug>/rollback?version=<n> — Roll back
  • GET /vlambda/<slug>/aliases — List aliases
  • POST /vlambda/<slug>/alias?name=prod&version=<n> — Create alias
  • GET /f/<slug>?alias=prod — Invoke an alias

Packages

  • GET /vlambda/<slug>/packages — List requirements
  • POST /vlambda/<slug>/packages — Install PyPI packages into the vendor dir

Monitoring (requires auth)

  • GET /health — Health check
  • GET /ready — Readiness
  • GET /metrics — Prometheus metrics
  • GET /metrics/json — Live JSON metrics
  • GET /metrics/history?days=N&slug= — Raw persisted metrics
  • GET /metrics/stats?days=N&slug= — p50/p95/p99
  • GET /metrics/aggregate?days=N&slug= — Per-lambda aggregates
  • GET /metrics/summary?days=N&slug= — Daily rollups
  • GET /metrics/export?days=N&slug= — CSV export
  • DELETE /metrics/history?days=N&slug= — Delete metrics older than N days (days=0 deletes all)
  • GET /logs/history?days=N&slug= — Persisted lambda logs
  • DELETE /logs/history?days=N&slug= — Delete logs older than N days (days=0 deletes all)
  • GET /pool/stats, GET /dlq
  • POST /shutdown — Graceful shutdown

Logging

Lambdas can persist structured logs with request.log():

def handler(request):
    request.log("processing " + request.path)
    request.log("debug details", "debug")
    return {"ok": True}

Logs are stored in the metrics database and can be queried with GET /logs/history?days=1&slug=<slug>. The UI Logs view shows them alongside invocations. The "Save logs" template in the editor is a ready-to-run example.

Metrics and logs are pruned after VLAMBDA_METRICS_RETENTION days (default 7). From the UI you can also prune data older than the selected period, or delete all matching rows, with the current lambda filter applied.

Lambda Format

Every lambda must define a handler function:

def handler(request):
    return {"msg": "hello", "path": request.path}

The request object has: method, path, query_string, headers, body.

Safe builtins: abs, all, any, bool, dict, enumerate, filter, float, int, len, list, map, max, min, range, reversed, round, set, sorted, str, sum, tuple, zip, print, etc.

Blocked modules: os, subprocess, sys, importlib, ctypes, socket, urllib, http, shutil, pathlib, io, pickle, marshal, etc.

Safe modules: json, math, re, datetime, collections, itertools, functools, hashlib, base64, string, random, statistics, etc.

Web UI

Open http://localhost:8080/ in your browser for the dashboard:

  • Login/Register
  • Lambda dashboard with search, filter and pagination
  • CodeMirror editor with Python highlighting
  • Multi-file project editor and ZIP upload
  • Versions, rollback and aliases
  • PyPI package installation
  • API playground
  • Persistent metrics with charts and filters
  • Logs viewer with request.log()
  • System status and frontend log drawer

Reset

The demo can be wiped with:

python -m vlambda reset --yes --url http://127.0.0.1:8081 --token "$VLAMBDA_ADMIN_TOKEN"

For the weekly demo reset, run it from cron every Monday:

0 0 * * 1 docker exec -e VLAMBDA_ADMIN_TOKEN="..." <container>   /opt/venv/bin/python -m vlambda reset --yes   --url http://127.0.0.1:8081

Performance

Metric Value
Cold start 0ms (persistent process)
Warm invocation ~0.3ms
Throughput (concurrent, free-threaded) ~3,000 req/s
Throughput (response cache hits) ~100x faster

Architecture

┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│   Browser   │────▶│  V HTTP      │────▶│  Python     │
│   (UI)      │◀────│  Server      │◀────│  Pool       │
└─────────────┘     │  (net.http)  │     │  (workers)  │
                    │              │     └─────────────┘
                    │  ┌────────┐  │           │
                    │  │ SQLite │  │           │
                    │  │ (WAL)  │  │     ┌─────────────┐
                    │  └────────┘  │     │  Sandbox    │
                    └──────────────┘     │  (restricted│
                                         │   builtins) │
                                         └─────────────┘

License

MIT License - see LICENSE for details.

Author

Ricardo Robles Fernández - https://github.com/rroblf01/vlambda

Metadata

Release files for vlambda 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vlambda 0.2.0
File Size Uploaded Provenance Actions
vlambda-0.2.0.tar.gz 368.8 kB With provenance Details for vlambda-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for vlambda 0.2.0
File Actions
vlambda-0.2.0-cp315-cp315t-manylinux_2_28_x86_64.whl CPython 3.15 CPython 3.15 free-threading Linux glibc 2.28+ x86-64 Details for vlambda-0.2.0-cp315-cp315t-manylinux_2_28_x86_64.whl
vlambda-0.2.0-cp315-cp315t-manylinux_2_28_aarch64.whl CPython 3.15 CPython 3.15 free-threading Linux glibc 2.28+ ARM64 Details for vlambda-0.2.0-cp315-cp315t-manylinux_2_28_aarch64.whl
vlambda-0.2.0-cp315-cp315-manylinux_2_28_x86_64.whl CPython 3.15 CPython 3.15 Linux glibc 2.28+ x86-64 Details for vlambda-0.2.0-cp315-cp315-manylinux_2_28_x86_64.whl
vlambda-0.2.0-cp315-cp315-manylinux_2_28_aarch64.whl CPython 3.15 CPython 3.15 Linux glibc 2.28+ ARM64 Details for vlambda-0.2.0-cp315-cp315-manylinux_2_28_aarch64.whl
vlambda-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 Details for vlambda-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl
vlambda-0.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ ARM64 Details for vlambda-0.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl
vlambda-0.2.0-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details for vlambda-0.2.0-cp314-cp314-manylinux_2_28_x86_64.whl
vlambda-0.2.0-cp314-cp314-manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ ARM64 Details for vlambda-0.2.0-cp314-cp314-manylinux_2_28_aarch64.whl

Total release size: 15.3 MB

Release files / vlambda-0.2.0.tar.gz

Download URL vlambda-0.2.0.tar.gz
Size 368.8 kB
Tags Source
SHA-256 checksum
How to use checksums
90c855f66bd4f86687a13029b470da863e9b20156b85c63a81398de09ff43e42
BLAKE2b-256 checksum
How to use checksums
612ace97a82cbc9ceeed6c13f6d41bf7b7715047994f3b6ae7996373fd5d5b4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / vlambda-0.2.0-cp315-cp315t-manylinux_2_28_x86_64.whl

Download URL vlambda-0.2.0-cp315-cp315t-manylinux_2_28_x86_64.whl
Size 1.9 MB
Tags CPython 3.15 CPython 3.15 free-threading Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a90a4ae93c4ddaf24ca930b45fda100b6b6e04c6c61624721d70004cb609f3ac
BLAKE2b-256 checksum
How to use checksums
5a702bfbb04550c68b69a3bc8ce5f7d32a66d748131e48af929d32858fa4d42b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / vlambda-0.2.0-cp315-cp315t-manylinux_2_28_aarch64.whl

Download URL vlambda-0.2.0-cp315-cp315t-manylinux_2_28_aarch64.whl
Size 1.9 MB
Tags CPython 3.15 CPython 3.15 free-threading Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
7ef1051cbfd486ef8ac0dee0737c6107d43bfb35a2340d1446677ff3870b6460
BLAKE2b-256 checksum
How to use checksums
c01727711fc4128a7c044377f0c89d9ee6f16a8f7e19d36be3e14e3409ddc3f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / vlambda-0.2.0-cp315-cp315-manylinux_2_28_x86_64.whl

Download URL vlambda-0.2.0-cp315-cp315-manylinux_2_28_x86_64.whl
Size 1.9 MB
Tags CPython 3.15 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b5adc6cee3f24b7807ae457392aa473d970a2b140e9a895fb4f92cd8a6fdf7b0
BLAKE2b-256 checksum
How to use checksums
807cfdd0db87680c43fc9848da6802b819fc4bd5aa02053021108b8257e72c4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / vlambda-0.2.0-cp315-cp315-manylinux_2_28_aarch64.whl

Download URL vlambda-0.2.0-cp315-cp315-manylinux_2_28_aarch64.whl
Size 1.9 MB
Tags CPython 3.15 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
3e83b9433aba61502fdd7d7e8d441d4524c42d0ef237d9d66cbfb6f320a226f8
BLAKE2b-256 checksum
How to use checksums
28febe83b7b6aa5c8b7eb31f51adfd881edb56383e2971bee6767b3c27b594de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / vlambda-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl

Download URL vlambda-0.2.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Size 1.9 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
13869cdba768d6c63cb7a712a63a437652efde0c70bab2e9a8beb6bb3ce77ad4
BLAKE2b-256 checksum
How to use checksums
fabb2be7d49538d04a31d8ecc7b86e224cc77e5c3da4a353357136be72f93d41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / vlambda-0.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl

Download URL vlambda-0.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl
Size 1.9 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
006288083666066afa61459986794c2d175f40666a932b2508993f621d13d8b8
BLAKE2b-256 checksum
How to use checksums
b2ee7ba3b6c6b28044417c25cc608559e0ded96d74b1980a575bc6a28851fe4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / vlambda-0.2.0-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL vlambda-0.2.0-cp314-cp314-manylinux_2_28_x86_64.whl
Size 1.9 MB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c60ec8ff02847841c6f0b728618d96c5d4d0e10ab8246c3e923875e46bef38e4
BLAKE2b-256 checksum
How to use checksums
2f6744fc8f96eb6e9d4a7d04208c7f461d3fa3a73157ca93e7f92acbfeb0e881
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / vlambda-0.2.0-cp314-cp314-manylinux_2_28_aarch64.whl

Download URL vlambda-0.2.0-cp314-cp314-manylinux_2_28_aarch64.whl
Size 1.9 MB
Tags CPython 3.14 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
c9bb735a52b5009b3160a06e15823ff79319ded32cfa1491be4cb40be8e2db5c
BLAKE2b-256 checksum
How to use checksums
bb416a89d0dcb717fdcb5acdb551f14b2397743ff11cc741e1901e8ea609cc23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for vlambda 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for vlambda-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page