Deployers

Deploy pipelines as HTTP services for real-time execution

Pipeline deployment is the process of making ZenML pipelines available as long-running HTTP services for real-time execution. Unlike traditional batch execution through orchestrators, deployers create persistent web services that can handle on-demand pipeline invocations through HTTP requests.

Deployers are stack components responsible for managing the deployment of pipelines as containerized HTTP services that expose REST APIs for pipeline execution.

A deployed pipeline becomes a web service that can be invoked multiple times in parallel, receiving parameters through HTTP requests and returning pipeline outputs as JSON responses. This enables real-time inference, interactive workflows, and integration with web applications.

When to use it?

Deployers are optional components in the ZenML stack. They are useful in the following scenarios:

  • Real-time Pipeline Execution: Execute pipelines on-demand through HTTP requests rather than scheduled batch runs

  • Interactive Workflows: Build applications that need immediate pipeline responses

  • API Integration: Expose ML workflows as REST APIs for web applications or microservices

  • Real-time Inference: Serve ML models through pipeline-based inference workflows

  • Agent-based Systems: Create AI agents that execute pipelines in response to external events

Use deployers when you need request-response patterns, and orchestrators for scheduled, batch, or long-running workflows.

Deployer Flavors

Out of the box, ZenML comes with a local deployer already part of the default stack that deploys pipelines on your local machine in the form of background processes. Additional Deployers are provided by integrations:

Deployer
Flavor
Integration
Notes

local

built-in

This is the default Deployer. It deploys pipelines on your local machine in the form of background processes. Should be used only for running ZenML locally.

docker

Built-in

Deploys pipelines as locally running Docker containers

kubernetes

kubernetes

Deploys pipelines to any Kubernetes cluster with full control over resources, networking, and scaling

gcp

gcp

Deploys pipelines to Google Cloud Run for serverless execution

aws

aws

Deploys pipelines to AWS App Runner for serverless execution

huggingface

huggingface

Deploys pipelines to Hugging Face Spaces as Docker Spaces

If you would like to see the available flavors of deployers, you can use the command:

How to use it

You don't need to directly interact with the ZenML deployer stack component in your code. As long as the deployer that you want to use is part of your active ZenML stack, you can simply deploy a pipeline or snapshot using the ZenML CLI or the ZenML SDK. The resulting deployment can be managed using the ZenML CLI or the ZenML SDK.

Examples:

  • just use the default stack - it has a default local deployer that will deploy the pipeline on your local machine in the form of a background process:

  • or set up a new stack with a deployer in it:

  • deploy a pipeline with the ZenML SDK:

  • deploy the same pipeline with the CLI:

  • send a request to the deployment with the ZenML CLI:

  • or with curl:

  • alternatively, set up a snapshot and deploy it instead of a pipeline:

Pipeline Requirements for Deployment

Not all pipelines are suitable for deployment as HTTP services. To be deployable, pipelines should follow these guidelines:

Parameter Requirements:

  • Pipelines should accept explicit parameters with default values

  • Parameters must be JSON-serializable types (int, float, str, bool, list, dict, Pydantic models)

  • Parameter names should match step input names

Output Requirements:

  • Pipelines should return meaningful values for HTTP responses

  • Return values must be JSON-serializable

  • It's recommended to use type annotations to specify output artifact names

Example Deployable Pipeline:

For more information, see the Deployable Pipeline Requirements section of the tutorial.

Deployment Lifecycle Management

The Deployment object represents a pipeline that has been deployed to a serving environment. The Deployment object is saved in the ZenML database and contains information about the deployment configuration, status, and connection details. Deployments are standalone entities that can be managed independently of the active stack through the Deployer stack components that were originally used to provision them.

Some example of how to manage deployments:

  • listing deployments with the CLI:

  • listing deployments with the SDK:

  • showing detailed information about a deployment with the CLI:

  • showing detailed information about a deployment with the SDK:

  • deprovision and delete a deployment with the CLI:

  • deprovisioning and deleting a deployment with the SDK:

  • sending a request to a deployment with the CLI:

  • sending a request to a deployment with the SDK:

Specifying deployment resources

If your steps require additional hardware resources, you can specify them on your steps as described here.

Last updated

Was this helpful?