Understanding Artifacts
Every output from a step becomes an artifact:- Serializes outputs and stores them
- Versions each artifact
- Tracks lineage (which step produced it)
- Links artifacts to pipeline runs
Naming Artifacts
from typing import Annotated
@step
def train_model() -> Annotated[object, "trained_model"]:
"""Produces an artifact named 'trained_model'."""
model = {"weights": [1, 2, 3]}
return model
from zenml import step, ArtifactConfig
from typing import Annotated
@step
def train_model() -> Annotated[
object,
ArtifactConfig(
name="production_model",
version=42,
tags=["production", "v2"]
)
]:
"""Produces a configured artifact."""
model = {"weights": [1, 2, 3]}
return model
from zenml import step, ArtifactConfig
from typing import Annotated
@step
def train_model() -> Annotated[
object,
ArtifactConfig(
name="model_{date}_{time}",
)
]:
"""Creates artifacts like 'model_20260309_143022'."""
model = {"weights": [1, 2, 3]}
return model
Artifact Configuration
Adding Tags
Tag artifacts for easy discovery:Setting Artifact Type
Specify the semantic type of an artifact:Adding Metadata
Attach metadata to artifacts:Multiple Artifacts
Return multiple artifacts from a single step:Loading Artifacts
From the Client
Load artifacts using the ZenML client:From Step Context
Access artifacts from previous runs:From Previous Pipeline Runs
Load artifacts from specific pipeline runs:Artifact Versioning
ZenML automatically versions artifacts:Version Promotion Workflow
Searching Artifacts
Find artifacts using filters:Artifact Lineage
Track where artifacts come from and where they’re used:Artifact Visualization
Some artifacts can be visualized in the ZenML dashboard:Best Practices
Use Descriptive Names
Give artifacts clear, meaningful names that describe their contents
Tag Consistently
Use a consistent tagging strategy across your team
Add Rich Metadata
Attach relevant metadata to help track experiments and results
Version Strategically
Use explicit versioning for important artifacts
Clean Up Old Artifacts
Periodically remove unused artifacts to save storage
Document Artifact Structure
Document the schema/structure of complex artifacts
Artifact Storage
Artifacts are stored in the artifact store configured in your stack:Troubleshooting
Artifact Not Found
If you can’t find an artifact:Loading Fails
If artifact loading fails, check:- Artifact store is accessible
- Required dependencies are installed
- Artifact hasn’t been deleted
Next Steps
Writing Steps
Learn how to create steps that produce artifacts
Step Context
Access artifacts within step execution
Stack Configuration
Configure artifact stores for your pipelines
