Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

rd_flex

Read-only

Estimates regression discontinuity treatment effects using cross-fit machine-learning residualisation of covariates, reducing outcome variance at the cutoff for more precise causal inference.

Instructions

RD with flexible covariate adjustment via cross-fit ML residualisation (Noack-Olma-Rothe 2025). Reduces variance of tau at the cutoff by subtracting an ML estimate of E[Y|W] before running rdrobust; consistent under free-of-cutoff continuity of eta, asymptotically efficient when eta converges to E[Y|X=c, W]. Assumptions: Continuity-based RD identification at the cutoff: potential outcomes are continuous in the running variable except for the treatment jump; Cross-fit ML residualisation of the outcome (and treatment, when fuzzy) on covariates only removes outcome variance and does not bias the cutoff estimate, requiring honest K-fold cross-fitting; Covariates predict the outcome well enough to shorten CIs relative to plain rdrobust; covariates are pre-determined (not affected by treatment). Pre-conditions: data has continuous running variable with adequate mass on both sides of the cutoff; Covariates list valid pre-treatment columns (or is empty/None to fall back to rdrobust); n_folds>=2 for genuine cross-fitting. Failure modes: Sparse data near the cutoff makes the local fit and learner unstable -> Widen the bandwidth via bwselect or collect more mass around the cutoff; Covariates...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
WNoCovariates used by the flexible adjustment
cNoc parameter (float).
xYesPrimary running variable, regressor, or feature input for this estimator.
yYesOutcome variable column name or outcome array.
alphaNoSignificance level for confidence intervals and tests.
fuzzyNofuzzy parameter (str).
detailNoPayload depth: 'minimal' (~150 tokens) for sub-step calls where only the point estimate is needed; 'standard' (~1K tokens) for diagnostics + coefficient table; 'agent' (~2K tokens, default) adds violations / next_steps / suggested_functions so the LLM can plan its next call without another round-trip.agent
kernelNoKernel function used for weighting or smoothing.triangular
learnerNoBuilt-in learnerboost
n_foldsNoCross-fit folds (1 disables CV)
as_handleNoIf true, cache the fitted result on the server and return result_id + result_uri alongside the JSON payload so a subsequent tools/call can chain without re-running.
data_pathYesAbsolute path or URL to a data file. Supported: .csv / .tsv / .txt (delimited), .parquet / .pq, .feather / .arrow, .xlsx / .xls, .dta (Stata), .json / .jsonl. Schemes: file://, s3://, gs://, https://.
result_idNoOptional handle to a previously-fitted result (returned by an earlier call when as_handle=true). Tools that operate on a fitted object accept this in place of re-supplying data_path + columns.
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
data_sample_nNoOptional uniform random subsample size (seed=0, deterministic) — useful on huge panels.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnlyHint/openWorldHint annotations, the description discloses the residualisation algorithm, consistency and efficiency conditions, the assumption that covariate adjustment does not bias the cutoff estimate, and concrete failure modes with actionable advice such as widening bandwidth or collecting more mass around the cutoff. This is substantial behavioral context that helps an agent anticipate how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded and well organized with Assumptions, Pre-conditions, and Failure modes sections, but it is long and the failure-modes section ends mid-sentence at 'Covariates...'. The detail is mostly relevant, but the incomplete final item is a structural flaw that prevents a higher score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 15-parameter RD estimator with an output schema and read-only annotations, the description covers the identification assumptions, the residualisation procedure, pre-conditions, and failure modes. The main gaps are the truncated final failure mode and the lack of explicit guidance on which sibling RD tool to prefer in specific situations; most parameter-level details are already present in the input schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already covers all 15 parameters, so the baseline is 3. The description adds meaningful semantics for W (must be pre-treatment columns; empty/None falls back to rdrobust), n_folds (>=2 needed for genuine cross-fitting), and fuzzy (treatment is also residualised). Other parameters like x, y, c, and kernel are already well described in the schema, so no further compensation is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies rd_flex as an RD estimator with flexible covariate adjustment via cross-fit ML residualisation, and it explains the mechanism: subtracting an ML estimate of E[Y|W] before running rdrobust. This distinguishes it from plain rdrobust and other RD variants, though it does not explicitly name a sibling alternative to contrast against.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives concrete pre-conditions: a continuous running variable with mass on both sides, valid pre-treatment covariates, and n_folds>=2 for genuine cross-fitting. It also states that an empty/None W falls back to rdrobust, providing a when-not signal. It does not directly compare rd_flex with other sibling RD tools such as rd_boost or rd_forest, so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools