Docs

Overview

Serverless compute that scales to zero, triggered by HTTP, queues, storage events, or cron.

Worker provides event-driven, stateless compute. Workers handle HTTP requests, process queue messages, react to storage events, or run on a schedule. They scale automatically with load and scale to zero when idle.

Platform Mapping

PlatformBacking ServiceProvisioned by
AWSAWS Lambda (ARM64/Graviton)Alien
GCPGoogle Cloud RunAlien
AzureAzure Container AppsAlien
Kubernetes / On-PremDeployment + ServiceAlien (agent)

When to Use

Use Worker for event-driven, stateless compute — HTTP APIs, webhook handlers, background processors, queue consumers, scheduled tasks.

Don't use Worker for long-running stateful workloads, persistent WebSocket connections, or services that need internal DNS discovery.

Quick Start

// alien.ts
const api = new alien.Worker("api")
  .code({ type: "source", src: "./api", toolchain: { type: "typescript" } })
  .ingress("public")
  .permissions("execution")
  .build()

Ingress

Controls how the worker is accessible over the network.

ModeDescription
"public"Gets an HTTPS endpoint. For APIs, webhooks, internal tools. See External URLs.
"private"No HTTP endpoint. Only reachable via triggers or direct invocation. Default.
"vpc"Accessible within the VPC only. Requires network configuration.

Worker-to-Worker Invocation

Workers can call other workers directly — low-latency internal calls that bypass public endpoints:

import { worker } from "@alienplatform/sdk"

const processor = await worker("image-processor")
const result = await processor.invokeJson("resize", { imageUrl: "...", width: 800 })
const url = await processor.getUrl()  // public URL, if available
let processor = ctx.bindings().load_worker("image-processor").await?;
let response = processor.invoke(WorkerInvokeRequest {
    target_worker: "image-processor".to_string(),
    method: "POST".to_string(),
    path: "/resize".to_string(),
    headers: BTreeMap::new(),
    body: serde_json::to_vec(&payload)?,
    timeout: Some(Duration::from_secs(30)),
}).await?;

Configuration

MethodDefaultDescription
.code(code)requiredSource code or pre-built image. See Toolchains.
.ingress("public" | "private" | "vpc")"private"Network accessibility. See Ingress above.
.memoryMb(number)256Memory allocation. 128–32,768 MB.
.timeoutSeconds(number)180Max execution time. 1–3,600 seconds.
.concurrencyLimit(number)platform defaultMax concurrent executions. Maps to reserved concurrency (Lambda), max instances (Cloud Run), or max replicas (Container Apps).
.commandsEnabled(boolean)falseEnable the remote command protocol.
.readinessProbe({ method, path })Health check after deploy. Only for "public" ingress.
.environment(Record){}Environment variables.
.link(resource)Connect to a resource for binding access. Can be called multiple times.
.trigger(trigger)Add an event trigger. Can be called multiple times.
.permissions(string)requiredPermission profile name.

Triggers

// Queue trigger — one message per invocation
const worker = new alien.Worker("processor").trigger(tasks).build()

// In worker code:
import { onQueueMessage, onStorageEvent } from "@alienplatform/sdk"

onQueueMessage("tasks", async (msg) => { /* ... */ })
onStorageEvent("uploads", async (event) => { /* ... */ })

On this page