Configuration and Usage

Configuration

Configure your Langfuse connection in application.properties:

quarkus.ai-telemetry.langfuse.base-url=https://cloud.langfuse.com
quarkus.ai-telemetry.langfuse.public-key=pk-lf-...
quarkus.ai-telemetry.langfuse.secret-key=sk-lf-...
When DevServices is enabled (the default in dev/test mode), base-url, public-key, and secret-key are automatically configured for you. You only need to set these properties when connecting to an external Langfuse instance or in production.

The public-key and secret-key properties correspond to the Langfuse project public key and project secret key, respectively. You can find these in the Langfuse dashboard under Settings > API Keys.

For a complete list of configuration properties, see the Configuration Reference.

Usage

Simply inject LangfuseApi into your CDI beans for raw REST API access, or inject LangfuseOperations / AsyncLangfuseOperations for higher-level operations such as finding resources by id or name, checking existence, restricting a collection with a filter, deleting in batches, and walking paginated collections (see Higher-Level API Operations).

The extension automatically configures and provides the implementations:

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

import io.quarkiverse.aitelemetry.langfuse.api.LangfuseApi;

@ApplicationScoped
public class MyService {

    @Inject
    LangfuseApi langfuseApi;

    public void listObservations() {
        // Synchronous call
        var observations = langfuseApi.observations().observationsGetMany(/* parameters */);

        // Asynchronous call
        var asyncObservations = langfuseApi.asyncObservations().observationsGetMany(/* parameters */);
    }

    public void listPrompts() {
        var prompts = langfuseApi.prompts().promptsList(/* parameters */);
    }

    public void listScores() {
        var scores = langfuseApi.scores().scoresGetMany(/* parameters */);
    }

    public void checkHealth() {
        var health = langfuseApi.health().healthHealth();
    }
}

Available API Groups

The LangfuseApi bean provides access to the full Langfuse public API. Each API group is available as a method, with both synchronous and asynchronous variants (e.g., trace() / asyncTrace()):

API Group Description

health()

Health check endpoints

opentelemetry()

OpenTelemetry trace ingestion (recommended for v4)

observations()

Query observations with selective fields and cursor pagination (v2)

scores()

Create scores (batch, POST /api/public/scores), query scores with cursor pagination (v3), and delete scores

experiments()

List experiments and experiment items (dataset runs)

prompts()

Manage, version, and retrieve prompts

promptVersion()

Manage individual prompt versions

scoreConfigs()

Manage score configurations

datasets()

Create and manage datasets

datasetItems()

Manage dataset items

models()

Create, upsert, and manage model definitions and pricing

evaluators()

Create and manage evaluators (v2)

evaluationRules()

Create and manage evaluation rules (v2)

projects()

Manage projects and API keys

organizations()

Manage organization memberships

comments()

Manage comments on traces

media()

Upload and manage media attachments

metrics()

Query usage metrics (v2)

annotationQueues()

Manage annotation queues for human review

llmConnections()

Manage LLM provider connections (project scope)

blobStorageIntegrations()

Manage blob storage integrations

scim()

SCIM user provisioning

feedback()

Submit feedback about Langfuse features

unstableDashboardWidgets()

Create, list, update, and delete dashboard widgets (unstable)

unstableDashboards()

Create, list, update, and delete dashboards with placements (unstable)

skills()

Manage skills, their versions, labels and file contents

trace()

Trace delete endpoints (reads are unavailable in v4 events_only mode; use observations())

Example: Listing Prompts

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

import io.quarkiverse.aitelemetry.langfuse.api.LangfuseApi;

@ApplicationScoped
public class PromptService {

    @Inject
    LangfuseApi langfuseApi;

    public void listAllPrompts() {
        var prompts = langfuseApi.prompts().promptsList(APIPromptsListRequest.newBuilder().build());

        prompts.getData().forEach(prompt ->
            System.out.println(prompt.getName() + " (v" + prompt.getVersion() + ")")
        );
    }
}