debug-with-langwatch

Diagnose production LLM agent failures by inspecting LangWatch traces, spans, and monitor scores.

3.5k|362|Updated Sep 9, 2023
One-click install
npx skills add https://github.com/langwatch/langwatch --skill debug-with-langwatch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: debug-with-langwatch
Source: https://github.com/langwatch/langwatch/tree/main/skills/_compiled/native/debug-with-langwatch
Command: npx skills add https://github.com/langwatch/langwatch --skill debug-with-langwatch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When an LLM agent fails or misbehaves in production (errors, bad answers, latency spikes), finding the root cause across traces, spans, and evaluation signals is slow and unstructured. This Skill provides a step-by-step diagnostic workflow that narrows from errored traces to a verified root cause using the LangWatch CLI.

Core Features & Use Cases

  • Errored Trace Discovery: Search production traces with --errors-only, date windows, text queries, and --jq field extraction to isolate failures and repeated patterns.
  • Span-Level Inspection: Read the full span hierarchy of a failing trace to identify which LLM or tool call failed, what prompt the model saw, and whether retries or timeouts are involved.
  • Monitor and Evaluator Correlation: Cross-check firing monitors and evaluator scores (toxicity, hallucination, PII) against span evidence, and quantify blast radius with analytics queries.
  • Use Case: Users report wrong refund answers from your support agent. You search errored traces, inspect the failing retrieval span, confirm a hallucination monitor is firing, trace the regression to a prompt change via git log, fix it, and verify errors stop.

Quick Start

Ask the agent to find the root cause of the recent production errors in your LangWatch project and verify the fix with fresh traces.

Frequently Asked Questions about debug-with-langwatch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find errored traces in LangWatch?

Run `langwatch trace search --errors-only --limit 25 -o json` to list failing traces. Errors are recorded on spans, not in searchable trace text, so `-q "error"` finds nothing; use `--errors-only` with `--start-date`/`--end-date` to bound the window.

How do I debug a failing LLM agent in production?

Follow a narrowing workflow: search errored traces, inspect the failing span's input and prompt with `langwatch trace get <traceId>`, check firing monitors and evaluator scores, then form a hypothesis, fix, and re-run the trace search to verify errors stop.

What do I need to use the LangWatch CLI for debugging?

You need the `langwatch` CLI installed and a valid `LANGWATCH_API_KEY` configured. Run `langwatch status` first to confirm the API key, endpoint, and project point at the environment you intend to debug.

Why does searching for error text return no traces in LangWatch?

Errors are stored on spans, not in the trace's searchable text, so a text query like `-q "error"` returns nothing and looks like a clean project. Use the `--errors-only` flag instead to filter traces by recorded error status.

When should I use debug-instrumentation instead of this workflow?

Switch to the debug-instrumentation recipe when traces themselves look broken, such as empty inputs/outputs or disconnected spans. That indicates an instrumentation problem rather than an application-level failure this workflow diagnoses.