Create an LLM Monitoring Application¶
- Go to Agent Monitoring > Application List;
- Click "Create Application";
- Select the LLM Monitoring Application tab.
Integration Types¶
On the Create Application page, the following integration is supported by default: Integrate Langfuse.
Integration Configuration¶
Three options are supported here:
Integrate Other Models/Frameworks
Python Integration¶
1. Install Dependencies¶
2. Initialize the Client¶
3. Verify the Connection¶
You can use langfuse.auth_check() to verify whether the integration is successful. It is not recommended for production use because it adds latency to your application.
from langfuse import Langfuse
# Initialize (via constructor parameters)
langfuse = Langfuse(
public_key="app_id",
secret_key="llm_d9f06c320a9***6e9807",
host="https://llm-openway.truewatch.com"
)
# Verify the connection. This is a synchronous call and is not recommended for production; this method is only used to verify the configuration.
if langfuse.auth_check():
print("Langfuse client is authenticated and ready!")
If the integration fails, you may encounter the following error:
langfuse.api.resources.commons.errors.unauthorized_error.UnauthorizedError: status_code: 401, body: {}
This error usually indicates that the App ID or Client Token is incorrect. Please check your parameter configuration.
For more detailed information and end-to-end examples, refer to Python.
JS/TS Integration¶
Note
This configuration applies only to the Langfuse JS/TS SDK v4. v3 is not currently supported.
1. Install Dependencies¶
Click to view more package information.
2. Configure Credentials¶
Set the following environment variables in your application environment. Ensure there is a .env file and a package such as dotenv in your project root to load the variables.
LANGFUSE_SECRET_KEY="llm_122f6b85d0c7454fa0f9*****d360"
LANGFUSE_PUBLIC_KEY="pk-lf-..."
LANGFUSE_BASE_URL="https://llm-openway.truewatch.com"
3. Initialize OpenTelemetry¶
Langfuse SDK tracing is built on OpenTelemetry, so you need to set up the OpenTelemetry SDK. LangfuseSpanProcessor is the key component that sends traces to Langfuse.
import { NodeSDK } from "@opentelemetry/sdk-node";
import { LangfuseSpanProcessor } from "@langfuse/otel";
const sdk = new NodeSDK({
spanProcessors: [new LangfuseSpanProcessor()],
});
sdk.start();
Click to view the Ollama integration example.
For more detailed information and end-to-end examples, refer to JS/TS.
Other Integrations¶
If you need to integrate other models/frameworks, such as DeepSeek, Ollama, LangChain, and Dify, see the complete official Langfuse documentation for configuration.
LangChain OpenTelemetry Integration¶
LangChain applications can be integrated via OpenTelemetry. After integration, you can view call traces, inputs, outputs, and token usage in LLM Application Monitoring.
The system parses OpenTelemetry gen_ai attributes and displays:
- Input: the input content of the model call;
- Output: the output content returned by the model;
- Token: input, output, and total token usage;
- Related information such as the model, service, and call status.
Note
The content displayed on the page depends on whether the reported data contains the corresponding gen_ai attributes. Fields that are not reported are not displayed and do not affect queries for other trace data.
Fill In the Variables in Your Code¶
Fill in the following information on the right side of the page:
| Field | Description |
|---|---|
| Application Name | Custom application name |
| Application ID | Public key. Supports only letters, numbers, and underscores. Used to attribute data to the current application in traces, logs, and metrics |
| Service Address | Enter the Dataway gateway address |
| Client Token | Automatically generated after the application is created. Used to send data from user devices |
What is Client Token?
After you create an application, the system automatically generates a Client Token. This token is used to send data from user devices.
For more details, refer to Client Token Management.
After confirming the information is correct, click Create to complete the LLM Monitoring Application integration.