workflow-studio/compute-worker
Public API reference for remote compute worker server
Overview
@workflow-studio/compute-worker provides the remote execution server used by Workflow Studio.
It exposes a fetch-style handler and Node HTTP server helpers.
Server creation APIs
createComputeWorker(options)
Returns (req: Request) => Promise<Response>.
Key options:
worldcompute(optional)expectedTargetWorld(optional)seedApiKeys(optional)requireHttps(optional)rateLimitPerMinute(optional)sqlitePath(optional)artifactDir(optional)onWebhook(optional)
createNodeComputeWorkerServer(options)
Returns a Node Server that wraps createComputeWorker.
startNodeComputeWorkerServer(options)
Starts Node Server and resolves when listening.
Public routes
GET /v1/healthPOST /v1/runsGET /v1/runs/:idPOST /v1/runs/:id/cancelPOST /v1/runs/resumePOST /v1/deploymentsPOST /v1/deployments/:id/activateGET /v1/deployments/:idGET /v1/deployments/activePOST /v1/webhooks/:provider
World-proxy routes
Require world:proxy scope:
POST /v1/queue/publishGET /v1/world/deployment-idPOST /v1/world/events/createPOST /v1/world/events/listPOST /v1/world/events/list-by-correlationPOST /v1/world/runs/listGET /v1/world/steps/:stepIdPOST /v1/world/steps/listGET /v1/world/hooks/:hookIdGET /v1/world/hooks/by-token/:tokenPOST /v1/world/hooks/listPOST /v1/world/streams/writePOST /v1/world/streams/closeGET /v1/world/streams/readGET /v1/world/streams/listPOST /v1/world/encryption-key
Authentication and scopes
Auth header:
Authorization: Bearer <key>
Common scopes:
- public lane:
trigger:write,runs:read,runs:write,deploy:read,deploy:write - internal lane:
world:proxy
Correlation headers
Every request passing through the worker is tagged with a correlation ID for end-to-end tracing.
Inbound: the worker reads x-workflow-correlation-id from the incoming request. If the header is absent, the worker generates a UUID and injects it into the request headers before routing.
Outbound: every response includes x-workflow-correlation-id, whether the value was forwarded from the caller or generated by the worker.
Audit: the correlation ID (and x-workflow-run-id when present) is persisted in the metadata_json column of audit log entries. This enables correlation-based forensic queries across request chains.
Idempotency behavior
POST /v1/runs requires Idempotency-Key.
- equivalent payload + same key replays prior accepted response,
- different payload + same key returns
409 idempotency_conflict.
See compute-client HTTP status mapping for how the client surfaces this as IdempotencyComputeClientError.
Deployment selection behavior
If deploymentId is omitted on run trigger paths, worker resolves deployment from active deployment pointer.
If no active deployment exists, worker returns 409 { code: 'no_active_deployment' }.
Strict remote guard
In strict mode (NODE_ENV=production), worker startup validates WORKFLOW_TARGET_WORLD against expected target.