Skip to main content

gateway.ts

gateway.ts is the portable stack declaration. Add it when you choose where the compiled runtime runs and which adapters provide state, blobs, sandboxing, and schedules.

Minimal Example

import { adapter, defineGateway } from "@assemblyline-agents/core";

export default defineGateway({
deploy: adapter("railway"),
runtime: adapter("node"),
state: adapter("postgres"),
blob: adapter("r2"),
sandbox: adapter("docker"),
scheduler: adapter("postgres")
});

Full Options

Every slot is optional. Compiler defaults are adapter("local"), except runtime, which defaults to adapter("node").

SlotChoosesDefault
deployWhere the compiled runtime service runs.adapter("local")
runtimeThe HTTP/runtime host.adapter("node")
stateDurable run, event, checkpoint, delivery, memory, and schedule state.adapter("local")
blobAttachments, extracted text, generated artifacts, and sandbox sync bundles.adapter("local")
sandboxDefault isolated filesystem and command backend.adapter("local")
schedulerWhere scheduled ticks are coordinated.adapter("local")

assembly-line add <kind> edits this file for you when the added plugin fills a gateway role (deploy, runtime, state, blob, sandbox, scheduler), wiring the slot to the installed adapter.

Provider Independence

Deploy choice does not imply a state, blob, sandbox, or scheduler vendor. A Railway, Docker, Fly, or VPS deployment can use Postgres state, R2 blobs, a hosted sandbox, and gateway-triggered schedules. Assembly Line keeps these boundaries explicit so the agent can move between hosts. Deployment planning refuses the unconfined local sandbox on non-local targets unless it is explicitly acknowledged, and warns when local state or blobs would be container-local.

Artifacts may also declare runtime requirements independently of a provider. For example, openai-codex/* requires a sensitive persistent /data directory and remote command execution. Any deploy plugin advertising the corresponding capabilities can satisfy the same artifact contract.

Conventions

The compiler reads gateway.ts from the TypeScript AST, so the file must stay statically analyzable: no computed values, conditionals, or dynamic imports. Use statically readable defineGateway({ ... }), adapter("kind"), or provider helper calls such as railwayDeploy(), neonPostgres(), railwayPostgres(), supabasePostgres(), r2Blob(), and dockerSandbox().