Serverless
Function-as-a-Service backed by Firecracker microVMs with sub-second cold starts, per-request scaling, and multiple runtimes.
Serverless
The Serverless service provides Function-as-a-Service backed by Firecracker microVMs. Each function invocation runs in its own lightweight VM for strong isolation. The Serverless Agent manages VM lifecycle, routing, and scaling.
Runtimes
| Runtime | Versions | Handler Format |
|---|---|---|
| Go | 1.21, 1.22 | main.Handler |
| Python | 3.11, 3.12 | main.handler |
| Node.js | 18, 20 | index.handler |
| Rust | 1.75 | main::handler |
- Sub-second cold starts — Firecracker boots microVMs in under 200ms
- Per-request scaling — each invocation gets its own isolated microVM
- Configurable resources — set memory (128 MB to 2 GB) and timeout (1s to 300s) per function
- S3-backed code — upload function code to AgentMetal Storage and reference it
Create a Function
agentmetal function create \
--name process-image \
--runtime python \
--handler main.handler \
--code s3://functions/process-image.zip \
--memory 512 \
--timeout 60
Invoke a Function
Via CLI
agentmetal function invoke process-image \
--data '{"image": "photo.jpg", "width": 800}'
Via API
curl -X POST http://localhost:8080/v1/functions/process-image/invoke \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"image": "photo.jpg", "width": 800}'
Update Function Code
Deploy a new version of your function:
agentmetal function update process-image \
--code s3://functions/process-image-v2.zip
View Logs
agentmetal function logs process-image --tail 50
List Functions
agentmetal function list
What the Agent Manages
The Serverless Agent performs these operations:
- Firecracker VM lifecycle — creates and destroys microVMs for each function invocation, managing a pool of pre-warmed VMs for low-latency starts
- Rootfs creation — builds minimal root filesystem images for each runtime containing the language runtime and your function code
- Function routing — receives invocation requests and dispatches them to available microVMs, queuing requests when at capacity
- Scaling — maintains a pool of warm microVMs based on invocation patterns, scales up during traffic spikes, and scales to zero during idle periods
- Code deployment — downloads function code from S3, builds the rootfs, and makes it available for the next invocation
- Monitoring — tracks invocation count, duration, error rate, and cold start frequency
Configuration
| Parameter | Default | Range | Description |
|---|---|---|---|
memory | 256 MB | 128 MB - 2 GB | Memory allocated to the microVM |
timeout | 30s | 1s - 300s | Maximum execution time |
concurrency | 10 | 1 - 100 | Maximum concurrent invocations |
Each function invocation is fully isolated in a Firecracker microVM. MicroVMs boot in under 200ms and have their own kernel, network interface, and filesystem. This provides VM-level isolation with container-like performance.