Python API and AI access

Guide · Technology

Updated

Browse documentation
On this page

Earlier command and setup reference · Engine 18.6.0rc590 / Reader 8.11.0rc649

Same rows, any reader

Programs and language models read the same published rows a person reads. Call the Python API, or open the file with any SQLite client. The query call runs one read-only statement on the tables you list, and nothing else.

Open the file and read it

import observatory as obs

results = obs.open_results(
    "out/observatory.sqlite", include_sensitive=True
)

# published rows, as a list of dicts
results.select(
    "duration_stats", where={"subject_kind": "activity"}
)

# read-only SQL on named tables, for one window and one stream
results.query_readonly(
    "SELECT o.outcome, COUNT(*) AS objects "
    "FROM objects o "
    "JOIN analysis_windows w ON w.scope_id = o.scope_id "
    "WHERE w.analysis_window = 'all' "
    "AND w.analysis_domain = 'process_flow' "
    "GROUP BY o.outcome",
    allowed_tables=["objects", "analysis_windows"],
)

Sensitivity is declared per table, and most tables are sensitive. Without include_sensitive=True, the API lists only analysis_windows, flow_days, rules and run. Explicit access to another table raises SensitiveOutputError, even if the selected columns identify no person. This flag guards the API, not the file: a SQLite client can read every table. The full call list is in the Python API reference.

Which model, where, and what it sees

Choose the model, where it runs and which data it may read. Connect it through the result file or the Python API, and configure access for that connection. Some regions limit how AI may be used on people at work, such as the EU AI Act (Regulation (EU) 2024/1689). A deployment can be modified by region, and that is consulting work. The options are on AI integration.