Deployment and Operations
This page covers running Neusym beyond a first try: the backends each profile uses, self-hosting on shared infrastructure, serving an environment over HTTP, and the commands an operator uses every day. If…
This page covers running Neusym beyond a first try: the backends each profile uses, self-hosting on shared infrastructure, serving an environment over HTTP, and the commands an operator uses every day. If you have not built an environment yet, start with Build an Environment.
In a checkout of this repository,
neusymisnode apps/cli/dist/src/index.jsandneusym-serverisnode apps/server/dist/src/index.js(runnpm run buildfirst). In your own project they arenpx neusymandnpx neusym-server, once@neusym/cliand@neusym/serverare installed; the packages are not on npm yet, andnpm run pack:osswrites installable tarballs.
#Profiles and drivers
Kits ask for named interfaces called ports: store@1 keeps state and events, queue@1 holds work, model@1 answers. A profile picks the driver behind each port, so the same kits run on other backends when you change profile: in workspace.yaml.
| Port | test | local | self-host (Enterprise) |
|---|---|---|---|
store@1: state and event log | store-memory | store-sqlite | store-postgres |
bus@1: event delivery | bus-inproc | bus-inproc | bus-postgres |
queue@1: work for workers | queue-memory | queue-sqlite | queue-postgres |
search-index@1 | search-index-memory | search-index-local-fts | search-index-postgres |
blobs@1: files | blobs-memory | blobs-fs | blobs-s3 |
vault@1: secrets | vault-env | vault-env | vault-openbao |
identity@1: server sign-in | identity-local-token | identity-local-token | identity-oidc |
telemetry@1: traces | telemetry-memory | telemetry-jsonl | telemetry-otel-genai |
notifier@1: tells people something waits | notifier-cli | notifier-cli | notifier-webhook |
runner@1: runs commands | runner-process (tests only) | runner-docker, no network | runner-docker, no network |
model@1 | model-scripted | model-openai-compat | model-openai-compat |
test keeps everything in memory and adds scripted cli-harness@1, mcp-transport@1 and a2a-transport@1 drivers, so tests need no network. local is for one machine: state, files, the search index and traces go under .neusym/ in the environment folder, the model is any OpenAI-compatible endpoint (default http://127.0.0.1:11434/v1), and the optional secrets MODEL_API_KEY, LOCAL_API_TOKEN and WEBHOOK_SECRET are environment variables. In self-host, every driver but runner-docker and model-openai-compat is Enterprise. A driver loads only when the level, a kit or another driver needs its port; neusym plan lists them.
To change one port, add bindingOverrides. If you keep the profile's driver, your config and secrets are merged into the profile's, key by key; if you name another driver, the profile's binding for that port is dropped. You can also bind a port the profile leaves out, or set profile: to your own file (./my.profile.json).
profile: local
bindingOverrides:
model:
config: { baseUrl: "https://api.openai.com/v1", defaultModel: "gpt-4o-mini" }neusym plan checks each binding against its driver's config schema, so a typo fails before anything runs: Invalid config for driver "model-openai-compat" (model): profile.bindings.model.config.baseURL: unknown config key.
#Self-hosting
self-host comes from @neusym/profiles-ee (Enterprise, in profiles-ee/). It keeps state, events, the queue and search in one Postgres database, files in S3-compatible storage and secrets in OpenBao or Vault. People sign in through your OIDC provider, traces go to an OpenTelemetry collector, and notices go out as signed webhooks.
Only OPENBAO_TOKEN comes from the process environment; the vault driver signs in with it. The other secrets are read from OpenBao: DATABASE_URL, S3_ACCESS_KEY, S3_SECRET_KEY, MODEL_API_KEY, NOTIFIER_SECRET and, optionally, OIDC_CLIENT_SECRET. By default each is the value field at a path with its own name in the KV v2 mount secret (see the OpenBao driver for other layouts). A missing required secret stops the boot, for example Driver "vault-openbao" requires bootstrap secret "OPENBAO_TOKEN" (vault:OPENBAO_TOKEN), which is not set. The profile's addresses (https://vault.internal, https://sso.internal and the like) are placeholders; point them at your services with bindingOverrides.
#Try it on one machine
profiles-ee/docker-compose.self-host.yml starts Postgres 16 (port 5432: stop a local Postgres first), MinIO (9000), OpenBao in dev mode (8200), Dex for OIDC (5556) and an OpenTelemetry collector (4318). Its development passwords and OpenBao root token are in the file. It does not start Neusym, create the neusym-blobs bucket or store the secrets in OpenBao. Point vault.config.addr, blobs.config.endpoint, telemetry.config.endpoint and identity.config.issuer at it (the server always loads identity@1), and model.config.baseUrl and notifier.config.url at your own model endpoint and webhook receiver.
docker compose -f profiles-ee/docker-compose.self-host.yml up -d#More than one process
local is built for one machine; self-host for processes on several hosts that share one database. Run one environment in several processes (neusym-server --watch or neusym work --watch in each): the Postgres queue gives each job to one worker, and the Postgres bus delivers events across processes. Several environments can share the database too, each in its own process: for example draft workers that build and a commit environment that applies the result, with work split by worker role (allowedRoles in worker-pool, workerRole on a task; see Coordination and Events).
#The HTTP server
neusym-server (@neusym/server) serves one environment over HTTP and Server-Sent Events:
export NEUSYM_OPERATOR_TOKEN=dev-operator-token
neusym-server ./my-env --watch --webhooks webhooks.jsonneusym-server listening on http://127.0.0.1:3000 (level: review)--host and --port default to 127.0.0.1 and 3000. --watch runs a work loop: it fires due timers, runs queued tasks (with worker-pool) and sweeps UNKNOWN writes whose tool can check its own outcome. --worker-interval-ms is the loop's longest idle pause (default 2000), and --seed-tenant <id> (repeatable) names the tenants that get the packs' seed data (default: NEUSYM_TENANT_ID). The server README lists every route and environment variable.
#Sign-in and roles
Every route except GET /health and POST /webhooks/:source needs Authorization: Bearer <token>. NEUSYM_OPERATOR_TOKEN is a static token for actor operator in tenant NEUSYM_TENANT_ID (default default), with all three roles. Other tokens go to the identity@1 driver. identity-local-token (test, local) accepts LOCAL_API_TOKEN, with all three roles by default; with it, the server will not start unless LOCAL_API_TOKEN or NEUSYM_OPERATOR_TOKEN is set. identity-oidc (Enterprise) checks a JWT against your provider's published keys and reads the tenant from tenant_id, the person from sub and the roles from roles, which roleMap can rename (OIDC driver).
A client starts work and sees its own tasks, an approver decides approvals and reads most records, and an operator can do everything. route-policy.ts gives each route its roles. A request that matches no route gets 404, and a route whose kit is not loaded answers 503 PORT_UNAVAILABLE. A token may also carry permissions such as approvals:decide, which only narrow its roles.
| Routes | For | Roles |
|---|---|---|
/health, /webhooks/:source | readiness; signed events from other systems | anyone; HMAC signature |
/tasks | create, run, cancel and list tasks | any role; a client sees only its own |
/waiting, /approvals, /audit, /events/stream | what waits on a person, decisions, audit chain, live events | approver, operator |
/budget, /grants | kill switch, spending caps, grants and seals | approver reads, operator changes |
/operations, /workers, /scopes, /evals, /retention/prune | settling writes, workers and queues, actor scopes, evals, pruning | operator |
/goals, /plans, /proposals, /releases, /memory, /sagas and other kit groups | that kit's records | mostly approver reads, operator changes |
The server sends no CORS headers and reads the token only from the Authorization header. A browser page must call it from the same origin, or through a proxy that adds the header.
#Live events and webhooks
GET /events/stream sends each event as an SSE frame, starting at the newest. This one came from a webhook (shortened):
id: 1
event: intake.accepted
data: {"seq":1,"id":"evt_…","type":"intake.accepted","source":"intake",…,"payload":{"taskId":"task_…","source":"erp","eventId":"evt-1001"}}To resume, send the last id as Last-Event-ID or ?afterSeq=. Ids count the events of all tenants, so gaps are normal. Each event type carries a fixed list of fields (EVENT_STREAM_FIELDS), and a stream closes after 15 minutes, so the client reconnects with its token.
Webhook sources go in the --webhooks file (JSON or YAML); the environment needs the intake kit.
{ "erp": { "producerToken": "erp-producer-1", "secret": "erp-webhook-secret",
"promptTemplate": "Check the ERP change and summarize it." } }The sender signs <source>.<timestamp>.<eventId>.<body> with HMAC-SHA256 and sends X-Neusym-Timestamp (milliseconds), X-Neusym-Event-Id and X-Neusym-Signature: sha256=<hex>. The server answers {"accepted":true,"taskId":"task_…","eventId":"evt-1001","source":"erp"}. The same event id again gets 409 WEBHOOK_REPLAY, and a timestamp more than 5 minutes off is refused. The body becomes untrusted context; the task's instruction is your promptTemplate. With "mode": "event", a delivery becomes an event for trigger rules instead of a task. Outgoing notices, such as a new approval request, use the same signature: notifier-webhook (Enterprise) posts each one to its url, signed with NOTIFIER_SECRET.
#Coding agents without network or keys
cli-executor runs an external coding-agent CLI in a runner-docker session (or runner-firecracker, Enterprise), which has no network. If that agent calls a paid model API, a proxy on the host can add the key, so the key never enters the sandbox. Neusym does not ship that proxy; it provides three hooks for one you run:
- The runner attaches one host Unix socket to the session;
runner-dockermounts it at/run/neusym-relay/proxy.sock. Its folder must be in the runner'sallowedRelaySocketDirs, which is empty (relay off) by default. - Host code that embeds the server (
openServerWorkspace) can passrelaySocketProviderinruntimeOverrides.runnerto open one socket per session. Neusym calls it with the session's tenant, run, task and budget scope, so the proxy does not have to trust the container. - With
billingMode: "external-proxy",cli-executorstops charging the budget itself. The proxy reserves and settles each call withbudget@1, in process or through/budget/attempts/*with an operator token.
With Docker, this works on Linux, not through Docker Desktop on macOS or Windows (Docker runner).
#Day-to-day operations
Each command takes the environment folder and works for one tenant (--tenant, default default). A command that decides something needs --as <person>: the CLI records that name, and an approval checks it against the person who asked. Start with what waits on a person:
neusym waiting ./my-envwaiting (default) · 2 item(s): 1 approval(s) · 1 operation(s) · 0 delivery failure(s)
[approval] apr_… tool=ledger_post task=task_…
[operation] auto:01c39ad3a75c6c status=UNKNOWN tool=ledger_post task=task_…
decide: neusym approve|reject <dir> <approvalId> --as <you>
settle: neusym reconcile <dir> <opKey> confirmed|rejected --as <you>| To | Run |
|---|---|
| decide an approval | neusym approve <dir> <approvalId> --as <you> --reason "…" (or reject) |
record what happened to an UNKNOWN write, after checking the other system | neusym reconcile <dir> <opKey> confirmed --as <you> --note "…" (or rejected) |
| run queued and woken tasks | neusym work <dir>; --watch keeps it running |
| see queue depth per worker role | neusym status <dir> |
| see and retry failed event deliveries | neusym events <dir> --failures, then --redeliver |
| stop new model steps, sub-tasks and non-read calls for a tenant | neusym kill-switch on <dir> --as <you> --reason "…"; later off |
| keep proof that the audit chain was not rewritten | neusym audit anchor <dir>, stored elsewhere; later neusym audit verify <dir> --anchor <seq>:<hash> |
| delete old records | neusym retention prune <dir> --days <n> |
Authority and Safety explains approvals, unknown writes, the kill switch and the audit chain, with output from each command.
retention prune takes --days <n> or --before <iso-date> and, optionally, --target tasks, feedback, evals or events (repeatable; default: every target the environment supports). For one tenant, it deletes what is older than the cutoff: finished tasks with their runs, feedback, eval recordings and events. Unfinished tasks, events a consumer has not handled yet, and the audit chain stay. If a named target cannot be pruned, nothing is:
This workspace cannot prune feedback: Port "diagnostics@1" is not loaded or does not support pruneFeedback. Nothing was pruned.The terminal UI (neusym-tui) shows what waits on you, live events and the kill switch on one screen, over the server's API (Terminal UI).