skills/analytics/SKILL.md
Analyze your AI agent's performance using LangWatch analytics. Use when the user wants to understand costs, latency, error rates, usage trends, or debug specific traces. Works with any LangWatch-instrumented agent.
npx skillsauth add langwatch/langwatch analyticsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill queries and presents analytics. It does NOT write code.
If the langwatch CLI is available (check with langwatch --help), prefer it over MCP tools:
# Quick project overview
langwatch status
# Query metrics with presets
langwatch analytics query --metric trace-count # Total traces
langwatch analytics query --metric total-cost # Total cost
langwatch analytics query --metric avg-latency # Average latency
langwatch analytics query --metric p95-latency # P95 latency
langwatch analytics query --metric eval-pass-rate # Evaluation pass rate
# Search traces
langwatch trace search -q "error" --limit 10 # Find error traces
langwatch trace search --start-date 2026-01-01 # Custom date range
# Get trace details
langwatch trace get <traceId> # Human-readable
langwatch trace get <traceId> -f json # Raw JSON
langwatch trace export --format csv -o traces.csv # Export as CSV
langwatch trace export --format jsonl --limit 500 # Export as JSONL
Set LANGWATCH_API_KEY in the environment before running CLI commands.
If the CLI is not available, use MCP tools instead.
See MCP Setup for installation instructions.
discover_schema with category "all" to learn the full set of available metrics, aggregations, and filtersCRITICAL: Always call discover_schema first. Do NOT hardcode or guess metric names.
Use the appropriate MCP tool based on what the user needs:
Use get_analytics for time-series data and aggregate metrics:
"performance.total_cost", aggregation "sum""performance.completion_time", aggregation "p95""performance.total_tokens", aggregation "sum""metadata.error", aggregation "count"Use search_traces to find individual requests matching criteria:
Use get_trace with a trace ID to drill into details:
Summarize the data clearly for the user:
discover_schema first -- do NOT hardcode metric namesplatform_ MCP tools for creating resources -- this skill is read-only analyticsdevelopment
Add LangWatch tracing and observability to your code. Use for both onboarding (instrument an entire codebase) and targeted operations (add tracing to a specific function or module). Supports Python and TypeScript with all major frameworks.
tools
Test your AI agent with simulation-based scenarios. Covers writing scenario test code (Scenario SDK), creating platform scenarios (CLI or MCP), and red teaming for security vulnerabilities. Auto-detects whether to use code or platform approach based on context.
testing
Test that your AI agent stays observational and doesn't give prescriptive advice in regulated domains (healthcare, finance, legal). Creates scenario tests for boundary enforcement and red team tests for adversarial probing. Use when your agent advises but must not prescribe.
tools
Write scenario tests that verify your CLI tool is usable by AI agents. Ensures commands work non-interactively, provide clear output, and don't hang on prompts. Use when you want to prove your CLI is agent-friendly.