> For the complete documentation index, see [llms.txt](https://docs.contextual.io/documentation-and-resources/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers.md).

# Contextual Workers

Create, deploy, and update application code with Contextual Workers.

{% hint style="info" %}
Contextual Workers are in early access and may not be available in your account. [Contact Contextual support](mailto:help@contextual.io) to request that Workers be enabled for your tenant.
{% endhint %}

Bring your own code to Contextual. Workers run applications built with the languages, libraries, and tools you choose. Your code runs alongside the platform's data, events, and workflows.

## What Is a Worker?

A Worker is a tenant resource that runs your application code from container images. The Worker configuration selects the application, compute size, runtime settings, and how work starts. Contextual Workers are not Flow topic workers or Cloudflare Workers.

Application code and build files stay in your source repository. The Contextual CLI can build and push images, deploy a Worker, and update application code or Worker runtime settings. Saved configuration changes start a deployment, so code and runtime settings can evolve independently.

Workers can use platform data and events alongside Flows, [Native Objects](https://docs.contextual.io/documentation-and-resources/components-and-data/object-types.md), [AI Search](https://docs.contextual.io/documentation-and-resources/components-and-data/ai-search.md), and Sites. A container receives platform credentials only for the [features](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/connect-to-contextual.md#request-platform-access) it requests, and those credentials are tenant-wide. Native Objects and external data stores provide persistent storage for application state.

[About Workers](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/about-workers.md) explains configuration, templates, the runtime environment, and the deployment lifecycle. Read its [Runtime Environment](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/about-workers.md#runtime-environment) section before you move an existing application to a Worker.

## What You Can Build

Workers can power a small utility, a complete service, or the backend of a larger solution. Your application code can provide:

* **Application Backends:** Custom APIs, webhook endpoints, and business logic for Sites or other clients.
* **AI Agents and Tools:** Assistants that coordinate model calls, use tools, and act on application data.
* **Document Processing:** Applications that extract information from files, classify documents, or prepare content for search.
* **Data Validation and Enrichment:** Code that checks incoming records, calculates values, and adds information from other sources.
* **Integrations:** Connectors that synchronize data with external systems and react to changes in your tenant.
* **Automation:** Jobs that generate reports, send notifications, reconcile records, or perform scheduled maintenance.

A document-processing Worker could enrich Native Object records and expose an API for a Site to show the processing results.

Work can start in several ways:

* **HTTP:** Run a service that handles requests at the Worker's URL.
* **Events:** Process events from the Worker's topic with a managed event template or a custom Compose service.
* **Schedule:** Run a job on a UTC cron schedule. The job must finish and exit within 30 minutes.

## Create Your First Worker

Follow [Deploy Your First Worker](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/quickstart.md) for a complete HTTP example, from local testing through deployment and a CLI configuration update. The example needs no application framework or platform SDK.

Then use:

* [Configure a Custom Worker Size](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/configure-worker-size.md) to set CPU and memory for each replica.
* [Workers CLI Reference](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/contextual-cli.md) to build images, change configuration, inspect deployments, read logs, and remove a Worker.
* [Connect to Contextual](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/connect-to-contextual.md) when your application needs platform data, events, or a schedule.
* [Coordinate Worker Deployments and Service Releases](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/releases.md) to coordinate Service releases and Worker deployments between development and production tenants.
* [x-contextual Specification](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/x-contextual-specification.md) for supported Compose fields, defaults, validation rules, and JSON Schemas.
* [Troubleshooting](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/troubleshooting.md) when access, image builds, or deployment checks fail.
* [Managed Workers](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/managed-workers.md) to write only a handler, in TypeScript, Rust, Go, or Python, and let a platform template run it with events, HTTP, or a schedule and with platform access to records, files, and AI.

For questions during early access, [contact Contextual support](mailto:help@contextual.io). For a reproducible issue, follow [Report a Failure](https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers/troubleshooting.md#report-a-failure) and include the tenant ID, Worker ID, configuration version, and failing check.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.contextual.io/documentation-and-resources/components-and-data/contextual-workers.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
