Agent Skill
Trace root cause analysis (Datadog)
Finds why an LLM app fails in production: samples failing spans in Datadog, groups them into failure modes, then walks each trace from symptom to root cause.
Bookmark
Bookmarks are kept in your free account, so you can find this page again on any device.
Sign in to bookmarkInstall
Commands are pinned to commit 08f6988, the version we read, wherever the install method supports it.
npx skills
npx skills add datadog-labs/agent-skills@08f698841e0dfbba09832296f20f13faa44680eb --skill agent-observability-trace-rca -a claude-codeCopies the skill into .claude/skills/ in this project, pinned to the reviewed commit.
Plugin marketplace
/plugin marketplace add datadog-labs/agent-skills
/plugin install agent-skills@datadog-labsRun inside Claude Code. Installs the whole Datadog agent-skills plugin (all of its skills) from its default branch, not the pinned commit.
npx skills
npx skills add datadog-labs/agent-skills@08f698841e0dfbba09832296f20f13faa44680eb --skill agent-observability-trace-rca -a codexInstalls to .agents/skills/, which Codex scans from the working directory up to the repo root.
npx skills
npx skills add datadog-labs/agent-skills@08f698841e0dfbba09832296f20f13faa44680eb --skill agent-observability-trace-rca -a cursorInstalls to .agents/skills/, one of the folders Cursor reads skills from.
gh skill
gh skill install datadog-labs/agent-skills agent-observability/agent-observability-trace-rca --pin 08f698841e0dfbba09832296f20f13faa44680eb --agent github-copilotNeeds GitHub CLI 2.90.0 or later. Use --scope user to install for every repository.
npx skills
npx skills add datadog-labs/agent-skills@08f698841e0dfbba09832296f20f13faa44680eb --skill agent-observability-trace-rcaPinned to the commit we reviewed. The CLI asks which agents to install for; add -g to install for your user instead of this project.
What it does
It answers “what is wrong with my LLM app?” from production traces rather than from guesses. The agent first picks a backend: Datadog’s MCP server if its LLM Observability tools are loaded, otherwise the pup CLI, otherwise it stops and tells you how to connect one. It then chooses one of three modes without asking: eval signal when LLM-judge evaluators are configured for the app, error signal for runtime errors, and a generic mode that looks for structural problems such as latency outliers, agent loops and retrieval misses.
The method is the error-analysis approach from evals work, applied to traces. It samples failing spans, reads them, writes free-form notes on each (“open coding”), merges those into a small set of failure modes (“axial coding”), and only then walks the span tree for the top three to five modes. A bad LLM answer is treated as a symptom: the cause is often a parent agent’s instructions, a sibling retrieval step or a tool that returned bad data. The report gives counts and percentages, links every claim to a trace, proposes concrete fixes with before-and-after text, and marks anything based on fewer than five examples as tentative.
When to use it
Your LLM app or agent already sends traces to Datadog LLM Observability, an eval score has dropped or errors have appeared, and you want a diagnosis grounded in real spans rather than a hunch. It suits the moment after “something is wrong” and before “let’s change the prompt”: you get a failure taxonomy with counts, the trace that shows each failure best, and the span where it started. With your codebase open, it searches for the system prompt, tool definitions or routing code it blames and proposes diffs, asking before it edits.
When to skip it
If you are not on Datadog LLM Observability, the skill has nothing to read; the same method works by hand on any tracing tool, as our guide to evaluating an LLM app with error analysis shows. Skip it when the app has no traces yet (LLM Observability instrumentation is the first step) and for a single failing request you can already open and read. The skill is long: about 41 KB of instructions that load in full each time it triggers, and a run makes many tool calls, so expect it to use a good share of your context and quota.
Try it
What's wrong with support-bot over the last 7 days? The
answer_correctness eval pass rate dropped from 92% to 78% after
Tuesday's prompt change.
What it can touch
- Bundles scripts
- Yes
- Pre-approved tools
- See source
- Needs
- Datadog account with LLM Observability and traces from your app; Datadog MCP server (llmobs toolset) or the pup CLI, logged in
- Client-specific fields
- None, spec fields only
Its scripts run with your permissions, and it may have changed since the commit we read. How to check a skill.
- Datadog, read access: through the MCP server’s LLM Observability tools or
pup llm-obs, it searches spans, reads span content (system prompts, full conversations, retrieved documents, metadata) and evaluator configs. That content can include your users’ messages; the skill tells the agent to anonymise names and emails in the report. - Shell: in pup mode it runs
pupcommands through Bash, and it may write small parsing scripts for MCP results. - Datadog, write access, only if you choose: after the report it offers to save a Markdown file, export a Datadog notebook (via MCP or
pup notebooks create, writing a JSON payload to/tmpfirst), or apply fixes to your code. It is told to take none of these actions automatically. - Setup commands it suggests:
claude mcp add --scope user --transport http datadog-llmo-mcppointing atmcp.datadoghq.com, orpup auth login. Both give the agent your Datadog permissions. - Every MCP call is tagged with a
telemetry.intentstring naming the skill and an invocation ID, so Datadog can see the skill’s activity. evals/contains Python files (hence “has scripts”); the skill does not run them.
At commit 08f6988 the SKILL.md is 784 lines long. Alongside it:
evals/(8 entries): Datadog’s own test harness for the skill:executor.py(builds a/agent-observability-trace-rcaprompt and invokes the skill),evaluator.py, a judge rubric, an example config and an empty dataset. The executor imports helper modules from elsewhere in the repository, so it does not run from this folder alone, and the skill never calls it.
Outline of the SKILL.md
We have not reproduced this SKILL.md because it is 784 lines and about 41 KB, too large to show usefully here; it is MIT-licensed, so you are free to read and copy it at the source. Its main sections at the reviewed commit:
- Backend (MCP or pup detection, invocation ID, intent tagging)
- Methodology, Usage and Inputs (
ml_app,eval_name,timeframe,mode,failure_filter) - Available Tools (eval discovery, trace and span exploration, parallelisation rules)
- Analysis Workflow: Phase 0 (resolve inputs and infer mode), Phase 1 (find problematic spans, per mode), Phase 1.5 (app profile and where the root cause lives), Phase 2 (open coding), Phase 3 (axial coding), Phase 4 (navigate from symptom to root cause), Phase 5 (recommendations), Phase 6 (RCA report), Phase 7 (post-analysis actions and notebook export)
- Output Format, Operating Rules and the pup Tool Reference
Alternatives
Read AI agent observability for what to trace before you need a root cause. LLM Observability instrumentation from the same repository gets traces into Datadog in the first place. For bugs in ordinary code rather than LLM behaviour, systematic debugging applies the same symptom-to-cause discipline.
SKILL.md
We have not reproduced this file here; the outline above lists its sections. Read the SKILL.md on GitHub.
Related skills
LLM Observability instrumentation (Datadog)
Adds Datadog LLM Observability to a Python or Node.js app that calls LLMs: detects the stack, adds SDK setup and checks session IDs flow through.
Systematic debugging
obra's root-cause-first debugging process from Superpowers: investigate, compare against working code, test one hypothesis at a time, and only then fix.
MCP server builder
A four-phase guide to designing, building, testing and evaluating MCP servers in Python (FastMCP) or TypeScript, with reference docs and an eval harness.
Guides and recipes that use Trace root cause analysis (Datadog)
- Agent observability: what to log and why
What to record for AI agents in production: traces and spans, tool calls, cost per task and the signals that catch failures before users report them.
- Start your evals by reading outputs, not by picking metrics
The fastest way to useful LLM evals is to read real outputs and write down what is wrong. Why error analysis comes before metrics, and how to do it.