Docs

Overview

A Worker is Alien's stateless, event-driven compute resource. It runs as AWS Lambda on AWS, Google Cloud Run on GCP, Azure Container Apps on Azure, or a Deployment and Service on Kubernetes.

Use a Worker for HTTP requests, Commands, queue messages, storage events, or scheduled work. Workers scale with load and can 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 Operator

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" } })
  .publicEndpoint("api")
  .permissions("execution")
  .build()

Public Endpoints

Workers are private by default. Add named public endpoints when the worker should receive HTTPS traffic.

const api = new alien.Worker("api")
  .publicEndpoint("api")
  .build()

Use endpoint names for roles such as "api", "webhooks", or "admin". See External URLs.

Worker-to-Worker Invocation

There is no app-facing worker-to-worker binding — worker invocation is a provider-internal mechanism, not something an app calls. To reach another worker, use one of two supported patterns. Both work identically from Rust and TypeScript.

Call the peer's HTTP endpoint. Give the target worker a named public endpoint and call its URL with an ordinary HTTP client. Resolve the URL from the deployment info API (GET /v1/deployments/:id/info returns publicEndpoints per resource); see External URLs.

Send it a command. For request/response work that doesn't need a public endpoint, target the worker with the commands client. The target handles it with a registered command() handler (see Commands):

import { CommandsClient } from "@alienplatform/commands"

const commands = new CommandsClient({ managerUrl, deploymentId, token })
const result = await commands.target("image-processor").invoke("resize", payload)

Configuration

MethodDefaultDescription
.code(code)requiredSource code or pre-built image. See Toolchains.
.publicEndpoint(name, options?)Adds a named HTTPS endpoint. Options: hostLabel (host label on the deployment domain, "@" for the apex) and wildcardSubdomains. Omit for private workers. See External URLs.
.memoryMb(number)512Memory 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 used when the worker has public endpoints.
.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({ type: "queue", queue: tasks.ref() }).build()

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

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

On this page