Skip to main content
Quick setup? Instead of following these steps manually, copy a prompt into your coding agent and it will set this up for you automatically.
LangWatch helps you understand every user interaction (Thread), each individual AI task (Trace), and all the underlying steps (Span) involved. We’ve made getting started super smooth. Let’s get cracking.
1

Create your LangWatch account

Head over to app.langwatch.ai and sign up. Create your first organization and project.
2

Get your API key

You have two options:Option A: CLI login (recommended for local development)
npx langwatch login
This opens your browser to authenticate and adds LANGWATCH_API_KEY to your local .env file.Option B: Create a key manuallyGo to Settings → API Keys and create an API key. See the API Keys guide for details on personal vs service keys.
.env
LANGWATCH_API_KEY="sk-lw-..."
LANGWATCH_PROJECT_ID="your-project-id"
Keys created from Settings → API Keys (both personal and service) require LANGWATCH_PROJECT_ID so the SDK knows which project to send traces to. You can find the project ID in your project settings or URL.
3

Let LangWatch MCP do the rest for you (Optional)

Install the LangWatch MCP Server and ask your coding assistant (Cursor, Claude Code, Codex, etc.) to instrument your codebase with LangWatch, OR keep following the steps below to instrument your codebase manually.Add the LangWatch MCP to your editor. Under the mcpServers object of your editor’s MCP settings file, add an entry named langwatch with these fields:
  • command: npx
  • args: -y, then the package name @langwatch/mcp-server on a separate token
See LangWatch MCP for per-editor instructions and the API key field.Then ask your coding assistant to instrument your codebase with LangWatch:
"Instrument my codebase with LangWatch"
4

Install the LangWatch SDK

We have official SDKs for Python and Node.js ready to go. If you’re using another language, our OpenTelemetry Integration Guide provides the details you need.
pip install langwatch
# or
uv add langwatch
5

Add LangWatch to your project

Time to connect LangWatch. Initialize the SDK within your project. Here’s how you can set it up:
import langwatch
import os
from langwatch.instrumentors import OpenAIInstrumentor

langwatch.setup(
    api_key=os.getenv("LANGWATCH_API_KEY"), # Your LangWatch API key
    project_id=os.getenv("LANGWATCH_PROJECT_ID"), # Required for service API keys
    instrumentors=[OpenAIInstrumentor()] # Add the instrumentor for your LLM
)
6

Start observing!

You’re all set! Jump into your LangWatch dashboard to see your data flowing in. You’ll find Traces (individual AI tasks) and their detailed Spans (the steps within), all organized into Threads (complete user sessions). Start exploring and use User IDs or custom Labels to dive deeper!

Next steps

  • Need org-wide controls? See AI Governance for per-user workspaces, anomaly detection, OCSF/SIEM export, and ingestion sources for non-gateway telemetry, paired with the AI Gateway data plane.
  • Routing every LLM call through a single endpoint? See AI Gateway: virtual keys, budgets, fallback chains, guardrails.