| name | langfuse-local-dev-loop |
| description | Set up Langfuse local development workflow with hot reload and debugging.
Use when developing LLM applications locally, debugging traces,
or setting up a fast iteration loop with Langfuse.
Trigger with phrases like "langfuse local dev", "langfuse development",
"debug langfuse traces", "langfuse hot reload", "langfuse dev workflow".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(docker:*), Bash(pnpm:*) |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","langfuse","llm","debugging","workflow"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Langfuse Local Dev Loop
Overview
Fast local development workflow with Langfuse tracing, immediate trace visibility, debug logging, and optional self-hosted local instance via Docker.
Prerequisites
- Completed
langfuse-install-auth setup
- Node.js 18+ with
tsx for hot reload (npm install -D tsx)
- Docker (optional, for self-hosted local instance)
Instructions
Step 1: Development Environment File
LANGFUSE_PUBLIC_KEY=pk-lf-dev-...
LANGFUSE_SECRET_KEY=sk-lf-dev-...
LANGFUSE_BASE_URL=https://cloud.langfuse.com
NODE_ENV=development
OPENAI_API_KEY=sk-...
Step 2: Dev-Optimized Langfuse Setup (v4+)
import { LangfuseSpanProcessor } from "@langfuse/otel";
import { NodeSDK } from "@opentelemetry/sdk-node";
import { LangfuseClient } from "@langfuse/client";
const isDev = process.env.NODE_ENV !== "production";
const processor = new LangfuseSpanProcessor({
...(isDev && { exportIntervalMillis: 1000, maxExportBatchSize: 1 }),
});
const sdk = new NodeSDK({ spanProcessors: [processor] });
sdk.start();
langfuse = ();
() {
(isDev) {
host = process.. || ;
.();
}
}
process.(, () => {
sdk.();
process.();
});