skills/tracing/SKILL.md
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.
npx skillsauth add langwatch/langwatch tracingInstall 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.
If the user's request is general ("instrument my code", "add tracing", "set up observability"):
If the user's request is specific ("add tracing to the payment function", "trace this endpoint"):
This skill is code-only — there is no platform path for tracing. If the user has no codebase, explain that tracing requires code instrumentation and point them to the LangWatch docs.
See CLI Setup for installation. The CLI is useful for verifying traces:
langwatch trace search --limit 5 # Verify traces arrive
langwatch trace get <traceId> # Inspect a specific trace
langwatch analytics query --metric trace-count # Check trace volume
For documentation access, set up the LangWatch MCP: See MCP Setup for installation instructions. If MCP installation fails, see docs fallback.
See API Key Setup.
Add the API key to the project's .env file:
LANGWATCH_API_KEY=your-key-here
Use the LangWatch MCP to fetch the correct integration guide for this project:
fetch_langwatch_docs with no arguments to see the docs indexCRITICAL: Do NOT guess how to instrument. Read the actual documentation for the specific framework. Different frameworks have different instrumentation patterns.
For Python:
pip install langwatch
# or: uv add langwatch
For TypeScript:
npm install langwatch
# or: pnpm add langwatch
Follow the integration guide you read in Step 3. The general pattern is:
Python:
import langwatch
langwatch.setup()
@langwatch.trace()
def my_function():
# your existing code
pass
TypeScript:
import { LangWatch } from "langwatch";
const langwatch = new LangWatch();
IMPORTANT: The exact pattern depends on the framework. Always follow the docs, not these examples.
Do NOT consider the instrumentation complete without verifying it works. Follow these steps in order:
pip install langwatch (or uv add langwatch) / npm install langwatch (or pnpm add langwatch). If the install fails due to peer dependency conflicts, widen the conflicting range and retry — do NOT silently skip this step.npx tsx or the framework's dev command. Study how the framework starts to find the right approach; only give up if the framework requires infrastructure you cannot spin up (databases, external services, etc.).langwatch trace search --limit 5. If the CLI is not available but MCP is, call search_traces. If traces show up, instrumentation is confirmed working.langwatch.setup() call in Pythonplatform_ MCP tools — this skill is about adding code, not creating platform resourcestools
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.
development
Expert AI engineering consultant for your LangWatch setup. Audits your codebase, traces, evaluations, and scenarios, then guides you to improve — starting from low-hanging fruit and going deeper. Use when you want to level up your agent's engineering quality.