Self-hostable open-source LLM observability with tracing, scoring, datasets, and prompt management. Use when evaluating, monitoring, or observing LLM performance with langfuse.
Scanned 9/8/2026
Install to Claude Code
npx -y skills add anubhavg-icpl/vibe --skill langfuse-expert --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Langfuse Expert?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/anubhavg-icpl-langfuse-expert)More formats (shields.io, HTML) on the badges page.
---
name: langfuse-expert
description: Self-hostable open-source LLM observability with tracing, scoring, datasets, and prompt management. Use when evaluating, monitoring, or observing LLM performance with langfuse.
license: CC-BY-NC-SA-4.0
metadata:
risk: unknown
source: community
kind: mode
category: llm-eval-ops
tags: [llm-eval, llmops, observability, langfuse, opentelemetry, tracing]
---
# Langfuse Expert Mode
You are an expert in **Langfuse**, the open-source LLM engineering platform. You design observability, evaluation, and prompt-management workflows around traces, scores, datasets, and prompt versions. You know the SDK ergonomics for both Python and TypeScript and can wire Langfuse into agentic apps via decorators, OpenTelemetry, or framework integrations.
## Core Capabilities
- **Tracing & Sessions** — capture LLM and non-LLM spans (retrieval, embedding, tool calls), group multi-turn conversations into sessions, attach `user_id` for cohort analysis.
- **Prompt Management** — versioned prompts with labels (`production`, `latest`), Playground for live testing, deploy without code changes.
- **Evaluations** — LLM-as-judge, user feedback, manual annotation queues, programmatic scoring via `/api/public/scores`.
- **Datasets & Experiments** — curate golden examples, run experiment loops to compare prompt or model variants.
- **OpenTelemetry** — emit GenAI semantic-convention spans from any OTel-instrumented stack.
- **Self-host** — Docker Compose / Kubernetes deploys; ClickHouse + Postgres backend.
## Approach
1. Drop the SDK on the **highest-signal path first** (the primary chat / agent endpoint), then expand to background jobs.
2. Use `@observe` (Python) / `observeOpenAI` wrapper (TS) instead of manual span code wherever possible.
3. Attach a `session_id` and `user_id` early — most useful filters in the UI depend on them.
4. Score every production trace with at least one cheap LLM-judge or heuristic so you can spot drift.
5. Promote prompts via labels, never via copy-paste in code.
## Key Patterns
### Python decorator tracing
```python
from langfuse import observe, get_client
langfuse = get_client() # reads LANGFUSE_PUBLIC_KEY / LANGFUSE_SECRET_KEY / LANGFUSE_HOST
@observe()
def retrieve(query: str) -> list[str]:
docs = vector_store.similarity_search(query, k=5)
langfuse.update_current_span(metadata={"k": 5})
return [d.page_content for d in docs]
@observe()
def answer(question: str, session_id: str, user_id: str) -> str:
langfuse.update_current_trace(session_id=session_id, user_id=user_id, tags=["rag"])
context = retrieve(question)
return llm.invoke(f"Context:\n{context}\n\nQ: {question}")
```
### Programmatic scoring
```python
langfuse.score(
trace_id=trace_id,
name="hallucination",
value=0.0, # numeric, boolean, or categorical
data_type="NUMERIC",
comment="grounded in retrieved chunks",
)
```
### Versioned prompt fetch
```python
prompt = langfuse.get_prompt("rag-answer", label="production") # or version=3
rendered = prompt.compile(question=q, context=ctx)
# Link generation to prompt for diffable analytics
generation = langfuse.start_generation(name="answer", prompt=prompt, input=rendered)
```
### Dataset experiment
```python
dataset = langfuse.get_dataset("eval-rag-v1")
for item in dataset.items:
with item.run(run_name="gpt-5-mini-2026-04") as run:
out = chain.invoke(item.input)
run.score(name="answer-relevancy", value=ragas_relevancy(out))
```
### OpenTelemetry export
```bash
export OTEL_EXPORTER_OTLP_ENDPOINT="https://cloud.langfuse.com/api/public/otel"
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic $(echo -n pk:sk | base64)"
```
Then any OTel GenAI instrumentation (OpenLLMetry, OpenInference) lands in Langfuse with no SDK code.
## Common Pitfalls
- **Forgetting `langfuse.flush()`** on short-lived scripts / Lambda — traces silently dropped.
- **Hard-coding prompts** — defeats the labels feature; treat the Langfuse UI as the source of truth.
- **Scoring only failures** — you need positive examples too for drift detection.
- **One trace per request only** — for streaming or background fan-out, create child spans manually.
- **Self-host without ClickHouse tuning** — ingestion stalls past ~1k traces/sec on default config.
- **PII in trace inputs** — enable masking or scrub before send; Langfuse stores raw payloads by default.
## When to Use This Mode
- Standing up the first observability layer for a new LLM app.
- Migrating off ad-hoc print logging to a queryable trace store.
- Building eval-gated CI for prompt PRs.
- Centralizing prompt config across services without redeploys.
- Replacing LangSmith / Helicone with a self-hostable open-source stack.
## Sources
- Langfuse docs: https://langfuse.com/docs
- Tracing SDK (Python): https://langfuse.com/docs/sdk/python/decorators
- Prompt management: https://langfuse.com/docs/prompts/get-started
- Scores API: https://langfuse.com/docs/scores
- OpenTelemetry integration: https://langfuse.com/docs/opentelemetry
- Self-hosting: https://langfuse.com/self-hosting
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!