Serverless Workers
When a Task Queue needs more Worker capacity, Temporal starts Workers on the compute provider you configure for the Worker Deployment Version. The compute provider determines how the Workers start, how long they can run, and what resources they can use.
How the compute providers differ
The Worker Controller Instance (WCI) monitors Task Queue demand. On AWS Lambda, Amazon Bedrock AgentCore Runtime, and Modal, it invokes compute to start a Worker. On GCP Cloud Run, it adjusts the size of a Worker Pool whose instances poll continuously while they run.
| Compute provider | What you deploy | How the Worker runs |
|---|---|---|
| AWS Lambda | A Lambda function with a Temporal Lambda Worker integration. | Each invocation runs a Worker that starts up, polls for Tasks, and shuts down within the function timeout. |
| GCP Cloud Run | A container image with a standard Temporal Worker and a Worker Pool for each Worker Deployment Version and compute region. | Long-lived Workers poll as long as their instances are running. The pool can scale to zero if you set its minimum to zero. |
| Amazon Bedrock AgentCore Runtime | An AgentCore Runtime endpoint whose handler starts a Temporal Worker. | The Worker runs in the background. Your handler controls idle shutdown and drain, subject to the Runtime session's lifecycle limits. A microVM session can run for up to eight hours. |
| Modal | A Python function in a Modal App, with its image and compute resources defined in Python. | Each invocation starts a fresh Worker with a configured timeout. Modal supplies container capacity and can reuse a container for later invocations. |
Choose a compute provider
Choose for the workload your Worker serves. Even within one application, a nightly batch and a customer-facing Task Queue can have different needs for compute and startup latency.
Start with the cloud your Activities use
If most of the systems your Activities call already run in GCP, start with Cloud Run. Running the Worker in GCP can simplify access to those systems, let you reuse your deployment tooling, and reduce cross-cloud data transfers. You can deploy an existing containerized Temporal Worker directly to a Worker Pool.
If your dependencies are mainly in AWS, start with Lambda for short, intermittent work such as processing webhook events or running scheduled integrations. Lambda is also a fit for an agent whose Activities make short calls to Amazon Bedrock for model inference.
Choose AgentCore Runtime when you already deploy agents on AgentCore and want to manage the Worker through the same deployment and monitoring tooling. For example, an agent's Activities might use AgentCore to access managed tools or run code in a sandbox. A Worker can reuse initialized clients and caches across Tasks within its Runtime session. Adopting AgentCore for the Worker also means maintaining a Runtime handler and its shutdown behavior. See the AgentCore and Lambda comparison.
Narrow your options to providers available in your Namespace and compute region. If a provider runs in a different cloud from your Activity dependencies, factor in network access and data transfer costs.
AWS Lambda, AgentCore Runtime, and GCP Cloud Run require the Namespace to be active in the same cloud provider as the compute. With Multi-cloud Replication, a failover to a different cloud provider prevents Temporal from starting new Workers on the original provider.
Compare hardware and SDK support
Choose Modal for Python workloads that benefit from its GPU selection or Python-defined images, such as batch inference or GPU-backed media processing. If your data and deployment tooling are already in GCP, compare Modal's GPU options with the GPUs available for Cloud Run Worker Pools.
Your existing Worker code can narrow the choice. Cloud Run runs standard Temporal Workers. The Lambda deployment guide covers Go, Python, TypeScript, Java, and .NET. The Modal integration uses Python, and the AgentCore guide shows a Python Runtime handler.
Match the Worker lifetime to your Activities
A Workflow Execution can span many Worker lifetimes. Compare providers using the longest Activity attempt you expect a Worker to run.
- Lambda and Modal fit Activities that can finish within the time left in a function invocation after Worker startup and before shutdown. An Activity that starts late in an invocation has less time to finish.
- Cloud Run fits longer Activity attempts that would exceed a function deadline. A Worker Pool has no per-invocation timeout, though scale-in can still interrupt an Activity.
- AgentCore Runtime can suit longer Activity attempts in an existing AgentCore application. Both the maximum lifetime and the idle timeout can end the session. Polling Temporal does not reset the AgentCore idle timeout.
Try it locally
To evaluate Serverless Workers on AWS Lambda without an AWS account, you can run the entire loop on your machine with LocalStack and the Temporal development server. See Test a Serverless Worker locally with LocalStack.