Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

aipw

Read-only

Estimate causal average treatment effects via doubly-robust augmented inverse-probability weighting, combining cross-fitted outcome regression and propensity models for consistent results under unconfoundedness.

Instructions

Augmented inverse-probability weighting (AIPW) -- the canonical doubly-robust ATE estimator. Cross-fits an outcome regression and a propensity model and combines them via the efficient-influence-function formula, so the estimate is consistent if either nuisance is correctly specified (Robins, Rotnitzky & Zhao 1994). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness conditional on covariates (Y(0), Y(1) perp D | X); Overlap / common support: 0 < e(X) < 1 for all X with positive density; SUTVA. Pre-conditions: binary treatment column with both arms present; covariates must contain all confounders for unconfoundedness; no perfect overlap violations (0 < propensity < 1 in support). Failure modes: Propensity scores cluster near 0 or 1 -> Trim to overlap region with sp.trimming() or switch to overlap-weighted ATE; Cross-fit estimate has very wide CI -> Increase n_folds or reduce covariate dimension; check for near-empty propensity strata. Alternatives: sp.ipw, sp.dml, sp.tmle, sp.matching. Typical minimum N: 200.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable
seedNoRandom seed for reproducible stochastic steps.
alphaNoSignificance level for confidence intervals and tests.
treatYesBinary treatment (0/1)
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
n_foldsNoCross-fitting folds (>= 2)
estimandNoTarget estimandATE
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.
covariatesYesConfounders to adjust for
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.6/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation, the description richly discloses behavior: cross-fitting, double robustness, formal assumptions (unconfoundedness, overlap, SUTVA), failure modes such as propensity scores near 0/1, and practical remedies like trimming or switching estimands. This gives the agent realistic expectations about when results may be unreliable.

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

Conciseness4/5

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

The description is dense but well-structured, front-loading the core definition before assumptions, pre-conditions, failure modes, and alternatives. The only mild excess is the generic 'Validation: validated evidence tier' sentence, which contributes little to invocation decisions.

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

Completeness5/5

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

Given the 13-parameter schema, output schema, and read-only annotation, the description covers everything an agent needs: estimand semantics, assumptions, preconditions, failure-mode handling, and alternatives. An agent can decide whether to call this tool and how to interpret borderline cases without further round-trips.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds meaningful parameter-level context: covariates must contain all confounders, treatment must be binary with both arms present, and overlap must not be badly violated. It also connects n_folds to the failure mode of very wide confidence intervals.

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

Purpose5/5

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

The description identifies AIPW as the canonical doubly-robust ATE estimator and explains its mechanism: cross-fitting an outcome regression and propensity model combined via the efficient-influence-function formula. This clearly distinguishes it from nearby siblings such as ipw, dml, tmle, and matching, and names alternatives explicitly.

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 clear usage context through pre-conditions, failure modes, typical minimum N, and an explicit alternatives list (sp.ipw, sp.dml, sp.tmle, sp.matching). It stops short of fully articulating when to prefer AIPW over each alternative, so it is not a complete decision rule, but the guidance is strong.

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