Skip to main content

Andrey, a very fast causal discovery package

PyPI version CI status Python 3.11, 3.12, 3.13, 3.14 License: Apache 2.0

Andrey is a causal discovery package for Python.

  • Fast: Over 1,000x faster on PNL, and faster on most other supported methods.
  • Accurate: up to 89% fewer errors than other popular packages.
  • One API: 24 methods, each one function call.
  • Agent-ready: a command line that answers in JSON, and a skill for coding agents.
uv add andrey-core
  • With pip: pip install andrey-core
  • Optional extras: andrey-core[numba] for compiled CPU code, andrey-core[torch] for GPUs
  • Development version: uv add git+https://github.com/Abel-ai-lab/andrey
  • Installation guide: the extras, a PyTorch build for your GPU, and building Andrey from source

Andrey's speedup over the slowest package on the same data: PC 941x at 400 variables,
      Tabu search 561x at 800 variables, XGES 140x at 200 variables, DirectLiNGAM 8.9x at 100
      variables, FCI 8.7x at 800 variables, GES 4.3x at 150 variables

Release cards

Four ideas make it fast; each is animated in a blog post:

  • Do many things at once: thousands of independence tests run as one array operation, with the same results.
  • Never compute twice: the correlation matrix is computed once and cached; GES memoizes its local scores.
  • Skip what can't matter: tests with a closed form settle most edges before any matrix is inverted.
  • Use the hardware you have: with the optional extras, Numba compiles GES's path checks and a GPU computes large tables.

What's inside

Family Methods Returns
Constraint-based pc, fci, gfci*, cdnod* CPDAG, PAG
Score-based ges, gies*, xges, hc, tabu, exact_search*, calm* CPDAG, DAG
Permutation-based boss, grasp CPDAG
Linear non-Gaussian direct_lingam, ica_lingam, multi_group_direct_lingam* DAG
Time series varma_lingam*, longitudinal_lingam* Temporal graph
Latent variables gin*, rcd, camuv*, bottom_up_parce_lingam DAG, PAG
Pairwise direction anm, pnl Two-node DAG

* Experimental: no published benchmark yet, and the API may change.

Quick start

Learn the protein-signaling network of Sachs et al. (2005) from 853 cells, and score it against the known network:

import andrey
from andrey.data import load_dataset
from andrey.metrics import score

sachs = load_dataset("sachs")  # 853 cells, 11 proteins, and the known network
out = andrey.pc(sachs.data)    # learn a graph
print(out)

scores = score(out.structure, sachs.graph)
print({k: round(scores[k], 2) for k in ("shd", "skeleton_precision", "skeleton_recall")})
PC  cpdag  |  11 nodes  |  8 edges (6 undirected, 2 directed)

  raf -- mek
  plc -- pip3
  pip2 -- pip3
  erk -- akt
  erk -- pka
  akt -- pka
  p38 -> pkc
  jnk -> pkc
{'shd': 11, 'skeleton_precision': 1.0, 'skeleton_recall': 0.47}

PC finds 8 edges, all among the known network's 17. The structural Hamming distance (SHD) counts the edges to add, remove, or reorient to reach the known network: 11 here (9 edges are missing, and 2 are oriented that the known network leaves undirected), and 17 for a graph with no edges.

For your own data, pass a pandas DataFrame or a NumPy array: one row per sample, one column per variable. From a shell or an agent:

andrey run pc --data your_data.csv   # JSON when piped, a summary in a terminal

To give your coding agent Andrey's skill, paste this prompt into it:

Install Andrey's agent skill: make sure the andrey-core package is installed, run
`andrey --skill`, and save its output as andrey/SKILL.md in your skills folder.

Learn more

Andrey is in alpha: the API may change between releases, so pin the version you use. Linux is fully tested; macOS and Windows install and run on the CPU, but the full test suite and the GPU speedups (CUDA / MPS) are not tested there yet.

Citing, license, contributing

If you use Andrey in your work, please cite it, or use the citation file:

@software{andrey,
  author = {{Abel AI Lab}},
  title = {Andrey: A very fast causal discovery package},
  year = {2026},
  version = {0.4.1},
  url = {https://andrey.abel.ai},
}

Andrey is released under the Apache License 2.0. Bug reports and pull requests are welcome in the issue tracker; the contributing guide explains how to set up a development environment.

Andrey is inspired by causal-learn, pgmpy, Tetrad, and many other causal discovery packages.

Metadata

Release files for andrey-core 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for andrey-core 0.4.1
File Size Uploaded
andrey_core-0.4.1.tar.gz 308.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for andrey-core 0.4.1
File Interpreter ABI Platform
andrey_core-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 675.3 kB

Release files / andrey_core-0.4.1.tar.gz

Download URL andrey_core-0.4.1.tar.gz
Size 308.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ac8a3766ce6a3604ab0aba7abbc7183a7e9456a63919b8d552882f649b3aba5d
BLAKE2b-256 checksum
How to use checksums
0abd33292a04f207997cd8abff7e33f06650f0c2c41380efc244bd59bb36ccbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / andrey_core-0.4.1-py3-none-any.whl

Download URL andrey_core-0.4.1-py3-none-any.whl
Size 367.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
efb2261e79f51ec4ef4b2d702e813ba4691f745d604b4fe063e6b99744d505e8
BLAKE2b-256 checksum
How to use checksums
d44df24b33043b9c692df3dfe3ffbc2d3fc21ed9fe619e2947db645566cd21ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page