🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
import { Langfuse } from "langfuse";
import { env } from "@langfuse/shared/src/env";
import { getProductBaseUrl } from "@langfuse/shared/src/server";
let client: Langfuse | null = null;
/**
* Client for fetching the agent system prompt from the Langfuse AI-features
* project. Prompt fetching only — tracing is disabled because the agent has
* its own instrumentation sink. Without LANGFUSE_AI_FEATURES_HOST the client
* targets this deployment itself (e.g. PR previews), never cloud.langfuse.com.
*/
export function getInAppAgentPromptClient(): Langfuse {
if (!client) {
client = new Langfuse({
publicKey: env.LANGFUSE_AI_FEATURES_PUBLIC_KEY ?? "",
secretKey: env.LANGFUSE_AI_FEATURES_SECRET_KEY ?? "",
baseUrl: env.LANGFUSE_AI_FEATURES_HOST ?? getProductBaseUrl().toString(),
enabled: false,
});
}
return client;
}