datadog-labs/agent-skills/agent-observability-trace-rca
Claude Code and agent skill by datadog-labs/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Root cause analysis on production LLM traces. Diagnoses why an LLM application is failing — works from eval judge verdicts, runtime errors, or structural anomalies depending on what signals are present. Walks the span tree from symptom to root cause. Use when user says "what's wrong with my app", "why is my eval failing", "analyze errors", "root cause analysis", "diagnose failures", or wants to understand production failure patterns.
Install
npx vskill@latest install datadog-labs/agent-skills/agent-observability-trace-rcaSKILL.md
The same SKILL.md was published earlier as datadog-labs/agent-skills/agent-observability-trace-rca.
Backend
Detection — At the start of every invocation, before taking any action, determine which backend to use:
- If the user passed
--backend pupanywhere in their invocation → use pup mode immediately, regardless of whether MCP tools are present. Skip steps 2–4. - Check whether MCP tools are present in your active tool list. The canonical signal is whether
mcp__datadog-llmo-mcp__list_llmobs_evalsappears in your available tools. - If MCP tools are present → use MCP mode throughout. Call MCP tools exactly as named in this skill's workflow sections.
- If MCP tools are absent → check whether
pupis executable: runpup --versionvia Bash. A JSON response containing"version"confirms pup is available. - If pup responds → use pup mode throughout. Translate every MCP tool call to its pup equivalent using the Tool Reference appendix at the bottom of this file.
- If neither is available → stop and tell the user:
> "Neither the Datadog MCP server nor the pup CLI is available. Connect the MCP server (claude mcp add --scope user --transport http datadog-llmo-mcp 'https://mcp.datadoghq.com/v1/mcp?toolsets=llmobs') or install pup."
--backend pup is accepted anywhere in the invocation arguments and is stripped before passing remaining args to the skill logic.
pup invocation rules:
- Invoke via Bash:
pup llm-obs <subcommand> [flags] - pup always outputs JSON. Parse directly — no content-block unwrapping (unlike MCP results, which may wrap JSON in
[{"type": "text", "text": "<json>"}]). - If pup returns an auth error, tell the user to run
pup auth loginand stop. - Parallelization: issue multiple Bash tool calls in a single message (one pup command per call).
- Time flags: pup accepts bare duration strings (
1h,7d,30m) and RFC3339 timestamps. Do not usenow--prefixed strings — strip the prefix when converting from a skill--timeframeargument:now-7d→7d,now-24h→24h,now-30d→30d. --summaryonpup llm-obs spans searchstrips payload fields to essential metadata only. Use it in bulk/search phases where content is not needed.
Invocation ID: At the very start of each invocation, before any MCP tool call, generate an 8-character hex invocation ID (e.g., 3a9f1c2b). Keep it constant for the entire invocation.
Intent tagging: On every MCP tool call, prefix telemetry.intent with skill:agent-observability-trace-rca[<inv_id>] — followed by a description of why the tool is being called. On the first MCP tool call only, use skill:agent-observability-trace-rca:start[<inv_id>] — instead (note the :start suffix). Example first call: skill:agent-observability-trace-rca:start[3a9f1c2b] — Phase 0: discover configured evals for task-cruncher to infer analysis mode
Agent Observability Trace RCA — Root Cause Analysis from Production LLM Traces
Diagnose why an LLM application is failing by searching production traces and walking the span tree from symptom to root cause. The skill automatically selects the best analysis mode based on available signals:
| Mode | Signal | When auto-selected | |
|---|---|---|---|
| Eval Signal | LLM judge verdicts and reasoning (pass/fail rates, scoring) | Evaluators are configured for the app | |
| Error Signal | Runtime errors (@status:error, error types, stack traces) | No evals configured, or user explicitly asks about errors/crashes | |
| Generic | Structural anomalies (latency, agent loops, retrieval misses) | Explicit mode=generic override, or no strong signal found in Phase 1 |
The mode is announced (never asked) in the first user-facing output with a one-line override hint.
Methodology
Resolve → Search → Observe → Open Coding → Axial Coding → Root Cause Navigation → Recommendations
Usage
Inputs
| Input | Required | Default | Description | |
|---|---|---|---|---|
ml_app | Yes (or eval_name) | — | The application to analyze. | |
eval_name | No | — | One or more evaluators to focus on. Implies Eval Signal mode. Pass a list for multi-eval analysis. | |
timeframe | No | now-24h | How far back to look. | |
mode | No | inferred | Explicit mode override: eval, errors, generic. Skips inference entirely. | |
failure_filter | No | — | Narrowing scope: "errors" (routes to Error Signal path), "high latency" (post-fetch duration sort), "low scores on <eval>" (promotes to eval_name), a tool name or span name (@name:<x> query). |
If neither ml_app nor eval_name is provided, ask the user.
Available Tools
Eval discovery & overview
| Tool | Purpose | |
|---|---|---|
list_llmobs_evals | Discover all configured evals for an ml_app. Used in Phase 0 mode inference. | |
get_llmobs_eval_aggregate_stats | Pass/fail rate or score distribution for an eval over a time window. | |
get_llmobs_evaluator | Full evaluator config: prompt template, assessment criteria, span filter, sampling, provider. Use instead of the deprecated get_llmobs_eval_config. |
Trace & span exploration
| Tool | Purpose | |
|---|---|---|
search_llmobs_spans | Find spans by tags, span kind, status, query syntax. Paginate with cursor. Entry point for Phase 1. | |
get_llmobs_span_details | Metadata, evaluations (scores, labels, reasoning), status, error fields, duration, and `content_info` map showing available fields + sizes. | |
get_llmobs_span_content | Actual content for a span field. Supports JSONPath via path param for targeted extraction. | |
get_llmobs_trace | Full trace hierarchy as span tree with span counts by kind. | |
find_llmobs_error_spans | All error spans in a trace with error type, message, stack, and propagation context. | |
expand_llmobs_spans | Load children of collapsed trace nodes. | |
get_llmobs_agent_loop | Chronological agent execution timeline (LLM calls, tool invocations, decisions). May return empty — see Phase 4b fallback. |
Key get_llmobs_span_content patterns
| Field | Path | What you get | |
|---|---|---|---|
messages | $.messages[0] | System prompt (first message, usually system role) | |
messages | $.messages[-1] | Last assistant response | |
messages | (no path) | Full conversation including tool calls | |
input / output | — | Span I/O | |
documents | — | Retrieved documents (RAG apps) | |
metadata | — | Custom metadata (prompt versions, feature flags, user segments) |
How to use search_llmobs_spans
Always include `@ml_app:"<ml_app>"` in the `query` string — the structured `ml_app` parameter is unreliable and can return spans from other apps. Do not rely on the structured parameter alone.
Useful query fragments — combine with space (AND):
| Goal | Query | |
|---|---|---|
| Errors only | @status:error | |
| Eval is present on the span | @evaluations.custom.<eval_name>:* (presence only — pass/fail is read from get_llmobs_span_details, not the query) | |
| A specific tool by name | @name:<tool_name> |
Dedicated params (span_kind, root_spans_only, ml_app) work alongside query, but query takes precedence over tags.
Parallelization rules
- `get_llmobs_span_details`: Group span_ids by trace_id, chunk each trace's span_ids into batches of at most 20. Issue ALL chunks for a page in a single message.
- `get_llmobs_span_content`: Each call is independent — always issue ALL in a single message.
- `get_llmobs_trace` / `find_llmobs_error_spans` / `get_llmobs_agent_loop`: Parallelize across different traces in a single message.
- Pipeline parallelism: Start
get_llmobs_span_detailsfor page 1 results immediately — don't wait to collect all pages.
Analysis Workflow
Output discipline: Phases 0–5 are internal analysis. The only user-facing outputs during these phases are the Phase 1 Signal Summary and the mandatory checkpoints at Phases 2 and 3. Do NOT narrate reasoning, summarize intermediate findings, or output Phase 4 deep-dive results as prose. All detailed findings go exclusively into the Phase 6 report.
Phase 0: Resolve Inputs & Infer Mode
First: check for classification context. Scan the conversation for a # Session Classification Summary header. If found → enter Step 0S below and skip all remaining Phase 0 steps and Phase 1 entirely.
Step 0S — Extract Failure Bucket from Classification Output
The canonical handoff format is the Per-Unit Details table inside the # Session Classification Summary section. Extract one row per unit:
| Field | Source | |
|---|---|---|
trace_id | Link URL in the ID column: parse the trace_id= or session_id= query parameter from the link href | |
verdict | Verdict column | |
failure_mode | Failure Mode column (none for passing rows) | |
detail | Reason column — use as the Phase 2 reasoning input (same role as eval judge reasoning or error messages) | |
app_type | From the # Session Classification Summary header line (e.g. Root span kind: agent) — default LLM if absent |
Failure bucket = all rows where verdict is no or partial.
- < 5 entries → note low confidence, proceed anyway.
- Empty → report "No failures found in the classification output" and stop.
Present this overview before proceeding:
Then skip Phase 1 and jump directly to Phase 2. Carry forward:
- Phase 2 reasoning input:
(trace_id, span_id, detail)tuples — same structure as eval reasoning or error messages - Phase 4 navigation: use
app_typefrom each trace block to choose the span navigation strategy - Phases 2–7: run completely unchanged — the failure bucket structure is identical regardless of source
Standard resolution (no classification context):
- If neither
ml_appnoreval_nameprovided → ask the user. Ifeval_nameis provided butml_appis not → also ask forml_app(eval names are not globally unique; without it, span searches return results from all apps sharing the eval name). - If
timeframenot provided → default tonow-24h. - Resolve `failure_filter` (before mode inference):
"errors"→ force Error Signal mode"low scores on <eval>"→ treat aseval_name=<eval>, then continue inference"high latency"→ note for Phase 1 (sort by duration post-fetch); continue inference- Tool/span name → note as
@name:<x>query fragment for Phase 1; continue inference
- Resolve mode (skip if
modewas explicitly provided):
eval_namegiven → Eval Signal- User explicitly mentioned errors/exceptions/crashes → Error Signal
- Otherwise → call
list_llmobs_evals_by_ml_app(ml_app): - Evals returned → Eval Signal
- No evals → Error Signal (announce auto-selection in Phase 1)
- When
eval_nameis multi-valued, note for Phase 1: run parallel per-eval searches and merge+dedup by(trace_id, span_id).
Phase 1: Find Problematic Spans
Three mode-specific paths. All end with a Signal Summary that labels the mode and includes a one-line override hint.
Mode switch handling: At any checkpoint, if the user says "switch to [error|eval|generic] mode", re-enter Phase 1 with the new mode. Phase 0 inputs do not re-resolve.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagent-observability/agent-observability-trace-rca/SKILL.md
Popularity
- Repository stars
- 173
- Repository forks
- 29
- 7-day trend score
- 26
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/datadog-labs/agent-skills/agent-observability-trace-rca)