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: more than 80% fewer errors than other popular packages.
  • One API: 28 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, pcmci, pcmciplus, lpcmci, granger 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.5.0},
  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.5.0

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.5.0
File Size Uploaded Provenance
andrey_core-0.5.0.tar.gz 343.6 kB With provenance Details

Built distribution (wheel)

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

Total release size: 749.3 kB

Release files / andrey_core-0.5.0.tar.gz

Download URL andrey_core-0.5.0.tar.gz
Size 343.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9ec7680d6c3812cd9753015cfc481d93a4979d04881608a59e30a789f8d8091d
BLAKE2b-256 checksum
How to use checksums
008d2c285e24d27dd01afd2be85d2041d9bdeb7981ecf51aaa8e8c4eff456005
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 16, 2026.

Transparency log

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

Download URL andrey_core-0.5.0-py3-none-any.whl
Size 405.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6fa299aef19064c3609bea7733cf179b726ccd809f8bd8170b2094450dd89cd
BLAKE2b-256 checksum
How to use checksums
2145cfa42b6ed75b9c12d3af12f414139d2744aafdec8330257ef880fd5dd61b
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 16, 2026.

Transparency log

Security for andrey-core 0.5.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for andrey_core-0.5.0.tar.gz

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 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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