datachain is a free, open source machine learning infrastructure project written in Python and released under Apache-2.0. It has 2,819 GitHub stars, 157 forks and 101 open issues, and was last pushed 10 hours ago. On this registry it ranks #40 of 57 tracked projects in Machine Learning Infrastructure, with 5 head-to-head comparisons available.

What is datachain?

DataChain is an Apache-2.0 Python library that turns files in S3, GCS, and Azure into versioned, typed datasets queryable at warehouse speed, and it is built for data and machine learning teams handling unstructured data as well as for the AI coding agents that operate on those datasets.

What it is

DataChain is a Python library described as the context layer for unstructured data. It reads files from S3, GCS, Azure, and local filesystems and turns them into named, versioned, typed datasets. It combines a compute engine that runs parallel Python over files with a Dataset DB holding Pydantic schemas, versioning, file pointers, and automatic lineage. Optional pieces extend it: a Knowledge Base of LLM-enriched markdown summaries and an Agent Harness that plugs the system into agent tools. Documentation sits at docs.datachain.ai, and the project lives in the Python machine learning infrastructure ecosystem.

The problem it solves is that unstructured files in object storage have no schema, versioning, or cheap query path. A dataset is the unit of work: the named, versioned result of a pipeline, which later runs read instead of recomputing. Embedding steps, metadata joins, and quality filters are built once and reused, and the Dataset DB supports sub-second filter, join, and group_by over millions of typed records locally. In place of ad-hoc scripts that rescan a bucket on every pass, DataChain leaves typed datasets behind.

Key capabilities

  • The compute engine runs parallel Python over files with async I/O, checkpoint recovery, and incremental updates, distributed on Studio.
  • The Dataset DB holds Pydantic schemas, versioning, file pointers, and automatic lineage.
  • Filter, join, and group_by run sub-second over millions of typed records locally and over hundreds of millions on Studio.
  • Vector search runs over the same rows, so no separate vector store is needed.
  • The Knowledge Base derives markdown summaries from the Dataset DB, enriched by an LLM and browsable with wikilinks, including in Obsidian.
  • The Agent Harness plugs the compute engine, Dataset DB, and Knowledge Base into Claude Code, Cursor, Codex, GitHub Copilot, and Pi; on Studio, agents reach the same datasets over MCP.
  • Chain operations such as read_storage, map, and save expose the pipeline to agents, and bytes never leave the user's storage.

Who uses it and how

  • Data and machine learning teams keeping unstructured files in S3, GCS, or Azure that want typed, versioned datasets instead of repeated bucket scans.
  • Agent workflows where Claude Code, Cursor, Codex, GitHub Copilot, or Pi decompose a task into steps saved as named, versioned datasets that later questions reuse.
  • Teams that need vector search over the same records they already filter, join, and group.
  • Workloads from local scale, filtering millions of typed records locally, up to Studio, handling hundreds of millions.

Getting started

Install with pip install datachain, and optionally add the agent skill with datachain skill install --target claude, which also accepts cursor, codex, copilot, and pi.

How it compares

No competing data product is named in the provided facts, so no contrast on licence, hosting, or cost model is possible. The named tools, Claude Code, Cursor, Codex, GitHub Copilot, and Pi, are agent harnesses that DataChain plugs into rather than replaces, so on this evidence it stands alone in this registry.

When to use it — and when not

A self-hoster runs a Python library and supplies access to their own object storage, over S3, GCS, Azure, or local filesystems, and the guarantee that bytes never leave that storage favours data ownership. Runs at the hundreds-of-millions scale depend on Studio, which is separate from the open-source library, so teams avoiding a hosted tier should plan around local limits. Teams without unstructured data in object storage, or wanting a fully managed service with no Python operations, are poor fits, and with 101 open issues and a README that is largely a quickstart, production operating details are not spelled out here.

project readme (upstream, from github) — read inline

DataChain DataChain: The Context Layer for Unstructured Data

PyPI Python Version Codecov Tests DeepWiki

A Python library that turns files in S3, GCS, and Azure into versioned, typed datasets, queryable at warehouse speed.

  • Compute Engine: parallel Python over files, distributed on Studio. Async I/O, checkpoint recovery, incremental updates.
  • Dataset DB: Pydantic schemas, versioning, file pointers, automatic lineage. Sub-second filter, join, and group_by over millions of typed records locally, hundreds of millions on Studio. Vector search over the same rows, no separate store.

Optional, for agent workflows:

  • Knowledge Base: markdown summaries derived from the Dataset DB and enriched by LLM. Readable by humans and LLMs.
  • Agent Harness: a skill that plugs all three into Claude Code, Cursor, Codex, GitHub Copilot, and Pi, so they understand your data. On Studio, agents reach the same datasets over MCP.

Bytes never leave your storage. Every run deposits a typed dataset the next pipeline (or agent) reads instead of recomputing.

1. Install

pip install datachain

To add the agent skill (Knowledge Base + code generation):

datachain skill install --target claude     # also: cursor, codex, copilot, pi

Works with S3, GCS, Azure, and local filesystems.

2. Quickstart: agent-driven pipeline

Task: find dogs in S3 similar to a reference image, filtered by breed, mask availability, and image dimensions.

Grab a reference image and run Claude Code (or other agent):

datachain cp --anon s3://dc-readme/fiona.jpg .

claude

Prompt:

Find dogs in s3://dc-readme/oxford-pets-micro/ similar to ./fiona.jpg:
  - Pull breed metadata and mask files from annotations/
  - Exclude images without mask
  - Exclude Cocker Spaniels
  - Only include images wider than 400px

Result:

  ┌──────┬───────────────────────────────────┬────────────────────────────┬──────────┐
  │ Rank │               Image               │           Breed            │ Distance │
  ├──────┼───────────────────────────────────┼────────────────────────────┼──────────┤
  │    1 │ shiba_inu_52.jpg                  │ shiba_inu                  │    0.244 │
  ├──────┼───────────────────────────────────┼────────────────────────────┼──────────┤
  │    2 │ shiba_inu_53.jpg                  │ shiba_inu                  │    0.323 │
  ├──────┼───────────────────────────────────┼────────────────────────────┼──────────┤
  │    3 │ great_pyrenees_17.jpg             │ great_pyrenees             │    0.325 │
  └──────┴───────────────────────────────────┴────────────────────────────┴──────────┘

  Fiona's closest matches are shiba inus (both top spots), which makes sense given her
  tan coloring and pointed ears.

The agent decomposed the task into steps - embeddings, breed metadata, mask join, quality filter - and saved each as a named, versioned dataset. Next time you ask a related question, it starts from what's already built.

The datasets are registered in a Knowledge Base optimized for both agents and humans:

dc-knowledge
├── buckets
│   └── s3
│       └── dc_readme.md
├── datasets
│   ├── oxford_micro_dog_breeds.md
│   ├── oxford_micro_dog_embeddings.md
│   └── similar_to_fiona.md
└── index.md

Browse it as markdown files, navigate with wikilinks, or open in Obsidian:

Visualize data Knowledge Base

3. Data Harness

Code harnesses (Claude Code, Cursor, Codex, GitHub Copilot, Pi) give agents repo context, dedicated tools, and memory across sessions. DataChain adds the same for data: typed datasets the agent reads, chain operations the agent calls (read_storage, map, save), a Dataset DB where its results persist.

A dataset is the unit of work - a named, versioned result of a pipeline step like [email protected]. Every .save() registers one.

For the data-flow architecture (Compute Engine, Dataset DB, Knowledge Base) and how the components connect, see Architecture.

4. Core concepts

4.1. Dataset

A dataset is a versioned data reasoning step - what was computed, from what input, producing what schema. DataChain indexes your storage into one: no data copied, just typed metadata and file pointers. Re-runs only process new or changed files.

Create a dataset manually create_dataset.py:

from PIL import Image
import io
from pydantic import BaseModel
import datachain as dc


class ImageInfo(BaseModel):
    width: int
    height: int


def get_info(file: dc.File) -> ImageInfo:
    img = Image.open(io.BytesIO(file.read()))
    return ImageInfo(width=img.width, height=img.height)


ds = (
    dc.read_storage(
        "s3://dc-readme/oxford-pets-micro/images/**/*.jpg",
        anon=True,
        update=True,
        delta=True,  # re-runs skip unchanged files
    )
    .settings(prefetch=64)
    .map(info=get_info)
    .save("pets_images")
)
ds.show(5)

[email protected] is now the shared reference to this data - schema, version, lineage, and metadata.

Every .save() registers the dataset in the Dataset DB, DataChain's persistent store for schemas, versions, lineage, and processing state, kept locally in SQLite DB .datachain/db. Pipelines reference datasets by name, not paths. When the code or input data changes, the next run bumps dataset version.

This is what makes a dataset a management unit: owned, versioned, and queryable by everyone on the team.

4.2. Schemas and types

DataChain uses Pydantic to define the shape of every column. The return type of your UDF becomes the dataset schema - each field a queryable column in the Dataset DB.

show() in the previous script renders nested fields as dotted columns:

                                          file    file  info   info
                                          path    size width height
0  oxford-pets-micro/images/Abyssinian_141.jpg  111270   461    500
1  oxford-pets-micro/images/Abyssinian_157.jpg  139948   500    375
2  oxford-pets-micro/images/Abyssinian_175.jpg   31265   600    234
3  oxford-pets-micro/images/Abyssinian_220.jpg   10687   300    225
4    oxford-pets-micro/images/Abyssinian_3.jpg   61533   600    869

[Limited by 5 rows]

print(ds.schema) renders its schema:

file: File@v1
  source: str
  path: str
  size: int
  version: str
  etag: str
  is_latest: bool
  last_modified: datetime
  location: Union[dict, list[dict], NoneType]
info: ImageInfo
  width: int
  height: int

Models can be arbitrarily nested - a BBox inside an Annotation, a List[Citation] inside an LLM Response - every leaf field stays queryable the same way. The schema lives in the Dataset DB and is enforced at dataset creation time.

The Dataset DB handles datasets of any size - 100 millions of files, hundreds of metadata rows - without loading anything into memory. Pandas is limited by RAM; DataChain is not. Export to pandas when you need it, on a filtered subset:

import datachain as dc

df = dc.read_dataset("pets_images").filter(dc.C("info.width") > 500).to_pandas()
print(df)

4.3. Fast queries

Filters, aggregations, and joins run as vectorized operations directly against the Dataset DB - metadata never leaves your machine, no files downloaded.

import datachain as dc

cnt = (
    dc.read_dataset("pets_images")
    .filter(
        (dc.C("info.width") > 400)
        & ~dc.C("file.path").ilike("%cocker_spaniel%")  # case-insensitive
    )
    .count()
)
print(f"Large images with Cocker Spaniel: {cnt}")

Milliseconds, even at 100M-file scale.

Large images with Cocker Spaniel: 6

5. Resilient Pipelines

When computation is expensive, bugs and new data are both inevitable. DataChain tracks processing state in the Dataset DB - so crashes and new data are handled automatically, without changing how you write pipelines.

5.1. Data checkpoints

Save to embed.py:

import open_clip, torch, io
from PIL import Image
import datachain as dc

model, _, preprocess = open_clip.create_model_and_transforms(
    "ViT-B-32", "laion2b_s34b_b79k"
)
model.eval()

counter = 0


def encode(file: dc.File, model, preprocess) -> list[float]:
    global count

readme truncated — read the full docs on github

Frequently asked questions

Is datachain free to use?

datachain is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does datachain do?

The Context Layer for unstructured data: typed, versioned datasets over S3, GCS, Azure

What is datachain written in?

datachain is primarily written in Python. Its source is publicly available at https://github.com/datachain-ai/datachain, and it has 2,819 GitHub stars.