> For the complete documentation index, see [llms.txt](https://docs.rootcause.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rootcause.ai/api-and-integrations/sdk-getting-started/sdk-api-reference.md).

# Python API Reference

RootCause SDK: causal discovery, digital twins, and ontology queries from Python.

Two modes, one object model:

```python
import rootcause as rc
rc.login()

ws = rc.workspace("Calix Forecasting")            # platform mode
twin = ws.twin("C8 Temporal")
twin.forecast(horizon=24).to_frame()

graph = rc.discover(df, target="re78")            # direct mode — no workspace ceremony
twin = graph.train()
twin.intervene({"treat": rc.set(1)}, where={"re75": ("<", 5000)})
```

Conventions throughout: every long-running call blocks with a progress line and raises `JobFailedError` on failure; everything tabular answers `to_frame()`; names resolve case-insensitively, with close-match suggestions on a miss.

Every failure is a `RootCauseError` carrying one readable sentence and the thing to try next — arguments are checked before a request goes out, and no call raises an httpx, pyarrow or KeyError traceback of its own.

* [Module functions](/api-and-integrations/sdk-getting-started/sdk-api-reference/module-functions.md): The module-level session and the direct-mode entry points.
* [Workspaces and data](/api-and-integrations/sdk-getting-started/sdk-api-reference/workspaces.md): Workspaces and what lives in them: sources, datasets, connectors.
* [Twin](/api-and-integrations/sdk-getting-started/sdk-api-reference/twin.md): Digital twins: forecast, simulate, intervene, score, update.
* [Graph](/api-and-integrations/sdk-getting-started/sdk-api-reference/graph.md): Discovered causal graphs, and the domain knowledge pinned onto them.
* [Results](/api-and-integrations/sdk-getting-started/sdk-api-reference/results.md): The result objects twin operations hand back.
* [Ontology](/api-and-integrations/sdk-getting-started/sdk-api-reference/ontology.md): Ontology concepts and queries over them.
* [Interventions](/api-and-integrations/sdk-getting-started/sdk-api-reference/interventions.md): The intervention and metric helpers.
* [Notebook apps](/api-and-integrations/sdk-getting-started/sdk-api-reference/notebook-apps.md): Notebook host for the platform's interactive app bundles. Requires the `jupyter` extra.
* [Exceptions](/api-and-integrations/sdk-getting-started/sdk-api-reference/exceptions.md): The exception hierarchy every call raises from.
