Deployment
Configure alineod, run it as a Docker container, and connect it to OpenSandbox.
alineod is a single Bun process with two SQLite files and a working directory. It holds no in-memory state that can't be rebuilt, so the process — or its container — can be restarted or recreated freely (see Crash recovery). Run exactly one instance per database: restarts are safe, replicas are not (see Scaling).
Configuration
| Variable | Default | Description |
|---|---|---|
ALINEOD_PORT | 4600 | HTTP + SSE listen port. |
ALINEOD_DB_PATH | ./data/alineod.db | alineod's own state: the append-only swarm ledger and the agents/handles tables derived from it. |
ALINEOD_SDK_LEDGER_PATH | ./data/alineod-sdk-ledger.db | The SDK's sandbox ledger (sandbox, exec, and checkpoint events), shared by every agent alineod drives. Turn checkpoints are written next to it. |
ALINEOD_WORK_DIR | ./data/alineod-work | Spec files handed to spawn(), and stored agent results. |
ALINEOD_PROMPT_INACTIVITY_MS | 180000 | If a turn's stream produces nothing for this long, alineod follows the turn by polling instead. |
ALINEOD_TURN_MAX_MS | 1800000 | How long a polled turn may keep running (paused time excluded) before it's ended with partial output. |
ALINEOD_CATCH_UP_POLL_MS | 2000 | Interval between state polls while following a turn. |
ALINEOD_STATE_PROBE_TIMEOUT_MS | 5000 | Bound on one state poll, so an unresponsive agent can't stall alineod. |
ALINEOD_RESUME_BRIDGE_TIMEOUT_MS | 10000 | After a resume, how long to wait for the agent's harness to answer before restarting it. |
ALINEOD_SUBTREE_MEMBER_TIMEOUT_MS | 30000 | Bound on one member's pause or resume inside a subtree operation, so one unresponsive sandbox can't stall the sweep (reported as failed: timeout). |
ALINEOD_ADMISSION_CONCURRENCY | host vCPUs − 1 (at least 1) | How many sandboxes alineod creates or forks at once. Spawns beyond it wait for a slot. See Admission. |
ALINEOD_ADMISSION_TIMEOUT_MS | 600000 | How long a spawn may wait for a slot before it fails with agent.admission_timeout. |
ALINEOD_REATTACH_RETRY_DELAY_MS | 1000 | On boot, how long to wait before retrying a failed reattach once — see the restore ladder. |
ALINEOD_TRANSIENT_RETRY_MAX | 3 | How many times a turn that failed on a model provider's 429 or 5xx is re-sent before onFailure applies. 0 turns it off. See Supervision. |
ALINEOD_TRANSIENT_RETRY_BASE_MS | 2000 | First backoff before a transient retry. Doubles each attempt, with up to 25% jitter. |
ALINEOD_TRANSIENT_RETRY_MAX_DELAY_MS | 30000 | Upper bound on one transient-retry backoff. |
ALINEOD_LEASE_TTL_MS | 15000 | How long the instance lease outlives its last heartbeat. See Scaling. |
ALINEOD_CHECKPOINT_CONCURRENCY | host vCPUs − 1 (at least 1) | How many turn checkpoints are taken at once. Each holds its tarball in memory while it is read out of the sandbox; extra ones wait. |
ALINEOD_REHYDRATE_CONCURRENCY | host vCPUs − 1 (at least 1) | How many agents are reconnected or restored at once on boot. 1 restores one at a time. See Back up and restore. |
ALINEOD_INSTANCE_ID | default | A stable name for this alineod, used as its folder in the backup bucket. |
ALINEOD_BACKUP_BUCKET and ALINEOD_BACKUP_* | empty (off) | Off-box checkpoints and backups in an S3-compatible bucket. The full list is in Back up and restore. |
ALINEOD_AUTH_TOKEN | empty (off) | A shared secret. When set, every request except GET /health needs Authorization: Bearer <token>. See Security. |
ALINEOD_SPEC_ENV_ALLOW | empty (no limit) | Which ${NAME} references a spec's env may use. A comma list of names or PREFIX*, or none. See Security. |
ALINEOD_MAX_OPEN_RUNS | 0 (no limit) | Most runs one tenant may have open at once. See Limits and suspension. |
ALINEOD_MAX_LIVE_AGENTS | 0 (no limit) | Most agents one tenant may have holding a sandbox at once. |
ALINEOD_MAX_AGENTS_PER_WINDOW | 0 (no limit) | Most agents one tenant may create within ALINEOD_AGENT_WINDOW_MS. |
ALINEOD_AGENT_WINDOW_MS | 86400000 | The rolling window for the limit above. One day. |
ALINEOD_MAX_RUN_AGE_MS | 0 (no limit) | An open run older than this is torn down. |
ALINEOD_SWEEP_INTERVAL_MS | 30000 | How often the sweep looks for runs to tear down. |
Every variable is declared in apps/alineod/config.ts, and a bad value is rejected at startup rather than silently
becoming NaN.
Agent memory has its own ALINEOD_MEMORY_* variables, covered in Agent memory.
The memory database is a third SQLite file, and scripts/backup.ts includes it.
OpenSandbox connection settings come from alineo.config.json in the working directory, exactly as for the SDK
and CLI. Model-provider keys (NVIDIA_API_KEY, ANTHROPIC_API_KEY, …) are read from alineod's own environment
wherever a spec's env references them as ${VAR}.
Fixed limits, set in apps/alineod/config.ts:
- Socket idle timeout: 255 s (Bun's maximum — its ~10 s default would kill SSE and long-polls).
- SSE heartbeat: every 10 s.
GET /agents/:id/result?wait=is capped at 240 s.
Security
alineod has no login by default. It answers every request, so run it on a trusted interface (127.0.0.1, or a
private network) unless you turn one of the options below on. Put your own TLS in front of it when it must be
reachable over a network. It speaks plain HTTP.
| Mode | How | What it protects |
|---|---|---|
| No authentication (default) | nothing to set | Nothing. Fine for one user on one machine. |
| One shared secret | ALINEOD_AUTH_TOKEN | Keeps out callers without the token. Everyone with it is one tenant and sees every run. |
| Several isolated tenants | pass authenticate to startDaemon() | Each tenant sees only its own runs. A caller cannot tell another tenant's run from a missing one. |
With authentication on, every route except GET /health answers 401 with { "error": ..., "code": "UNAUTHENTICATED" }
until the caller sends a valid credential. GET /health stays open so a load balancer can probe it.
Tenants
An authenticate function cannot be set from the environment, so you write a small entry file of your own in place
of server.ts. It calls startDaemon() from src/daemon.ts, which runs the same boot sequence as server.ts (the
lease, the SDK ledger, memory, rehydrate, the HTTP app and the sweep). authenticate receives the request and returns
{ tenantId }, or null to refuse it. It may be async. alineo does not store keys or users. You write that part:
import { startDaemon } from "./src/daemon";
const daemon = await startDaemon({
authenticate: async (request) => {
const key = request.headers.get("authorization")?.replace(/^Bearer\s+/i, "");
const tenantId = key ? await lookupTenantByKey(key) : null; // your key store
return tenantId ? { tenantId } : null;
},
});
process.on("SIGTERM", () => {
daemon.stop();
process.exit(0);
});Every other setting still comes from the ALINEOD_* variables above. The
Hosted MCP for a Team cookbook runs a complete entry file like this with two tenants.
A run belongs to the tenant that created it. Everything under a run (its agents, results, events, inbox and memory)
follows it. A request for a run or agent that belongs to another tenant gets the same 404 as one that does not
exist. GET /runs lists only the caller's runs.
Runs made before you turned authentication on, or with no authentication, belong to the default tenant. The
ALINEOD_AUTH_TOKEN mode uses that tenant, so turning the token on does not hide existing runs. A named tenant
cannot see them.
For a named tenant, alineod puts the tenant in front of each spec's resourceId and teamId (acme:researcher), so two
tenants who pick the same agent name do not share memory.
A tenant id may not be empty or contain :, because the colon separates a tenant from its memory scope. alineod refuses
a credential whose tenant id breaks this and logs an error, since the fault is in your authenticate function. For the
same reason, a caller in the default tenant may not use : in a spec's name, resourceId or teamId once
authentication is on. Otherwise it could write acme:shared and reach tenant acme's memory.
Network isolation is part of the security model
Two checks cannot be made complete inside alineod, so the network around it has to back them up:
- Spawns from inside a sandbox. An agent that runs the
alineo spawncommand inside its sandbox uses the SDK and does not call alineod's HTTP API. It does not go throughPOST /runs/:runId/agents, so alineod's tenant check,limitsForandadmitSpecdo not see it. The spec'sspawnDepthandmaxAgentsstill bound it. Do not let sandboxes reach the OpenSandbox server or alineod. Block both with the sandbox egress policy and your firewall. What a sandbox can reach depends on your setup, so test it on yours. - Fetching a spec by URL (the remote MCP). The MCP resolves a name, checks the addresses, and then
fetchresolves it again, so a hostile DNS server can answer differently the second time. Run the MCP server where it cannot reach private addresses at all, such as a host or container with no route to your internal network.
Limits and suspension
alineo ships limits and a kill switch and sets no numbers. Every limit is off until you set it, so nothing changes for a deployment that sets none. With authentication off, all callers count as one tenant.
| Limit | Counts | Refuses with |
|---|---|---|
ALINEOD_MAX_OPEN_RUNS | Runs a tenant has open. | 429 LIMIT_EXCEEDED |
ALINEOD_MAX_LIVE_AGENTS | Agents holding a sandbox. A finished agent keeps its sandbox until its run closes, so it still counts. | 429 LIMIT_EXCEEDED |
ALINEOD_MAX_AGENTS_PER_WINDOW | Agents created in a rolling window, alive or not. | 429 LIMIT_EXCEEDED |
ALINEOD_MAX_RUN_AGE_MS | Age of an open run. An older run is torn down, and the ledger is kept. | (the sweep tears it down) |
These limits cap sandboxes, which are most of the cost of running agents. alineod does not measure model tokens or money, so no limit caps those. Cap them at the model provider.
The check and the create happen with no await between them, so concurrent requests cannot all pass a limit
that has room for one.
To give tenants different limits, or to suspend one, build a Limits and pass it to startDaemon(). The functions
may be async:
import { startDaemon } from "./src/daemon";
import { Limits } from "./src/limits";
const limits = new Limits({
defaults: { maxOpenRuns: 3, maxLiveAgents: 10 },
limitsFor: async (tenantId) =>
(await plan(tenantId)) === "pro" ? { maxLiveAgents: 40 } : undefined,
isSuspended: async (tenantId) => await isBlocked(tenantId),
});
const daemon = await startDaemon({ authenticate, limits });limitsFor is merged over defaults field by field. While isSuspended answers true for a tenant, its requests that
start or continue work (create a run, spawn, prompt, steer, resume, write memory) get 403 TENANT_SUSPENDED, and the
sweep tears down its open runs. Reads, stop, pause, await and DELETE /runs/:runId still work. A limitsFor
or isSuspended that throws refuses the request, so a broken switch fails closed. During the sweep, a function that
throws leaves the run alone, so a broken policy function cannot tear runs down by accident.
Keep secrets out of specs
alineod fills ${NAME} in a spec's env from its own environment. Without a limit, anyone who can create a run can
write "env": { "X": "${SOME_SECRET_ALINEOD_HOLDS}" } and read that secret inside their sandbox. This applies to a
credential binding's credential value too.
Set ALINEOD_SPEC_ENV_ALLOW (or pass specEnvAllow to startDaemon()) whenever people you do not trust can create
runs. List the names a spec may read, for example NVIDIA_API_KEY,OPENAI_*. A trailing * matches a prefix. none
allows no ${NAME} at all, so a spec carries only literal values. A spec that breaks the rule is refused with 400.
An allowed name is still readable inside the sandbox when a spec uses it as a plain value, as in
{ "X": "${NVIDIA_API_KEY}" }. That value becomes a container environment variable, and the agent, or code it runs,
can print it. If your daemon pays for the model, do not hand tenants a plain-string key. Put the key on the allowlist
and tell tenants to use a credential binding ({ "credential": "${NVIDIA_API_KEY}", "host": ..., "injection": ... }).
A binding keeps the real value out of the sandbox and injects it into matching outbound requests only.
The limit applies to env only. A shell command in a setup step runs inside the sandbox and cannot read alineod's
environment.
Logging
alineod logs to stderr — never stdout — at info by default:
- the run and agent lifecycle (
run.started,agent.spawned,agent.provisioned,agent.state_changed,agent.ended,handle.settled) — each line carriesrunId,agentIdand the event'sseq, so it lines up with the event stream; - the crash-recovery pass at boot (
rehydrating …, then one line per agent reattached, resumed or lost); - problems: a failed, lost or budget-denied agent logs at
warn; an unexpected request error logs aterrorwith its method and path.
[alineod] listening url=http://localhost:4600 openapi=/openapi
[alineod] agent.spawned runId=r_b72c6e9c agentId=a_9f89972f seq=4 specName=worker-ocean parentAgentId=a_7fb804cd depth=1 spawnIndex=0
[alineod] agent.ended runId=r_b72c6e9c agentId=a_9f89972f seq=19 outcome=successThe SDK's own progress lines ([agent] …) appear alongside, tagged with the agent's name. Prompts, specs, steer messages and results are never logged — they stay in the ledger.
The format is pretty on a terminal and JSON lines otherwise, so docker logs shows JSON.
| Variable | Meaning |
|---|---|
ALINEO_LOG_LEVEL | debug, info (default), warn, error or silent. |
ALINEO_LOG | Per-component levels, e.g. agent=warn,alineod=debug — agent is the SDK's progress lines; debug adds turn/tool events and bookkeeping. |
ALINEO_LOG_FORMAT | pretty or json. |
ALINEO_LOG_FILE | Write to this file instead of stderr. |
Docker
The image builds the whole monorepo (alineod depends on the SDK workspace packages), so build from the repo root:
docker build -f apps/alineod/Dockerfile -t alineod .
docker run --rm -p 4600:4600 \
--add-host host.docker.internal:host-gateway \
-e ALINEO_SERVER_URL=http://host.docker.internal:8080 \
-e NVIDIA_API_KEY=nvapi-... \
-v alineod-data:/data \
alineodOr with Compose:
NVIDIA_API_KEY=nvapi-... docker compose -f apps/alineod/docker-compose.yml up --buildThe entrypoint writes /data/alineo.config.json from these variables before starting the server:
| Variable | Description |
|---|---|
ALINEO_PROVIDER | Sandbox provider id. Default opensandbox. See Sandbox providers. |
ALINEO_SERVER_URL | OpenSandbox server URL. |
ALINEO_USE_SERVER_PROXY | Route sandbox traffic through the OpenSandbox server (true). |
ALINEO_API_KEY | OpenSandbox API key, if the server requires one. |
All state lives under /data — both ledgers, the work directory, and the checkpoints/ directory of turn
checkpoints next to the SDK ledger. Keep it on a volume: it is what a restart, a lost container, or a reboot is
recovered from.
Networking
alineod talks to OpenSandbox over HTTP only. It does not need the Docker socket: OpenSandbox creates the agent containers, not alineod.
Server proxy URLs and the eip
In server-proxy mode, OpenSandbox hands back sandbox URLs built from its own configured eip. If
that is http://localhost:8080, those URLs won't resolve from inside the alineod container.
Either put alineod on the same Docker network as OpenSandbox with a routable eip, or run the
container with --network host (the same as running alineod bare on the host).
alineod has also been run against an OpenSandbox server using gVisor (runsc) as its secure container runtime;
nothing in alineod depends on the runtime.
gVisor on Docker: set --overlay2=none
By default, gVisor keeps a container's writes in its own filestore (--overlay2=root:self).
docker commit, which OpenSandbox uses for snapshots and forks, can't see that filestore. So
every spawned child and every restored snapshot comes back with none of the parent's files, and
the agent inside can't start. Register runsc with "runtimeArgs": ["--overlay2=none"] in
/etc/docker/daemon.json (see
OpenSandbox#1831). Even then,
/tmp is a tmpfs under gVisor and isn't carried into forks.
Admission
Creating or forking a sandbox is the slow, heavy part of a spawn — a cold provision can take a minute or more. alineod
runs at most ALINEOD_ADMISSION_CONCURRENCY of them at once, and holds the rest in a queue, so a coordinator that
fans out to twenty workers on a small box gets them one after another instead of starving the machine.
A spawn that has to wait records agent.admission_queued, then agent.admission_granted when it gets its slot.
One that waits longer than ALINEOD_ADMISSION_TIMEOUT_MS fails loudly with agent.admission_timeout rather than
hanging. The uncontended case records nothing.
Scaling
alineod is a single-node control plane. Run one instance per database. It restarts cleanly, but it does not replicate:
- SSE fan-out is in-process. A client connected to one instance never sees events written by another.
- Agents have no owner. On boot, an instance reattaches every live agent in the database, so two instances would both drive the same agents.
- Notifications are delivered in-process, by the instance that recorded the event.
- State is local SQLite. Putting the files on a shared network volume for several instances is unsupported: SQLite's locking over network filesystems is unreliable.
This is enforced, not just documented. On startup alineod takes a lease in its database, and heartbeats it every
ALINEOD_LEASE_TTL_MS / 3. A second instance against the same database waits one TTL to see whether the holder
is still alive, then exits with an error naming the other instance's host and pid.
A holder that died without releasing — kill -9, OOM, power loss — stops heartbeating, so the next boot takes the
lease over after at most one TTL. A clean shutdown (SIGTERM, SIGINT) releases it immediately. Under a
supervisor such as systemd or Docker's restart: policy, a crash therefore costs up to 15 s of extra startup, not
a restart loop.
The agents themselves run in OpenSandbox containers, not in alineod.
The protocol spec
The wire contract is defined once, as Zod schemas in apps/alineod/src/schema.ts. The running daemon serves an
interactive OpenAPI document at /openapi, and the schemas can be emitted to files for client generation:
cd apps/alineod
bun run spec # writes apps/alineod/spec/openapi.json and apps/alineod/spec/events.schema.json