See every token.
Debug any trace.
OpenTelemetry-native tracing for LLM apps. Instrument once and inspect every LLM call, tool call, and RAG retrieval across dev, staging, and production - with cost and latency on every span.
Instrument your app in two lines.
Auto-instruments OpenAI, LangChain, LangGraph, and more.
pip install langwatch
import langwatch
from openai import OpenAI
client = OpenAI()
langwatch.setup()
@langwatch.trace()
def handle_message(message):
langwatch.get_current_trace().autotrack_openai_calls(client)
# ... your message handling logic ...Capture the whole pipeline - and the whole conversation.
One task end-to-end - a user message.
A single step: an LLM call, a RAG retrieval, a function. Spans nest to capture your pipeline structure.
Group traces into a conversation with thread_id; add user_id for user analytics.
import langwatch
from langwatch.types import RAGChunk
@langwatch.span(type="rag", name="RAG Document Retrieval")
def rag_retrieval(query: str):
results = retrieve(query)
langwatch.get_current_span().update(
contexts=[RAGChunk(document_id=d["id"], content=d["content"]) for d in results],
retrieval_strategy="vector_search",
)
return results@langwatch.span() auto-captures inputs/outputs (toggle with capture_input / capture_output).
Built on OpenTelemetry. Works with your whole stack.
LangWatch traces are standard OpenTelemetry spans, enriched with semantic attributes (langwatch.span.type, langwatch.inputs, langwatch.outputs). Send them to any OTel backend and combine LLM spans with the rest of your app for a true end-to-end view.
What you get.
Instantly search and inspect any LLM interaction across environments - debug failures, investigate incidents, support audits.
Automatic cost and token tracking per provider, attributable by user, prompt, or model.
Monitor quality and latency over time and get alerted on regressions and incidents.
Turn production traces into evaluation datasets automatically - observability feeds your evals.
Full control when you need it.
Custom attributes, instrumentors, span-exclude rules, your own TracerProvider, and self-hosting.
langwatch.setup(
api_key=os.getenv("LANGWATCH_API_KEY"),
endpoint_url="https://your-langwatch-instance.com", # cloud or self-hosted
base_attributes={AttributeKey.ServiceName: "my-service"},
instrumentors=[OpenAIInstrumentor()],
span_exclude_rules=[...], # e.g. drop GET /health_check
debug=True,
)