SCALIX help

← All tools

gads_end_experiment

Google Ads write medium risk

Part of the Experiment Agent.

What it does

End a running experiment without promoting it (ExperimentService.EndExperiment). The experiment campaign is removed and all traffic returns to the original control campaign. WRITE with preview->approve->commit: preview reads the experiment's status (a SETUP experiment, never scheduled, or a REMOVED, PROMOTED or GRADUATED one is refused, as Google refuses it; INITIATED or HALTED gets a warning) and warns that ending discards the treatment campaign + preview_id; commit calls EndExperiment + audit. Returns {experiment, message}. Dedicated RPC (no validate_only); preview validates state via read. PREVIEW SEMANTICS: preview verifies the experiment exists via a live read; the end RPC runs only with the preview's RETURNED preview_id (identical arguments, within 30 minutes; forged or stale tokens are rejected).

When to use it

Use to stop a running experiment and revert to the control. Confirm the user wants to discard the treatment (not promote it), then commit. If they want to keep the treatment's settings, use gads_promote_experiment instead.

Inputs

NameTypeRequiredDescription
customer_idstringyes10-digit CID; strip dashes.
experiment_resource_namestringyesFull resource name customers/{cid}/experiments/{id}. Must be running.
manager_idstringnoOptional MCC login-customer-id.
validate_onlybooleannoOptional. true forces another preview even with a preview_id; false is DEPRECATED and no longer commits — only a valid preview_id applies the write.
preview_idstringnoOmit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview.

Safeguards

A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.

Policy

Ending an experiment is reversible only by recreating it; confirm the user accepts losing the treatment campaign and its in-flight data. No policy content risk, but log the reason.

Reminder

Ending discards the treatment campaign and returns traffic to the original; confirm and log the reason.

Errors

Error classMeansWhat to doRetry
EXPERIMENT_NOT_RUNNINGThe experiment is not in a state that can be ended.Check status; only running/initiated experiments can be ended.no
EXPERIMENT_ERROREnding failed.Surface the platform message and retry if transient.no
NOT_FOUNDNo experiment with that resource name.Confirm via gads_list_experiments.no
TOKEN_REVOKEDOAuth token expired/revoked.Refresh and retry once; else prompt reconnect (needs_reauth).yes
PERMISSION_DENIEDNo access or out-of-bearer-scope write.Confirm access and write scope; else refuse.no
RESOURCE_EXHAUSTEDRate/quota exceeded (HTTP 429).Backoff 5/10/20s cap 60s, then retry.yes
INTERNAL_ERRORTransient Google server error (5xx).Retry after backoff.yes

Edge cases

  • Ending is effectively irreversible — the treatment campaign and its unique data are removed; warn before commit.
  • Only running/initiated experiments can be ended; a SETUP one is refused at preview (it never started).
  • Traffic returns to the control campaign automatically.
  • Re-validate state at commit; expired token -> refresh once and retry; preview_id TTL expiry -> re-preview.