Introducing Confident Monitor

Switch from Langfuse V4 to Confident AI

Move your OpenTelemetry traces from Langfuse SDK v4 to Confident AI with confident-trace. Your spans, provider clients and frameworks stay untouched.

Overview

Langfuse SDK v4 (Python) and v5 (TypeScript) already run on OpenTelemetry. confident-trace speaks the same protocol, so the switch is an exporter swap: replace the Langfuse client wrapper with init(), rename the decorator, and keep every span you emit today.

In this guide, you will:

  • Pick a migration method: one copyable prompt for your coding agent, a Confident AI exporter on the OpenTelemetry setup Langfuse already runs, or a manual switch.
  • Install confident-trace and replace the Langfuse keys with one CONFIDENT_API_KEY.
  • Replace the client setup with init() so auto instrumentation emits the spans.
  • Rename @observe to @span so every trace carries a name, an input and an output.
  • Replace LangfuseMedia with Media so audio plays on each message of your traces.
  • See what changes once the traces land in Confident AI: evals on every trace, datasets curated from production, alerts when quality drops.
$200 in migration credits, applied after your callBook a call, show us your current setup, and we map your traces, datasets and prompts together. Applied as a coupon to your first paid invoice, one per organization.Book a migration call

Prerequisites

  • A Project API Key, CONFIDENT_API_KEY (for example confident_us_proj_...). Retrieve yours here.
  • Python 3.10+ for the Python SDK, or Node.js 22+ for the TypeScript SDK.
  • Your existing Langfuse setup on Python SDK v4 (langfuse>=4, run pip show langfuse) or TypeScript SDK v4 or v5 (@langfuse/tracing, run npm ls @langfuse/tracing). The before snippets below follow the Langfuse quickstart as of September 2026.

Choose a Migration Method

MethodWhat you doLimitationsLangfuse SDK v4
One-prompt migrationGive your coding assistant one prompt and review its changesYour assistant writes the changes, so review the diff before you merge. Prompt, dataset and score calls are listed for you, not migratedSupported in Python and TypeScript. See Switch in One Prompt below
OpenTelemetry migrationAdd a Confident AI exporter and keep your Langfuse instrumentationThe Langfuse SDK stays in your app. In Python, its keys stay set and its sampling and masking also shape what Confident AI receives. In TypeScript, Langfuse masking does not apply to the Confident AI export. Media such as audio is uploaded to Langfuse, in Python even after you stop the Langfuse exportSupported in Python and TypeScript. See Switch Using OpenTelemetry below
Manual migrationMake the SDK changes yourself, step by stepThe most work: you change every trace, span and generation yourselfSupported in Python and TypeScript. See Switch Manually below

Switch in One Prompt

Give the prompt below to your coding assistant, such as Claude Code, Cursor or Codex, from the root of your repository. It finds your Langfuse integration, confirms the SDK version, makes the changes from this guide, and tells you what still needs your hands. Review the diff before you merge it.

Prompt
Migrate this codebase from Langfuse to Confident AI using confident-trace.

1. Find every Langfuse integration: imports of langfuse and @langfuse/*, @observe and observe(), get_client(), start_as_current_observation() and startActiveObservation(), langfuse.openai and observeOpenAI, LangfuseMedia, LangfuseSpanProcessor, the Langfuse CallbackHandler, and LANGFUSE_* environment variables.
2. Confirm the installed Langfuse SDK version with pip show langfuse or npm ls @langfuse/tracing. This migration is for Langfuse Python SDK v4 and TypeScript SDK v4 or v5. If the major version is different, stop and tell me which version you found.
3. Make the changes from https://www.confident-ai.com/docs/guides/migrate-to-langfuse-alternative-v4:
   - install confident-trace and call init() once at startup, replacing the Langfuse client and LangfuseSpanProcessor setup
   - replace langfuse.openai and observeOpenAI with the plain OpenAI client
   - rename @observe and observe() to span, and start_as_current_observation() / startActiveObservation() to span(...) / withSpan()
   - move trace updates onto update_trace() (updateTrace() in TypeScript), with session_id as thread_id (threadId)
   - move span and generation updates onto update_span() (updateSpan())
   - keep generations for model calls auto instrumentation does not cover as LLM spans with update_span()
   - replace LangfuseMedia with Media from confident-trace, on a message next to its role and content, and do the same for audio sent to a model, such as an OpenAI input_audio part
   - remove the Langfuse CallbackHandler from LangChain callbacks
   - replace the LANGFUSE_* variables with CONFIDENT_API_KEY, and the Langfuse flush calls with flush() / shutdown()
4. Preserve existing tracing behavior where possible: the same span names, nesting, inputs, outputs, users, sessions, tags and metadata.
5. Do not delete Langfuse prompt, dataset or score calls. List them for me instead.
6. When you are done, summarize every change and list anything that needs manual configuration, such as setting CONFIDENT_API_KEY, the EU endpoint, or model calls you could not map.

Switch Using OpenTelemetry

Langfuse SDK v4 (Python) and v4 or v5 (TypeScript) create OpenTelemetry spans. Add a Confident AI exporter next to the Langfuse one and every span reaches Confident AI as well. Your observe decorators, OpenAI wrappers and trace updates stay as they are.

  1. Add the Confident AI exporter

    The OTLP exporter already ships with Langfuse v4, so there is nothing to install.

    import os
    
    from langfuse import get_client
    from opentelemetry import trace
    from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
    from opentelemetry.sdk.trace.export import BatchSpanProcessor
    
    langfuse = get_client()
    
    trace.get_tracer_provider().add_span_processor(
        BatchSpanProcessor(
            OTLPSpanExporter(
                endpoint="https://otel.confident-ai.com/v1/traces",
                headers={"x-confident-api-key": os.environ["CONFIDENT_API_KEY"]},
            )
        )
    )
  2. Stop sending to Langfuse when you cut over

    While you compare, both platforms receive every trace. When you are ready, stop the Langfuse export. Spans are still created and still reach Confident AI.

    from langfuse import Langfuse
    
    langfuse = Langfuse(should_export_span=lambda span: False)

Run your app once. The trace appears in your project's Observatory within seconds.

What Carries Over

LangfuseConfident AI
Span tree, names, timing and OpenTelemetry statusKept as they are
Observation types (generation, embedding, agent, tool, retriever and more)Span types, with generations and embeddings as LLM spans
Observation input and outputSpan input and output
Model, usage details and cost detailsModel, token counts and cost per token
level="ERROR" and status messageErrored span with that error
Trace name, tags, metadata, input and outputThe same trace fields
Session ID and user IDThread and user
Prompt name and versionPrompt alias and version
LangfuseMedia, such as audioNot sent over OpenTelemetry. Langfuse uploads the file to its own storage and the span keeps text in its place
Scores, prompts and datasetsNot sent over OpenTelemetry. We import them on the migration call

The Langfuse SDK stays in your app. To replace it with confident-trace and its auto instrumentation later, switch manually or with a coding agent.

Switch Manually

  1. Install confident-trace

    One package. Provider SDKs stay optional peers. CONFIDENT_API_KEY replaces LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY and LANGFUSE_BASE_URL.

    pip install confident-trace
    export CONFIDENT_API_KEY=...
    # replaces LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_BASE_URL
  2. Replace the client wrapper with init()

    Drop the Langfuse import of OpenAI. Auto instrumentation emits the spans from the plain client.

    from langfuse.openai import openai
    
    response = openai.chat.completions.create(
        model="gpt-4.1-mini",
        messages=[{"role": "user", "content": "Hello"}],
    )
  3. Rename @observe to @span

    Same shape. Return values and exceptions pass through.

    from langfuse import observe
    
    @observe()
    def answer(question: str) -> str:
        return openai.chat.completions.create(
            model="gpt-4.1-mini",
            messages=[{"role": "user", "content": question}],
        ).choices[0].message.content
  4. Replace LangfuseMedia with Media

    LangfuseMedia becomes Media from confident-trace. Put it on a message, next to its role and content, and the span shows a player on that message. In TypeScript, new LangfuseMedia({ source: "bytes", ... }) from @langfuse/core becomes Media.fromBytes().

    from langfuse import get_client, observe
    from langfuse.media import LangfuseMedia
    
    langfuse = get_client()
    
    @observe()
    def voice_turn(audio: bytes) -> str:
        langfuse.update_current_span(
            input={
                "role": "user",
                "content": "What's my balance?",
                "audio": LangfuseMedia(content_bytes=audio, content_type="audio/wav"),
            }
        )
        return answer(audio)

    Audio you send to a model, such as an OpenAI input_audio part, is not kept by auto instrumentation. Add it to a message with Media as well. See Audio for the formats Media reads and how audio is stored.

Run your app once. The trace appears in your project's Observatory within seconds.

What Changes

Tracing is where you start. Evals are where it pays off. Every trace gets a score. Low scores become dataset rows. Dataset rows become regression tests. Your next release ships against real production failures.

CapabilityLangfuseConfident AI
OpenTelemetry ingestionYesOTLP over HTTP and gRPC
Auto-instrumented providersOpenAI wrapper and LangChain callbackOpenAI, Anthropic, Google GenAI, Bedrock, 5 gateways, 16 frameworks
Built-in eval metricsManaged evaluators, custom scoring50+ research-backed metrics through DeepEval
Online evals on traces, spans and threadsTraces onlyYes
Quality-aware alerting on eval scoresSlack, webhook, GitHub ActionsEmail, Slack, Discord, Teams
Prompt and use case drift detectionNoYes
Automatic dataset curation from productionManual add to datasetIngestion tasks, filtered and tagged
Multi-turn simulationNoYes
Git-based prompt managementNoBranches, PRs, approvals, eval actions
Cross-functional workflows, no codeNoPMs and QA run evals over HTTP
Regression testing and CI gatesNoYes
Safety monitoringNoToxicity, bias, PII on production traffic

Migration Questions

Do I have to rewrite my instrumentation?

No. confident-trace exports through standard OTLP. Existing OpenTelemetry spans from your frameworks are exported as they are.

Can I run both during the switch?

Yes. Point an OpenTelemetry Collector at both endpoints and compare for a week before you cut over. CONFIDENT_OTEL_ENDPOINT accepts a Collector URL.

What about my Langfuse datasets and prompts?

We import them on the migration call. Langfuse exports through its public API and scheduled blob storage export. We map the result to Confident AI datasets and prompt versions.

How do I get the $200?

Book the call. After it, we apply a $200 coupon to your organization's first paid invoice. One reward per organization.

Is the TypeScript SDK ready?

The Python SDK is stable on PyPI. The TypeScript SDK is an alpha release on npm. The TypeScript snippets in this guide follow the alpha API.

Last updated on

Built byConfident AI