UNPKG

mcp-use

Version:

Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents, Clients and Servers with support for ChatGPT Apps, Code Mode, OAuth, Notifications, Sampling, Observability and more.

27 lines 1.74 kB
/** * Langfuse observability integration for MCP-use. * * This module provides automatic instrumentation and callback handler * for Langfuse observability platform. * * Note: This module expects environment variables to be loaded before import. * Users should load their environment variables using their preferred method * (e.g., dotenv, direct process.env assignment, or system environment). */ import type { BaseCallbackHandler } from "@langchain/core/callbacks/base"; /** * Initializes Langfuse observability for the application and installs a callback handler that augments traces with optional agent metadata and tags. * * This will attempt to dynamically load the Langfuse LangChain integration and, if available, create and store a wrapped callback handler (and optionally a Langfuse client) on the module state so tracing can be used elsewhere in the application. * * @param agentId - Optional identifier for the agent to include in traces * @param metadata - Optional static metadata to attach to traces; merged with dynamic metadata if a provider is supplied * @param metadataProvider - Optional function that returns dynamic metadata to attach to traces at runtime * @param tagsProvider - Optional function that returns an array of tags to attach to traces at runtime */ declare function initializeLangfuse(agentId?: string, metadata?: Record<string, any>, metadataProvider?: () => Record<string, any>, tagsProvider?: () => string[]): Promise<void>; export declare const langfuseHandler: () => BaseCallbackHandler | null; export declare const langfuseClient: () => any; export declare const langfuseInitPromise: () => Promise<void> | null; export { initializeLangfuse }; //# sourceMappingURL=langfuse.d.ts.map