Pipelines | Clarifai Docs

Orchestrate asynchronous, long-running, multi-step AI processes

Clarifai Pipelines let you design and run asynchronous, long-running, multi-step processes for complex AI and MLOps tasks. They act as the orchestration backbone for building advanced AI agents and managing end-to-end machine learning operations.

Pipelines enable you to define, execute, and monitor container-based jobs directly on the Clarifai platform, giving you fine-grained control over each step.

With Clarifai Pipelines, you get a scalable, end-to-end automation engine that simplifies and unifies your entire MLOps lifecycle.

Explore a collection of ready-to-use ML pipeline templates for training, evaluating, and running models on the Clarifai platform in our Examples repository. See the Training Models documentation to learn how to use the pipeline templates to train different types of models.

Why Clarifai Pipelines

Use Cases for Pipelines

Clarifai Pipelines support a wide range of AI and MLOps workflows. Here are some common use cases:

Quick Start

The fastest way to get a working pipeline is to scaffold one from a template, upload it, and run it. The lora-pipeline-unsloth-quick-start template fine-tunes an LLM with LoRA — all parameters are pre-set to sensible defaults so the first run works without edits.

Install and Authenticate

Install the latest clarifai SDK (which also installs the CLI) and set your Personal Access Token (PAT):

pip install --upgrade clarifai
export CLARIFAI_PAT=YOUR_PERSONAL_ACCESS_TOKEN_HERE
pip install --upgrade clarifai
set CLARIFAI_PAT=YOUR_PERSONAL_ACCESS_TOKEN_HERE

Scaffold a Pipeline From a Template

clarifai pipeline init --template lora-pipeline-unsloth-quick-start
cd lora-pipeline-unsloth-quick-start

This creates a working LoRA fine-tuning project that trains unsloth/Qwen3-0.6B on the mlabonne/FineTome-100k dataset using Unsloth — with num_epochs, learning_rate, LoRA rank, sequence length, and other hyperparameters all pre-configured. No edits required to run the first time.

Tip: Browse all available starter templates with clarifai pipelinetemplate list. See the Templates page for the full catalog.

Upload and Run

clarifai pipeline upload
clarifai pipeline run --instance=g5.xlarge

The pipeline fine-tunes the model on a single-GPU instance (the template's compute step requests num_accelerators: 1 with a NVIDIA-* GPU). --instance=g5.xlarge auto-provisions a compute cluster and nodepool — no separate cluster setup required, and the same nodepool can later serve inference for the fine-tuned model.

That's it — you have a fine-tuned model registered in your Clarifai model registry, ready to serve, evaluate, or refine further.

Two upload paths:

The LoRA template ships with both a YAML scaffold (config.yaml) and a Python DSL form (dsl.py). The default clarifai pipeline upload uses the YAML scaffold. To upload from the DSL Python file instead:

clarifai pipeline upload dsl.py

Both paths produce the same pipeline. The YAML config is convenient for explicit, version-controlled configuration. The Pipeline DSL is convenient for code-first authoring with type hints, @step decorators, and >> DAG composition. Use whichever fits your team.

Customize Before Running

To override defaults at init time, pass --set key=value flags. For example, to fine-tune a different base model and change the number of epochs:

clarifai pipeline init --template lora-pipeline-unsloth-quick-start \
--set base_model_name="unsloth/Llama-3.2-1B-Instruct" \
--set num_epochs=3

Or cd into the scaffolded directory and edit config.yaml directly. See Templates for the full reference on --template, --set, and template discovery.

Author a Pipeline From Scratch in Python

For custom workflows that don't fit a template, use the Pipeline DSL — write @step-decorated Python functions, compose them into a DAG, and upload directly from a .py file. See the DSL reference for the full API.

Where to Go Next

Pipeline outputs → Artifacts

Pipeline runs produce Artifacts — versioned, addressable binary outputs such as model checkpoints, training logs, embeddings, or datasets. Once a pipeline run completes, its outputs can be managed, downloaded, and reused via the artifacts CLI and SDK without re-running the pipeline. See the Artifacts documentation for managing pipeline-produced outputs.