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

RuntimeVersionsHandler Format
Go1.21, 1.22main.Handler
Python3.11, 3.12main.handler
Node.js18, 20index.handler
Rust1.75main::handler
## Features
  • 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:

  1. Firecracker VM lifecycle — creates and destroys microVMs for each function invocation, managing a pool of pre-warmed VMs for low-latency starts
  2. Rootfs creation — builds minimal root filesystem images for each runtime containing the language runtime and your function code
  3. Function routing — receives invocation requests and dispatches them to available microVMs, queuing requests when at capacity
  4. Scaling — maintains a pool of warm microVMs based on invocation patterns, scales up during traffic spikes, and scales to zero during idle periods
  5. Code deployment — downloads function code from S3, builds the rootfs, and makes it available for the next invocation
  6. Monitoring — tracks invocation count, duration, error rate, and cold start frequency

Configuration

ParameterDefaultRangeDescription
memory256 MB128 MB - 2 GBMemory allocated to the microVM
timeout30s1s - 300sMaximum execution time
concurrency101 - 100Maximum concurrent invocations
## Architecture

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.