guardian_review
Sanity-check a causal claim ("cause drove effect") before acting on it.
Provide exactly one of csv (CSV text), data (list of row objects) or
dataset_id (a dataset uploaded via guardian_request_upload; use this for
more than ~200 rows; single-use, deleted when reviewed) containing columns named by
cause and effect. Returns a verdict --
pass (act), caution (act carefully), or hold (do not act; the effect
looks confounded or unsupported) -- with the naive correlational effect versus the
confounder-adjusted causal effect and its confidence interval, the confounders
adjusted for, a confidence score, a plain-English interpretation, and a
recommended action, plus the estimator used and the inferred causal DAG. All numbers
are deterministic statistics (never LLM-generated); the LLM may only choose an
estimator id from a fixed whitelist and write the interpretation prose.
Args:
cause: Treatment column the claim says drives the outcome (e.g. "ad_spend").
effect: Outcome column (e.g. "new_customers").
csv: Dataset as CSV text (header row required).
data: Dataset as a list of row records (alternative to csv).
dataset_id: ID returned by guardian_request_upload after uploading the CSV
(alternative to csv/data; for datasets above ~200 rows). Single-use:
the dataset is deleted when reviewed, so re-upload to retry.
known_confounders: Columns to adjust for; otherwise discovered automatically.
context: Free-text business context, e.g. "Q3 promo evaluation". Accepted but
not currently used in the analysis or interpretation.
units: Display-only unit hints by column, e.g. {"ad_spend": "USD"}.
step: A concrete treatment step (e.g. 1000 for a $1,000 spend increase) to
restate the effect in business terms (cost per incremental outcome, ...).
time_col: Column to order rows by for time series (autocorrelation-robust
standard errors and adstock).
adstock: Opt-in geometric-adstock transform for a lagged/carryover treatment.
se: Standard-error flavor; "auto" diagnoses autocorrelation when time_col
is given.
test_design: true (or an options object) also returns how many periods a
spend-cut test needs to confirm the effect.
estimator: Primary-effect estimator. Omit (or "auto") to follow
config.estimator (default "rule": the deterministic choice); to let the
LLM choose, set config.estimator="llm" ("llm"/"rule" are NOT accepted
here); or force "ols_adjusted", "aipw", "ipw", "psm" or
"dml_forest" (always wins over config). The response reports the
estimator used (estimator.id, .source, .rationale, .fallback_reason)
and the inferred dag.
config: Per-step engine config, an object with optional keys cleaning,
discovery, estimator, summary, each "rule" (deterministic, no
LLM) or "llm". Defaults when omitted or partial: cleaning="llm",
discovery="llm", estimator="rule", summary="rule". The LLM never computes a
number: cleaning proposes derived columns / null-imputation strategies
(pandas computes the values), discovery prunes/orients the discovered DAG
(cause/effect are always yours), estimator picks a whitelisted id, summary
writes the prose ("rule", the default, is a fixed template that explains the
why with no AI). An "llm" step falls back to "rule" when the server has no
Gemini key or the call fails; the response's engine_steps reports
requested vs used per step with a fallback reason. Unknown keys or values
are rejected. Use all "rule" for a fully deterministic, reproducible run.
seed: Optional base random seed (default 42) for every seeded step; the seeds
used are returned in stamp.seeds.
cate: Opt-in list of dataset columns to stratify by for subgroup effects
(returned in cate); columns are validated against the dataset.
sensitivity: Opt-in; true also returns sensitivity checks (sensitivity).
Every response carries `stamp` (core/guardian versions, estimator, resolved
config, seeds, data_fingerprint) and `llm_decisions` (audit/replay records):
a changed answer with an unchanged `stamp.data_fingerprint` came from a Syl
release or config change, not from your data. Only cleaning/discovery/estimator
set to "llm" can change a number; summary never does.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"cause": "<cause>",
"effect": "<effect>"
},
"name": "guardian_review"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| se | No | Standard-error type. `auto` checks for autocorrelation and picks for you when `time_col` is given. `HAC` requires `time_col`. | auto |
| csv | No | Dataset as UTF-8 CSV text with a header row. For about 200 rows or fewer; above that use `dataset_id`. | |
| cate | No | Opt-in. Columns to split by for subgroup effects, returned in `cate`. Checked against the dataset. | |
| data | No | Dataset as row objects keyed by column name (alternative to `csv`). | |
| seed | No | Base random seed (default 42) for every seeded step. Seeds used come back in `stamp.seeds`. | |
| step | No | The proposed change in the cause (e.g. 500 for +$500 a period). Restates the effect at that size and adds `scaled_effect` and `business` (e.g. cost per incremental outcome). Omit to skip both. | |
| cause | Yes | Name of the treatment column the claim says drives the outcome (e.g. 'ad_spend'). Must exist in the dataset. | |
| units | No | Display-only unit labels by column, e.g. {'ad_spend': 'USD'}. Changes labels only, never a number. | |
| config | No | Chooses, per step (cleaning, discovery, estimator, summary), a fixed `rule` or `llm` help. Defaults llm / llm / rule / rule. A partial object is merged over defaults; unknown keys or values are rejected. An `llm` step falls back to `rule` if no LLM is available (`engine_steps` reports it). Only cleaning, discovery and estimator set to `llm` can change a number; set them to `rule` for strict reproducibility. | |
| effect | Yes | Name of the outcome column (e.g. 'conversion_value'). Must exist in the dataset. | |
| adstock | No | Opt-in carryover transform for a lagged cause such as ad spend. `time_col` is required. `decay` is a fixed value in [0, 1); omit to grid-search by AIC over `grid`. Returns `adstock`. | |
| context | No | Free-text note about the decision (e.g. 'Q3 promo evaluation'). Accepted but currently not used in the analysis or interpretation; it never changes a number. | |
| time_col | No | Date or period column. Rows are sorted by it; enables autocorrelation-robust standard errors (`se` auto/HAC) and sets the cadence for `test_design`. Must exist. | |
| estimator | No | `auto` or omitted follows `config.estimator` (default `rule`, a deterministic choice). A named estimator forces that method and overrides config. If not eligible for the data or it fails, Guardian uses the rule choice and reports why in `estimator.fallback_reason`. To let the LLM choose, set `config.estimator='llm'`; 'llm' and 'rule' are NOT accepted here. | |
| dataset_id | No | ID returned by `guardian_request_upload` after you upload the CSV. Use for more than about 200 rows. Usable only by the same API key and only once: deleted when reviewed, even if the review fails, and expires after 30 minutes. | |
| sensitivity | No | Opt-in. `true` also runs sensitivity checks (E-value, CI fragility), returned in `sensitivity`. | |
| test_design | No | `true` or an options object also returns `test_design`: how many periods a spend-cut test needs to confirm the effect. Deterministic. | |
| known_confounders | No | Columns that affect both cause and effect (e.g. seasonality, brand-query share). Always adjusted for, in addition to any discovered automatically. Each must exist. The name is `known_confounders`, not `confounders`. Never list downstream columns such as roas, clicks or conversions. |