Skip to Content
Docs

Managed Workers

Write a handler in TypeScript, Rust, Go, or Python and let a platform template run it with events, HTTP, schedules, and platform access.

This section covers the managed-event-worker, managed-http-worker, and managed-scheduled-worker handler templates, including their runtime adapters, worker.json, and .worker-image packaging. For the managed-site-worker template's HTTP application and authentication gateway, see Site Workers.

A managed Worker runs your handler code inside a platform template. You write a handler. The template handles the rest:

  • It receives events, HTTP requests, or schedule ticks and calls your handler.
  • It holds the tenant credentials and makes platform calls for your code.
  • It acknowledges events, writes logs to the tenant log pipeline, and applies limits.

Your code never receives a tenant credential. The only token it sees is the short-lived, single-file token that an attachment transfer uses, and the transfer helpers handle that for you.

Use a managed Worker when you want to process events, serve an API, or run a scheduled job without building that plumbing yourself. Use a custom Compose Worker when you need full control of the containers, your own Pulsar consumer, or a language without a runtime adapter.

How the Pieces Fit

A managed Worker has two containers in one pod:

Part Who Provides It What It Does
Managed template Platform Selects the trigger (event, HTTP, or schedule) and the options a Worker can set. For example, managed-http-worker.
Managed host Platform Runs beside your app. It holds the credentials, checks every request against the capability contract, and calls the platform.
Runtime adapter Platform, as a base image The library your code uses, for TypeScript, Rust, Go, or Python. It gives your handler typed methods for records, attachments, AI, logging, and the rest. Adapter images are for your app's FROM line only. A Worker can't run one as its image.
Your app You A handler and a worker.json release manifest, built FROM the adapter image.

The capability contract defines every platform operation the host offers: its parameters, result, and failure shape. Each adapter's typed methods are generated from that contract, so the four languages expose the same operations. See Platform Capabilities.

Templates

Template Trigger Use It For
managed-event-worker Events on the Worker's topic Processing events, with backlog scaling to zero. The host acknowledges an event only after your handler succeeds.
managed-http-worker HTTP requests to the Worker URL APIs, webhooks, and Site backends.
managed-scheduled-worker A UTC cron schedule Reports, reconciliation, and maintenance jobs. Each run must finish within 30 minutes.

Select a template and version in the admin console under Workers > Managed worker, or with ctxl workers create --managed <template>:<version>. See Templates and Options.

To promote a solution with Service-managed dependencies between tenants, follow Coordinate Worker Deployments and Service Releases.

Release Versions

These docs match the following platform release:

Component Version
Managed templates (managed-event-worker, managed-http-worker, managed-scheduled-worker) 0.10.0
Managed host (Rust) 0.14.0
TypeScript adapter, worker-adapter-node (Node 24) 0.10.0
Rust adapter, worker-adapter-rust (Rust 1.88 or later) 0.7.0
Go adapter, worker-adapter-go (Go 1.26 or later) 0.4.0
Python adapter, worker-adapter-python (Python 3.14) 0.4.0

The template selects the host version. You select the adapter version in your app's FROM line and in the library you copy. Use the versions in one row of the compatibility table together.

Compatibility

Managed Templates Managed Host Adapters Released with It Oldest Adapters It Runs
0.10.0 (current) 0.14.0 Node 0.10.0, Rust 0.7.0, Go 0.4.0, Python 0.4.0 Node 0.7.0, Rust 0.3.0, Go 0.1.0, Python 0.1.0
0.9.2 0.13.1 Node 0.9.1, Rust 0.6.1, Go 0.3.1, Python 0.3.1 Node 0.7.0, Rust 0.3.0, Go 0.1.0, Python 0.1.0
  • Older adapter, newer template: the app runs. It lacks the newer adapter's methods and fixes. For example, an app on adapter 0.9.1 has no typed services.request.
  • Newer adapter, older template: the app deploys and starts, but fails when it uses something the template's host does not have. A capability call to an operation the host lacks fails with contract (unsupported-method). A direct bridge call the host lacks, such as a newer streaming or logging method, is a host fault that fails the invocation. Your app sees only Host capability failed.

When you upgrade the adapter, move the Worker to the template version released with it in the same update:

Terminal
ctxl workers update <worker-id> --managed <template>:<version> --build .worker-image

A --build update on its own keeps the Worker's current template.

What Changed in 0.10.0

  • Platform services. services.request calls a platform service's HTTP API directly, for the services granted in the new PLATFORM_SERVICES option, including endpoints the typed capabilities don't cover. See Call Platform Services.
  • Credentials. AI generation, AI uploads, tool sessions, and loading bound connections now use the Worker's own OAuth client. Records, attachments, and AI Search still use the tenant's managed Native Object connection.
  • Long calls and blocking handlers. An event or scheduled handler can wait on a long AI call, or block its adapter's event loop (for example, a synchronous Python handler), up to its execution deadline. A start hook can take up to the 60-second startup deadline.
  • Hung apps. Before each event or scheduled run, the app must answer the host within 5 seconds. If an app is already frozen, the host fails that event or run without sending it to the app. A failed event is redelivered after the host restarts.
  • Fixes. A failed bulk import can now be caught. In TypeScript, a failed messaging.sendToAgent from the typed method is retried on event Workers, like the raw call.

Pages in This Section

  • Build Your First Managed Worker: a complete HTTP Worker in your language, from source to a deployed Worker.
  • Get the Runtime Adapters: pull the adapter images and set up your editor, tests, and coding agent without access to the platform source.
  • Templates and Options: the worker.json manifest, template options, triggers, scaling, and HTTP limits.
  • Platform Capabilities: records, attachments, AI, AI Search, messaging, connections, cloud storage, logging, and cancellation in each language.
  • Call Platform Services: call any granted platform service's API with services.request, for services or endpoints the typed capabilities don't cover.
  • Raw Platform Calls: typed methods, helpers, and the platform.call escape hatch.
  • Build with a Coding Agent: what to give an agent and what to ask it to check.
  • Troubleshooting: build, packaging, deployment, and runtime problems specific to managed Workers.