Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

gsynth

Read-only

Estimates causal treatment effects with generalized synthetic control using donor-pool comparisons, factor cross-validation, and placebo inference to support evidence-backed decisions.

Instructions

Generalized Synthetic Control via interactive fixed effects. Validation: certified parity evidence. Do NOT use when: there is only one treated unit and a short pre-period -- the interactive fixed-effects factors are not identified; use sp.synth; fewer pre-treatment periods than the number of factors being fit -- factor estimation is degenerate. Cost: Cross-validating n_factors refits the factor model cv_folds x max_factors times, and placebo/bootstrap inference refits again per replication -- runtime is multiplicative in those three knobs. Pin n_factors to skip the CV sweep. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add don...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
seedNoRandom seed.
timeYesTime period column.
unitYesUnit identifier column.
alphaNoSignificance level.
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
backendNo``'native'`` uses StatsPAI's Python interactive fixed-effects implementation. ``'gsynth'``/``'r'`` delegates to the R ``gsynth`` package through ``Rscript`` using the Track-A reference specification ``force='two-way'``, ``CV=TRUE``, ``r=c(0, max_factors)``, and ``se=FALSE``. The R backend is intended for exact reference-package parity; the native path remains the dependency-light default.native
outcomeYesOutcome variable name.
placeboNoRun placebo inference.
cv_foldsNoCross-validation folds for factor selection.
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://.
n_factorsNoNumber of latent factors. If None, selected by cross-validation.
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.
covariatesNoAdditional time-varying covariates.
max_factorsNoMaximum factors to try during CV.
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
treated_unitYesIdentifier of the treated unit.
data_sample_nNoOptional uniform random subsample size (seed=0, deterministic) — useful on huge panels.
treatment_timeYesFirst treatment period (inclusive).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already mark the tool read-only, and the description adds substantial behavioral context: cross-validation and placebo runtime costs, factor identification conditions, assumptions like SUTVA and no anticipation, and failure modes such as large pre-treatment RMSPE. This goes well beyond what annotations provide.

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

Conciseness5/5

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

The description is divided into labeled sections — Validation, Do NOT use, Cost, Assumptions, Pre-conditions, Failure modes — with the core method and exclusions front-loaded. There is no filler, and the length is justified by the tool's complexity.

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 complex estimator, this is unusually complete: it covers purpose, exclusion conditions, cost, assumptions, pre-conditions, and failure modes, and an output schema exists so return structure need not be restated. It falls slightly short because the final failure-mode bullet is truncated mid-sentence ('Add don...') and the 'certified parity evidence' phrase is unexplained.

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 provides 100% parameter coverage, so the baseline is 3. The description adds value by explaining how n_factors, cv_folds, and max_factors interact multiplicatively and advising to pin n_factors to skip the CV sweep, which helps agents choose among those knobs.

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?

States that the tool performs Generalized Synthetic Control via interactive fixed effects, which identifies the method and differentiates it from plain synthetic control. However, it lacks an explicit action verb such as 'Estimates' or 'Runs', so the purpose is clear but not maximally crisp.

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?

Explicitly lists 'Do NOT use when' conditions with the underlying identification reasoning and names 'sp.synth' as the alternative. It also adds pre-conditions and assumptions that define the appropriate data setting, giving an agent strong routing 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