Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

g_estimation

Read-only

Estimate the causal effect of a multi-stage dynamic treatment regime from observational data, adjusting for time-varying confounders under sequential exchangeability and positivity.

Instructions

G-estimation for a multi-stage dynamic treatment regime. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Sequential exchangeability / no unmeasured confounding at each time point; Positivity: every treatment level is possible given the past; Correct specification of the treatment and/or outcome models. Pre-conditions: Sequentially measured covariates, (time-varying) treatment, and outcome; Models for the treatment process and the outcome (or weights). Failure modes: Stabilized weights have extreme values (positivity near-violation) -> Truncate weights, simplify the treatment model, or use a doubly-robust estimator (TMLE). Alternatives: sp.tmle, sp.g_computation, sp.ipw. Typical minimum N: 300.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesFinal outcome variable.
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
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.
treatmentsYesTreatment variables at each stage, in temporal order. E.g., ['A1', 'A2'] for a two-stage DTR.
n_bootstrapNoNumber of bootstrap replications.
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
random_stateNoRandom seed or RandomState for reproducible stochastic steps.
data_sample_nNoOptional uniform random subsample size (seed=0, deterministic) — useful on huge panels.
covariates_by_stageYesCovariates (tailoring variables) available at each stage. covariates_by_stage[k] are the variables available when deciding treatment k.
propensity_covariatesNoCovariates for propensity model at each stage. If None, uses covariates_by_stage.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior2/5

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

Annotations declare readOnlyHint=true (read-only) and openWorldHint=false, but the description adds no behavioral context beyond that. It mentions failure modes (extreme stabilized weights) and validation tiers, but for a causal inference tool, the user would need to know more about what the tool actually returns, stability of results, or any side effects. The safety profile is covered by annotations, so the description gets a credit for that, but it doesn't explain what the tool doesn't do or its limitations beyond the assumptions listed.

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 moderately sized but front-loads the core purpose, then clearly structures it into Validation, Assumptions, Pre-conditions, Failure modes, Alternatives, and Typical minimum N. It's organized and each section earns its place, though the 'Typical minimum N' is a bit of a tangent but useful for planning. No wasted words.

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?

Given the complexity (multi-stage DTR with 13 parameters), the output schema is present (so return values are likely described there), and the description covers assumptions, pre-conditions, failure modes, alternatives, and sample size. It's quite complete for the agent to decide whether to use the tool and anticipate issues. It doesn't document exact return values, but the output schema likely does that.

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 description coverage is 100%, meaning every parameter has a description in the schema. The description adds no additional parameter semantics beyond what's in the schema. For example, 'covariates_by_stage' is described in the schema as 'Covariates (tailoring variables) available at each stage,' and the description doesn't clarify further. Baseline of 3 is appropriate since the schema handles it.

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 starts with a clear statement: 'G-estimation for a multi-stage dynamic treatment regime.' This identifies the verb (estimating via G-estimation), the resource (multi-stage dynamic treatment regime), and the method. However, it doesn't explicitly distinguish itself from sibling tools like 'g_computation' or 'ipw' beyond listing them as alternatives in the failure-modes section, which only covers when those should be used instead in specific scenarios.

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 a 'Pre-conditions' section that clearly states what data and models are needed, which is implicit guidance on when the tool is applicable. It also mentions specific failure modes and suggests alternatives like TMLE when positivity is near-violated, but it doesn't explicitly say 'use this tool when you have ... and use g_computation when ...' The pre-conditions serve as a strong gatekeeper for usage.

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