Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

harvest_did

Read-only

Aggregate all valid 2x2 difference-in-differences comparisons from staggered panels into weighted average treatment effects for robust causal analysis.

Instructions

Harvest every valid 2x2 DID comparison from a staggered panel and aggregate them via precision-weighted / simple / cohort-weighted averages. Agnostic to cohort structure; useful for robustness comparisons against CS / SA / BJS. Assumptions: Parallel trends hold for every valid 2x2 sub-comparison being harvested and aggregated; No anticipation before each cohort's first treated period (reference horizon -1 is clean); Independence across units within each cohort (unit-level cluster-robust SEs); cross-horizon covariance ignored. Pre-conditions: Long-format panel with unit, time, outcome columns; Either a binary treat indicator or a precomputed cohort (first-treatment) column with a never_value marker; Multiple cohorts and overlapping periods so valid 2x2 comparisons exist across the requested horizons. Failure modes: No clean (never-treated or not-yet-treated) controls so no valid 2x2 cells can be harvested -> Add never-treated units or restrict horizons to periods with available clean controls; Precision weighting dominated by one tiny high-variance comparison distorts the aggregate -> Switch weighting to 'equal' or 'n_treated' to down-weight unstable cells. Alternatives: sp.callawa...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeYesTime period column.
unitYesUnit identifier column.
alphaNoSignificance level for confidence intervals and tests.
treatNoTime-varying treat indicator (for dynamic harvesting)
cohortNoFirst-treat cohort column (for static harvesting)
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
outcomeYesOutcome variable column name or outcome array.
horizonsNohorizons parameter (list).
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://.
referenceNoPre-treatment reference horizon relative to each cohort
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.
never_valueNonever_value parameter.
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.8/5.0
Behavior5/5

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

Even though annotations already declare readOnlyHint=true and openWorldHint=false, the description adds substantial behavioral context beyond them: explicit statistical assumptions (parallel trends per 2x2 cell, no anticipation at reference -1, independence across units, cross-horizon covariance ignored), pre-conditions, and two named failure modes with remediation paths. No contradiction with annotations.

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 long but well-structured with clear labeled sections (Assumptions, Pre-conditions, Failure modes, Alternatives) and the core purpose is front-loaded in the first sentence. Each section earns its place for a complex 15-parameter estimator, though it is denser than strictly necessary.

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 staggered-DID estimator with 15 parameters, an output schema, and annotations, this description covers purpose, assumptions, data requirements, failure modes, and alternatives — everything an agent needs to decide whether to call it and how to interpret its behavior. The output schema covers return values, so no description burden there. Only minor loss is the truncated 'Alternatives: sp.callawa...' sentence.

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 meaning beyond the schema by clarifying the treat/cohort distinction (dynamic vs static harvesting), explaining never_value as a never-treated marker, and tying reference horizon -1 to the 'clean' anticipation assumption. Minor gap: it references weighting options ('equal', 'n_treated') and 'cohort-weighted' aggregation that do not appear as explicit schema parameters, which could leave an agent unable to act on that guidance.

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?

States a specific verb and resource: 'Harvest every valid 2x2 DID comparison from a staggered panel and aggregate them via precision-weighted / simple / cohort-weighted averages.' It differentiates from the large DID sibling family by declaring itself agnostic to cohort structure and positioning it as a robustness check 'against CS / SA / BJS', so an agent can distinguish it from callaway_santanna, sun_abraham, staggered_sa, and did_2x2.

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

Usage Guidelines5/5

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

Provides explicit use-case guidance ('useful for robustness comparisons against CS / SA / BJS'), names alternatives, and gives operational pre-conditions (long-format panel, treat-or-cohort columns, multiple cohorts with overlapping periods) plus failure modes with concrete remedies (add never-treated units, restrict horizons, switch weighting). This is actionable when-to-use and when-not-to-use guidance.

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