LangWatch TypeScript SDK integration guide
LANGWATCH_API_KEY
from the LangWatch dashboard.LANGWATCH_API_KEY
is set:
thread_id
in their metadata, making the individual messages become part of a conversation.
user_id
metadata to track user analytics.LangWatchExporter
, you can automatically collect those traces to LangWatch.First, you need to install the necessary dependencies:instrumentationHook
in your next.config.js
file if you haven’t already:instrumentation.ts
(or .js
) in the root directory of the project (or inside src
folder if using one), with LangWatchExporter
as the traceExporter:experimental_telemetry
tracking on the AI SDK calls you want to trace:await trace.sendSpans();
to wait for all pending requests to be sent before the runtime is destroyed.source
as the documentId..addEvaluation
method:
name
is required and must be a string. The other fields are optional, but at least one of passed
, score
or label
must be provided.