TypeScript SDK v4 (GA)

The new OpenTelemetry-based TypeScript SDK v4 is now generally available with improved DX, modular packages, and seamless integrations.
Langfuse TypeScript SDK v4 is now GA. Rebuilt on OpenTelemetry JS v2, it brings modular packages, automatic tracing for OpenAI and LangChain, and a smoother developer experience across tracing, prompts, datasets, and scores.
Highlights
- Modular packages:
@langfuse/core
,@langfuse/client
,@langfuse/tracing
,@langfuse/otel
- First-class OpenTelemetry JS v2 with robust context propagation, thus interoperable with all OpenTelemetry-based tools and instrumentation libraries
- Automatic tracing for OpenAI, LangChain, and the Vercel AI SDK
- Improved prompts, datasets, and scoring APIs
You can now instrument your application with custom tracing in JavaScript/TypeScript using the same intuitive patterns as our Python SDK—context managers, decorators, and manual control:
startActiveObservation
- Recommended approach with automatic lifecycle management.
import { startActiveObservation } from "@langfuse/tracing";
await startActiveObservation("user-request", async (span) => {
span.update({ input: { query: "What is the capital of France?" } });
// Your logic here - any nested observations are automatically managed
span.update({ output: "Successfully answered." });
});
Get started
Upgrading from v3? Follow the upgrade guide for step-by-step migration instructions.
Have thoughts or issues? Share feedback in the discussion: GitHub Discussions #8403.