| name | langfuse-data-handling |
| description | Manage Langfuse data export, retention, and compliance requirements.
Use when exporting trace data, configuring retention policies,
or implementing data compliance for LLM observability.
Trigger with phrases like "langfuse data export", "langfuse retention",
"langfuse GDPR", "langfuse compliance", "export langfuse traces".
|
| allowed-tools | Read, Write, Edit |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","langfuse","observability","llm","compliance"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Langfuse Data Handling
Overview
Manage the Langfuse data lifecycle: export traces and scores via the API, configure retention policies, handle GDPR data subject requests, anonymize data for analytics, and maintain audit trails.
Prerequisites
@langfuse/client installed
- Langfuse API keys with appropriate permissions
- Understanding of your compliance requirements (GDPR, SOC2, HIPAA)
Instructions
Step 1: Export Trace Data via API
import { LangfuseClient } from "@langfuse/client";
import { writeFileSync } from "fs";
const langfuse = new LangfuseClient();
async function exportTraces(options: {
fromDate: string;
toDate: string;
outputFile: string;
includeObservations?: boolean;
}) {
const allTraces: any[] = [];
let page = 1;
let hasMore = true;
while (hasMore) {
const result = await langfuse.api.traces.list({
fromTimestamp: options.fromDate,
toTimestamp: options.toDate,
limit: 100,
page,
});
for (const trace of result.) {
: = {
: trace.,
: trace.,
: trace.,
: trace.,
: trace.,
: trace.,
: trace.,
};
(options.) {
observations = langfuse...({
: trace.,
});
exportItem. = observations.;
}
allTraces.(exportItem);
}
hasMore = result.. === ;
page++;
( (r, ));
}
(options., .(allTraces, , ));
.();
}
({
: ,
: ,
: ,
: ,
});