NylorunDocsBeta
Get startedBuildRunDeployReferenceMore

Admin

Operate Runtime Hosts and Tenants with @nylorun/admin.

@nylorun/admin is the operator client for Host status and Tenant lifecycle. Application backends that only run agents use @nylorun/agents instead.

import { createAdmin } from "@nylorun/admin";

const admin = createAdmin();
const status = await admin.status();
const { tenant, applicationKey } = await admin.createTenant({ name: "my-app" });

await admin.listTenants();
await admin.getTenant(tenant.id);
await admin.deleteTenant(tenant.id, { activeWork: "refuse" });

Persist the returned applicationKey: the Host stores only its hash and cannot return the cleartext value later. createTenant generates its Tenant id, principal, key, and idempotency key locally and retries transient failures with the same values.

Connection resolution

createAdmin() resolves in this order:

  1. Explicit createAdmin({ url, key }).
  2. NYLORUN_ADMIN_URL plus NYLORUN_ADMIN_KEY.
  3. Local host.json and host-credentials.json under NYLORUN_HOME or ~/.nylorun.

Use createAdmin({ home }) to select another local Host root. On POSIX, local Host credentials must be owned by the current user and not be group- or world-readable.

Methods

MethodAdmin routePurpose
status()GET /v1/admin/statusRead Host version, protocol, readiness, and Tenant summary.
listTenants()GET /v1/admin/tenantsList known Tenant envelopes and state.
getTenant(id)GET /v1/admin/tenants/:idInspect one Tenant.
createTenant({ name })POST /v1/admin/tenantsCreate a Tenant and its first application principal.
deleteTenant(id, { activeWork })DELETE /v1/admin/tenants/:idRefuse, drain, or cancel active work according to operator policy.

Host shutdown is launcher-private and is not part of the shared Admin API.

Errors and compatibility

The client checks /health once and sends Nylorun-Protocol. Incompatible Hosts fail before an admin operation. Failures are AdminError instances with a registry code; the package re-exports ERROR_CODES, PROTOCOL_FEATURES, and compareVersions.

See Runtime reference for the Tenant API and Environment for connection variables.

On this page