/agent-skills:dd-account-setupfrom agent-skills
Validates or provisions a Datadog API key and app key pair on the correct region. Detects existing credentials, fixes wrong-region 403 errors, and handles OAuth sign-in or account creation. Run before any Datadog setup or instrumentation.
Ships in agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
This skill gets the user to a known-good state: a valid API key + application key pair, on the right region, validated against the Datadog API. It is the "step 0" that setup/instrumentation skills depend on — run it first, then hand off.
scripts/account-setup.sh is the single source of truth for everything mechanical —
credential detection (env > .env.local > .env), pair validation, browser sign-in (pup when
installed and new enough — an old pup CLI falls back to the script's own PKCE OAuth
automatically), key creation with retrieve-most-recent fallback (application keys are limited
to the signed-in user), validation of the new pair, and the atomic 0600 .env write.
Existing env-file contents are preserved if provisioning or validation fails. This SKILL.md carries no
copy of that logic: an inline copy is a second implementation that drifts — the --site drift
bug shipped exactly that way, in a reference that duplicated the script. If a step seems to need
inline bash the script already does, the answer is to fix or extend the script, not to duplicate it.
scripts/account-setup.sh --site <DD_SITE> [--fresh | --no-browser] # region from step 1, flag from step 2 / headless
Idempotent: a valid pair already in the environment/.env → exit 0, nothing created (unless
--fresh). Otherwise one browser approval provisions both keys; --no-browser never opens one.
Exit codes are documented in the script header.
AskUserQuestion) — an up/down list, never "enter A / press 1"..env and nowhere else.Baseline to post when step 1 begins (the script takes over from its own checklist on entry):
**Datadog account setup**
- ◔ 1. Confirm region / site
- ○ 2. Credential source — existing pair or fresh login
- ○ 3. Create api + app keys (optional)
- ○ 4. Ready — hand off
The site drives every URL downstream (API host, key pages), so pin it before running the script.
If DD_SITE is set (env or .env): skip this step entirely — no --regions call, no
region question. The environment already carries the decision. Run the script without --site
(it reads DD_SITE from the shell, then .env.local, then .env, and validates the value against its own
allowed-site list, exiting with a clear error if it is unrecognized — if that error fires, relay
it and have the user fix DD_SITE). Post the baseline with step 1 already ● ("confirmed via
DD_SITE") and go straight to step 2's question.
If DD_SITE is unset: ask the user to pick a region — never silently commit one. Run
scripts/account-setup.sh --regions for the current region table (region, DD_SITE, app base
URL) and build the question's options from that output — not from memory or a doc. The same list
is what --site is validated against, so the picker can never offer a site the script would
reject. Don't
try to detect the user's location (no IP-geolocation lookups or other third-party calls): the
right region is where their infrastructure runs, which may not be where they are. Default to
US1 (datadoghq.com) if they have no preference. Tell the user, e.g.:
Which Datadog region should this account live in? Pick the one closest to where your infrastructure runs (e.g. your cloud region) — sending data to a far-away region adds latency and egress cost, and the region can't be changed after the account is created. Default: US1 (Virginia),
datadoghq.com.
Use the host's native selector with US1 (default) first. Wait for the user's reply before continuing; a plain acceptance ("ok", "default", "sure") means US1.
↳ Reprint the baseline with 1. Confirm region ● once the user answers.
An ambient DD_API_KEY may belong to a different org or account than the user intends, and the
region can't reveal which — so let the user decide rather than inferring it. Ask via the host's
native selector, header "Connect to Datadog":
How do you want to connect to Datadog?
- Use my existing credentials —
DD_API_KEY …<last4>→ validate & use · include this option only if a pair was detected- Sign in — I already have a Datadog account → browser sign-in
- Create a new account — sign up in the browser
All three end the same way: run the script. The pick decides the flag:
--fresh: browser sign-in and new keys even when the detected pair is valid —
without the flag the script would keep that pair and never open the browser.<app-base>/signup (the APP_BASE column of --regions) first, then run it with --fresh
and sign in with the new credentials.A detected pair is an option the user confirms, not a default to use silently. Headless is exempt (no TTY to ask) — see the headless section. If the script's sign-in finds no account, send the user to the signup page and re-offer the choice.
↳ Keep 2. The choice ◔ until the user has picked.
Run scripts/account-setup.sh --site <DD_SITE> (plus --fresh per step 2) and read what it prints — don't re-derive or
re-verify its steps with inline calls. It prints the checklist on entry and its final state on
exit (created keys: step 3 ●; a valid pair already existed: step 3 ⊘ skipped; any failure:
step 3 ✖); relay those lines as-is. Keys are created only if no valid pair exists — step 3
is optional by design. When a human runs the script directly without --site, it prompts for
the region on the terminal (empty answer = US1) and states the credential source it detected,
so it is self-contained outside an agent run.
When it fails, it prints the HTTP code and a one-line verdict. Read the verdict, don't guess a blanket "403":
| Verdict (script log / HTTP) | Meaning | What to do |
|---|---|---|
create denied → retrieved 200 | the org restricts OAuth minting by role; the script recovered | nothing — the pair is in .env |
EMPTY_ORG (list 200, zero keys) | the org has no keys and the token can't mint one | UI handoff below |
LIST_DENIED (list 403/404) | the signed-in user's role can't manage keys in this org (common on managed/enterprise orgs like @datadoghq.com) — or wrong region (the identity call would also 403) — or, on the OAuth path, the org restricts the OAuth client for application keys (a pup session can still create them) | UI handoff below, or install pup and re-run, or an org admin grants key-management |
SECRET_DENIED (list OK, reveal denied) | the role can list keys but not reveal secrets | UI handoff below |
TRANSIENT (5xx or another non-401/403/404 status) | server-side or transient — not a permission problem | re-run; if it persists, check the Datadog status page and connectivity to api.<DD_SITE>. Do not tell the user their access was denied |
NETWORK (HTTP 000 — curl got no response) | network, proxy, or malformed URL — not a permission problem | re-run; check connectivity. Do not tell the user their key was denied |
UI handoff (no browser, or the script cannot run): have the user create the keys at
<app-base>/organization-settings/api-keys and …/application-keys → + New Key (the
APP_BASE column of --regions for the confirmed site), and add the DD_API_KEY=… /
DD_APP_KEY=… lines to .env in their own editor — a key pasted into the conversation
lands in the transcript permanently. Same guards the script uses: .env not git-tracked, mode
0600.
.env/.env.local (0600) — that file is the only place the secrets exist.DD_API_KEY/DD_APP_KEY,
unset them before the next step — they would override the new pair in the env file.DD_SITE, set it to the confirmed site
(export DD_SITE=<site>) for the next step — don't just unset it: a run that only validated
an existing pair saves no site, and environment-first loaders would then fall back to US1.${TMPDIR:-/tmp}/dd-oauth-$(id -u).token (0600) in place, and downstream instrumentation reuses
that Bearer token to provision resources a plain API key can't create (notably a RUM
application). The onboarding caller removes it once setup finishes; running instrumentation
standalone, delete it when done.Infer headless from the skill's invocation, not the environment — the trigger is the user explicitly asking to run without a browser or interactive prompts ("I'm in CI, no browser"). Do not infer headless merely from a missing TTY.
The script's fresh-login paths need a browser, so headless works only with a key pair already
provided (DD_API_KEY + DD_APP_KEY + DD_SITE in the environment or .env). Run
scripts/account-setup.sh --no-browser: it validates the pair, and if the pair is missing or
invalid it exits 7 at once. This mode never prompts for a region or changes .env/.gitignore;
valid existing credentials also leave those files untouched. Without the flag it would start a browser login and wait for the
callback. Relay that failure and stop; there is no sign-in or signup fallback without a browser.
Never guess or fabricate an API key, app key, token, or site. Read what's in the environment, validate it, and if it isn't there, authenticate — do not proceed on assumptions. When keys are missing, do not reach for other ambient credential sources to keep moving (they can carry another org's keys); run the script or ask the user.
references/troubleshooting.md — symptom→fix table plus design-decision and temp-state notesWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub datadog-labs/agent-skills --plugin agent-skills78 skills in this plugin
/agent-observability-auto-experimentRun an iterative code-improvement hill-climb against real Datadog LLM-Obs data, locally, with Claude Code as the agent. Establishes a baseline eval, makes one focused change, re-scores both splits with the same harness, keeps the change when held-out test improves without overfitting val (labeling within-noise gains tentative), and repeats. This is the skill published as "Autoresearch" in Datadog Agent Observability. Use when the user says "run an auto experiment", "run autoresearch", "hill-climb this code", "iteratively improve X and measure the delta", "optimize this code/agent/pipeline/prompt against my traces", "auto-optimize against LLM-Obs", or wants the local equivalent of the auto_experiments worker. Works from an ml_app, a dataset_id, an annotation_queue_id (a queue of human-labelled interactions), a list of trace_ids, or (by exception) a local dataset file. The corpus and its val/test splits live in Datadog LLM-Obs Datasets, created once per run with a timestamp in their names./agent-observability-build-eval-from-annotationsFit a Datadog LLM-Obs evaluator to human labels. Takes an annotation queue, works out where in the trace the labelled property actually lives, drafts an LLM-judge that predicts the human label, scores that judge against the already-labelled rows with a metric agreed with the user, then hill-climbs it — inspect the errors, make one focused change, re-score, keep it only if it beats the best — for a bounded number of iterations, and finally publishes the winner to Datadog as a DISABLED evaluator (not a Datadog draft — a real evaluator with `enabled: false`). Use when the user says "build an eval from my annotations", "build an evaluator from the annotation queue", "turn my annotations into an evaluator", "learn an evaluator from my labels", "fit a judge to the annotation queue", "auto-label", "auto labelling", "automate this annotation queue", "scale up my human labels", or wants the rest of a queue graded the way the humans graded the first rows. Needs an annotation queue with at least two classes present in the human labels (e.g. one true and one false for a boolean)./agent-observability-eval-bootstrapBootstrap evaluators from production traces — by default propose online LLM-judge evaluators and, after you confirm, create them in Datadog as disabled drafts (never auto-enabled); on request emit Python SDK code or a framework-agnostic JSON spec instead. Use when user says "bootstrap evaluators", "generate evaluators", "create evals from traces", "eval bootstrap", "write evaluators", "build eval suite", "publish evaluators", or wants to generate BaseEvaluator/LLMJudge code or online judge configs from production LLM trace data. Works with ml_app and optional RCA report or failure hypothesis./agent-observability-eval-pipelineEnd-to-end Agent Observability pipeline for an instrumented ml_app — classify production traces, root-cause failures, bootstrap evaluators, then (optionally) sample + publish a dataset, generate + run an experiment, and analyze results. Six narrated phases with a standardized banner and a "continue" checkpoint between each. Pure orchestration over the agent-observability sub-skills (`agent-observability-session-classify`, `agent-observability-trace-rca`, `agent-observability-eval-bootstrap`, `agent-observability-experiment-bootstrap`, `agent-observability-experiment-analyzer`). Use when user says "run the eval pipeline", "go from traces to evals", "bootstrap evals end to end", "classify then RCA then bootstrap", "build an eval set from scratch", "onboard me to datasets and experiments", "walk me through experiments", "I have an ml_app, now what", "Agent Observability onboarding", "guided experiment setup", "from traces to experiments", or wants a deterministic, narrated tour from production data through evaluators, datasets, and experiments. Stop early with `--stop-after <phase>` to short-circuit at evaluators or dataset, or resume mid-flow with `--start-at <phase>`./agent-observability-experiment-analyzerAnalyze LLM experiment results. Handles single or comparative experiments, exploratory or Q&A modes. Use when user says "analyze experiment", "compare experiments", "analyze against baseline", or provides one or two experiment IDs for analysis./agent-observability-experiment-bootstrapBootstrap a reproducible LLM Observability experiment through the Python ddtrace SDK or the Node dd-trace SDK. Use for experiment, dataset, evaluator, benchmark, regression, or LLM-as-a-judge scaffolding. The legacy Python invocation remains supported.Other plugins' skills for the same job