| name | langfuse-hello-world |
| description | Create a minimal working Langfuse trace example.
Use when starting a new Langfuse integration, testing your setup,
or learning basic Langfuse tracing patterns.
Trigger with phrases like "langfuse hello world", "langfuse example",
"langfuse quick start", "first langfuse trace", "simple langfuse code".
|
| allowed-tools | Read, Write, Edit |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","langfuse","testing","tracing"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Langfuse Hello World
Overview
Create your first Langfuse trace with real SDK calls. Demonstrates the trace/span/generation hierarchy, the observe wrapper, and the OpenAI drop-in integration.
Prerequisites
- Completed
langfuse-install-auth setup
- Valid API credentials in environment variables
- OpenAI API key (for the OpenAI integration example)
Instructions
Step 1: Hello World with v4+ Modular SDK
import { startActiveObservation, observe, updateActiveObservation } from "@langfuse/tracing";
import { LangfuseSpanProcessor } from "@langfuse/otel";
import { NodeSDK } from "@opentelemetry/sdk-node";
const sdk = new NodeSDK({
spanProcessors: [new LangfuseSpanProcessor()],
});
sdk.start();
async function main() {
await startActiveObservation("hello-world", async (span) => {
span.update({
input: { message: "Hello, Langfuse!" },
metadata: { source: "hello-world-example" },
});
(, (child) => {
child.({ : { : } });
( (r, ));
child.({ : { : } });
});
(
{ : , : },
(gen) => {
gen.({
: ,
: [{ : , : }],
: { : },
: { : , : , : },
});
}
);
span.({ : { : } });
});
sdk.();
.();
}
().(.);