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 check endpoints |
|
OpenTelemetry trace ingestion (recommended for v4) |
|
Query observations with selective fields and cursor pagination (v2) |
|
Create scores (batch, |
|
List experiments and experiment items (dataset runs) |
|
Manage, version, and retrieve prompts |
|
Manage individual prompt versions |
|
Manage score configurations |
|
Create and manage datasets |
|
Manage dataset items |
|
Create, upsert, and manage model definitions and pricing |
|
Create and manage evaluators (v2) |
|
Create and manage evaluation rules (v2) |
|
Manage projects and API keys |
|
Manage organization memberships |
|
Manage comments on traces |
|
Upload and manage media attachments |
|
Query usage metrics (v2) |
|
Manage annotation queues for human review |
|
Manage LLM provider connections (project scope) |
|
Manage blob storage integrations |
|
SCIM user provisioning |
|
Submit feedback about Langfuse features |
|
Create, list, update, and delete dashboard widgets (unstable) |
|
Create, list, update, and delete dashboards with placements (unstable) |
|
Manage skills, their versions, labels and file contents |
|
Trace delete endpoints (reads are unavailable in v4 events_only mode; use |
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() + ")")
);
}
}