The Problem
ML teams building LLM workflows and agents face a split: pipelines run in one framework, agents in another, and production infrastructure is a third system. ZenML addresses this by providing a single platform where you define pipelines and agent loops as Python code, then run them on any backend—local, cloud, or Kubernetes—without rewriting the workflow.
What This Does
ZenML is a workflow orchestration platform for ML and AI engineering. The core library lives in src/zenml/ (1,310 files) and lets you define pipelines, steps, and stacks. It containerizes your code, tracks runs with metrics and metadata, and abstracts infrastructure via integrations with MLflow, LangGraph, Langfuse, SageMaker, and Vertex AI.
The repo includes extensive examples (examples/, 394 files) covering agent frameworks (LangChain, CrewAI, AutoGen, Haystack), computer vision, and end-to-end NLP. A Helm chart (helm/) and Dockerfiles (docker/) support self-hosted deployment. The docs (docs/, 820 files) are comprehensive, and there are 692 test files.
How It Is Wired
The import graph shows 1,477 internal modules with 183 edges. The hub module is tests/unit/test_general, with 31 modules depending on it—high blast radius for changes. Ten modules participate in circular imports, including tests/harness/model/__init__.py and tests/harness/deployment/client_sqlite.py; breaking these cycles requires extracting shared types or deferring imports.
Entry points are example-driven. examples/e2e_nlp/gradio/app.py is a Gradio UI for an NLP pipeline; examples/deploying_agent/steps/ingest.py shows the agent ingestion flow. The steps/__init__.py files across examples/mlops_starter, examples/e2e_nlp, and examples/e2e each import 8 modules—these are the pipeline definition points.
Execution flows: pipeline definitions in steps/ → orchestration in src/zenml/ → infrastructure via integrations. The src/zenml/integrations/ directory contains adapters for external systems. The src/zenml/zen_stores/ handles persistence. A run touches the database through the store layer, with the deployment client in tests/harness/deployment/client_sqlite.py (in a cycle) managing SQLite state.
How To Use It
# Clone and install
git clone https://github.com/moses-y/zenml
cd zenml
pip install -e .
# Run an example pipeline
cd examples/e2e_nlp
python run.py
Configuration uses ZenML's stack concept—define a stack in zenml stack init and register backends. The pyproject.toml declares 15 dependencies, but there is no lockfile, so installs are not reproducible. The examples/*/requirements.txt files define per-example dependencies. For containerized deployment, use the Dockerfiles in docker/ or the Helm chart in helm/.
Real-World Use
A team building a customer-support agent with LangGraph could define a pipeline in src/zenml/, use the LangGraph integration from examples/agent_framework_integrations/langgraph/, track runs with Langfuse (declared dependency), and deploy to a Kubernetes stack via the Helm chart. The same pipeline runs locally for development and on production infrastructure without code changes.
Code Health & Issues
Static analysis found 88 findings (17 high, 71 medium) across 6 categories. Key issues:
- High - Hub module -
tests/unit/test_general.py: 31 modules depend on it; volatile changes have wide impact. - High - Import cycles - 10 modules in circular dependencies, including
tests/harness/model/__init__.pyandtests/harness/deployment/client_sqlite.py. - High - Deep nesting - 25 instances of indentation depth 6+, notably
tests/harness/deployment/client_sqlite.py. - High - Duplicated code - 271 repeated 6-line blocks across 744 files, including
src/zenml/integrations/skypilot/__init__.py. - Medium - Broad exception handling - 7 instances, e.g.,
examples/deploying_agent/steps/ingest.py. - Medium - Unmanaged file handles - 16 instances of
open()without context managers.
Code health audit adds: High - no lockfile for pyproject.toml; Medium - mutable base image python:3.9 in examples/e2e_nlp/gradio/Dockerfile; Medium - 7 blobs over 5MB in the repo (largest: 13.7MB GIF). Committed secrets flagged as present—verify before deploying.
The Bottom Line
ZenML is a mature, widely adopted platform (5,500+ stars upstream) with strong docs and integrations. The codebase has real maintainability debt—cycles, deep nesting, duplication—but the architecture is sound for production ML workflows. Teams needing a portable pipeline layer across cloud backends will benefit; those wanting minimal dependencies should look elsewhere.