Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

ltmle

Read-only

Estimate causal contrasts of static treatment regimes over time, controlling for time-varying confounding with double-robust TMLE inference.

Instructions

Longitudinal TMLE for static regime contrasts. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Sequential exchangeability (no unmeasured time-varying confounding) at every treatment time point; Positivity at each time point conditional on the past; Correctly specified outcome (Q) and treatment (g) models, though TMLE is doubly robust to one of them. Pre-conditions: Long-format data with time-varying treatment, confounders and the static regime contrast of interest. Failure modes: Near-positivity violation: estimated treatment probabilities approach 0 or 1, inflating variance -> Bound (truncate) the cumulative weights or use a marginal structural model with stabilised weights. Alternatives: sp.tmle, sp.g_computation, sp.msm. Typical minimum N: 500.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesFinal outcome column.
alphaNoSignificance level for confidence intervals and tests.
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
baselineNoBaseline time-invariant covariates.
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.
censoringNoCensoring indicator column per time point (``1=observed``, ``0=censored``). If None, no censoring is modeled.
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.
treatmentsYesTreatment column per time point, length ``K``.
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
outcome_typeNo``auto`` detects from unique values of ``y``.auto
data_sample_nNoOptional uniform random subsample size (seed=0, deterministic) — useful on huge panels.
regime_controlNoRegimes to contrast. Default: all-1 vs all-0. A regime may also be a **callable** ``regime(k, history)`` for *dynamic regimes* that depend on the simulated / observed history of baseline and time-varying covariates. The callable receives ``k`` (int 0..K-1) and ``history`` -- a dict mapping column name to the length-``n`` numpy array observed up to that timepoint -- and must return a length-``n`` numpy array of 0/1 treatment assignments.
regime_treatedNoRegimes to contrast. Default: all-1 vs all-0. A regime may also be a **callable** ``regime(k, history)`` for *dynamic regimes* that depend on the simulated / observed history of baseline and time-varying covariates. The callable receives ``k`` (int 0..K-1) and ``history`` -- a dict mapping column name to the length-``n`` numpy array observed up to that timepoint -- and must return a length-``n`` numpy array of 0/1 treatment assignments.
covariates_timeYes``covariates_time[k]`` lists time-k covariate columns (may be empty). Length ``K``.
propensity_boundsNoClip propensity to this range for stability.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

The description goes well beyond the readOnlyHint annotation by disclosing double robustness, sequential exchangeability, positivity assumptions, and a near-positivity failure mode with a mitigation. It does not contradict the annotations; the added assumptions and sample-size guidance are genuinely useful behavioral context.

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 well organized with labeled sections and front-loads the core purpose before assumptions, failure modes, and alternatives. The 'Validation:' sentence is somewhat opaque and adds little operational value, preventing a top score.

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?

For a complex longitudinal estimator with 16 parameters, the description covers assumptions, data preconditions, failure modes, alternatives, and minimum sample size, while the schema and output schema handle parameters and return structure. Nothing critical for correct invocation appears to be missing.

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

Parameters3/5

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

Schema descriptions cover all 16 parameters, so the description is not required to explain individual inputs. The failure-mode advice about bounding weights loosely relates to propensity_bounds, but it does not add per-parameter meaning beyond what the schema already provides.

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 opening phrase 'Longitudinal TMLE for static regime contrasts' names the estimator and the narrowing to static regimes, which helps distinguish it from dynamic-regime or survival-focused siblings. It lacks an explicit verb such as 'estimates the causal effect of...' but is unambiguous and specific.

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 provides concrete pre-conditions, assumptions, and a minimum N, and it names alternatives (sp.tmle, sp.g_computation, sp.msm). It also gives one explicit substitution trigger under near-positivity (use an MSM with stabilized weights), though it does not fully specify when to prefer each listed alternative.

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