rootcause-sdk
RootCause is a causal AI platform: bring your data, discover causal structure, train digital twins, and ask what-if questions. This is the official Python SDK. Full docs: docs.rootcause.ai.
Installation
pip install rootcause-sdk
Quick start
import rootcause as rc
import pandas as pd
rc.login() # ROOTCAUSE_API_KEY, or browser login
df = pd.read_csv("lalonde.csv")
graph = rc.discover(df, target="re78") # causal discovery on a DataFrame
graph.pin("treat", "re78") # domain knowledge
twin = graph.train()
ate = twin.intervene({"treat": rc.set(1)}, where={"re75": ("<", 5000)})
ate.summary
Nothing above mentions a workspace: direct mode keeps platform ceremony out of sight and reuses uploads by content hash.
Platform mode
The same classes work against everything your team builds in the RootCause UI:
ws = rc.workspace("Calix Forecasting")
ws.sources["shipments"].to_frame() # tab-completes live names
ws.upload(df, name="shipments-v2")
twin = ws.twin("C8 Temporal") # trained by a colleague — just there
fc = twin.forecast(horizon=24)
fc.to_frame() # tidy long format, straight to pandas
twin.ask("what happens to bookings if we cut trade shows entirely?")
The power-user primitive
Every simulation family is a wrapper over conditional sampling. The SDK exposes it raw:
draws = twin.sample(n=10_000, do={"price": rc.pct(+10)}, where={"region": "FL"}, seed=42)
draws.to_frame() # one row per joint posterior draw
Interventions: rc.set(value), rc.pct(+15), rc.add(-5), rc.prob("yes", 0.8), rc.adjust_prob("yes", +10), rc.members(include=[...], size=4). Bare values mean rc.set. Conditions: {"region": "EMEA"} or {"re75": ("<", 5000)}.
Ontology queries
onto = ws.ontology
onto.concepts
result = onto.query(
select=["customer", "revenue"],
where=[("region", "==", "US")],
group_by=["customer"],
order_by="-revenue",
aggregate={"revenue": "sum"},
)
result.to_frame()
onto.ask("average revenue per customer in Florida last quarter")
Portable twins
twin.save("c8.rctwin") # export zip with trained model params
twin2 = rc.load_twin("c8.rctwin") # later, anywhere, same auth
Authentication
rc.login() resolves credentials in order: explicit api_key="pk_…" → ROOTCAUSE_API_KEY / ROOTCAUSE_BASE_URL env vars → cached OAuth token in ~/.rootcause/ → interactive browser login (PKCE; remote kernels get a paste-the-code fallback). Create API keys under Organisation → API on your platform.
Releasing
Publishing to PyPI is driven entirely by git tags. The tag is the version — pyproject.toml
is patched in CI at build time, so don't bother bumping it by hand.
-
Push a tag matching
MAJOR.MINOR.PATCH(pre-releases like1.2.0rc1also work):git tag 0.2.0 && git push origin 0.2.0
-
The
buildjob builds the sdist + wheel and runstwine check --strict. -
Trigger the
publishjob (manual) to release to PyPI.
Required CI variable
Set as a masked and protected project-level variable in GitLab (Settings → CI/CD → Variables):
| Variable | Purpose |
|---|---|
PYPI_API_TOKEN |
PyPI API token (pypi-...), scoped to this project |
It is passed to twine as the password with username __token__; nothing is
hardcoded in the pipeline.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rootcause_sdk-1.0.0.tar.gz.
File metadata
- Download URL: rootcause_sdk-1.0.0.tar.gz
- Upload date:
- Size: 102.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be437e92264ae4afa5b8df77a28fa15169393298002e3587a86a941ed3a2bd98
|
|
| MD5 |
4e0e07a5687cce5ee04f93c8b7a14317
|
|
| BLAKE2b-256 |
054e6f892735425e144068638d0846a4cfef666b7f4c69b1a1756cd295a80365
|
File details
Details for the file rootcause_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rootcause_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a7fa5860e13b44b540bc43ea652d17f2c56a4b6f20c4e149ba81fadb7e6731c
|
|
| MD5 |
d781cc8c9794687f08f5144b0e6ffb66
|
|
| BLAKE2b-256 |
df809992be2283795cb68ee0024a0c8f20ace486857b7bb6968d9eb3de47924f
|