Skip to content
Back to skills

Langfuse

ASecurity

> **Verification Tier:** `code_example_tested` | **Last Verified:** 2026-11-18 > **Official Docs:** https://langfuse.com/docs/observability/sdk/overview

  • 13 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentspythonbashnodeawsapisecurity

Works with

  • cli
  • api

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 2 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add ashish7802/awesome-api-skills --skill langfuse --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Langfuse?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Langfuse
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ashish7802-langfuse/badge)](https://www.skillsdirectory.com/skills/ashish7802-langfuse)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Langfuse API & SDK Skill

> **Verification Tier:** `code_example_tested` | **Last Verified:** 2026-11-18  
> **Official Docs:** https://langfuse.com/docs/observability/sdk/overview

## Overview
Langfuse provides LLM observability, nested traces/generations, prompt versioning, and evaluation datasets via OpenTelemetry (`@langfuse/otel`) and the JS/Python SDKs.

## Installation
```bash
npm install langfuse @langfuse/otel @opentelemetry/sdk-node
pip install langfuse
```

## Authentication
Configure `LANGFUSE_PUBLIC_KEY` (`pk-lf-...`), `LANGFUSE_SECRET_KEY` (`sk-lf-...`), and `LANGFUSE_BASE_URL` (e.g., `https://cloud.langfuse.com`, `https://us.cloud.langfuse.com`, or your self-hosted instance). REST ingestion uses HTTP Basic Auth (`publicKey:secretKey`).

## Core Concepts
- **Traces, Spans, Generations**: Group multi-step agent runs under a single trace; record model name, input/output, and token usage on Generation observations.
- **Serverless Flushing**: Batched trace export happens asynchronously in memory. In AWS Lambda, Vercel Functions, or Cloudflare Workers, you MUST `await langfuse.flushAsync()` (or `spanProcessor.forceFlush()`) before the handler returns or traces are silently dropped.
- **Scores**: Attach automated or user-feedback evaluation scores via `traceId`.

## Error Handling & Rate Limits
- Treat telemetry failures as non-fatal: never block or crash user-facing LLM responses if Langfuse ingestion experiences transient errors or HTTP `429`.
- Configure explicit batch size and flush intervals to avoid ingestion throttling under burst traffic.

## Security Best Practices
- Mask or redact PII/secrets before sending prompt inputs/outputs to Langfuse spans.
- Keep `LANGFUSE_SECRET_KEY` strictly server-side; only use `LANGFUSE_PUBLIC_KEY` for approved client score submissions if needed.

## AI Pitfalls
- Forgetting `await flushAsync()` / `forceFlush()` in serverless handlers, resulting in zero traces appearing in the dashboard.
- Mixing up EU (`cloud.langfuse.com`) vs US (`us.cloud.langfuse.com`) `LANGFUSE_BASE_URL` regions (produces `401 Unauthorized`).
- Recording raw customer secrets or auth tokens inside trace metadata.

## Production Checklist
- [ ] `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`, and `LANGFUSE_BASE_URL` configured via env vars
- [ ] `flushAsync()` / `forceFlush()` awaited in serverless/short-lived processes
- [ ] PII scrubbing applied to logged prompt inputs
- [ ] Telemetry errors caught and isolated from critical user paths

## References
- [Langfuse SDK Overview](https://langfuse.com/docs/observability/sdk/overview)
- [Langfuse OpenTelemetry Integration](https://langfuse.com/integrations/native/opentelemetry)

## Related skills
- [`opentelemetry`](../opentelemetry/SKILL.md) — depends on
- [`openai-responses`](../openai-responses/SKILL.md) — works well with
- [`vercel-ai-sdk`](../vercel-ai-sdk/SKILL.md) — integrates with

Files in this skill

  • SKILL.md2.8 KB
  • examples/quickstart.ts729 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.