langfuse

Query Langfuse traces, observations, sessions, scores, and prompts across legacy and v4 APIs.

1|Updated Jul 16, 2026
One-click install
npx skills add https://github.com/LunarCommand/claude-skills --skill langfuse-lunarcommand
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: langfuse
Source: https://github.com/LunarCommand/claude-skills/tree/main/skills/langfuse
Command: npx skills add https://github.com/LunarCommand/claude-skills --skill langfuse-lunarcommand

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires curl, python3, and includes scripts (resource) components.

What problem does it solve? Debugging LLM applications requires inspecting real traces, generations, and token usage, but Langfuse's API surface changed significantly in v4, breaking naive integrations and making manual querying error-prone. ## Core Features & Use Cases - Trace and Generation Inspection: List traces, view full trace timelines, and inspect LLM generations with model, prompt version, token usage, and tool calls. - Automatic API Generation Detection: Detects whether the server runs the legacy v1 API or the v4 read APIs and routes queries accordingly, including cursor-based pagination. - Documentation Access: Fetch Langfuse documentation via llms.txt, markdown pages, and search to guide SDK integrations. - Use Case: When an agent misbehaves in production, run langfuse_query.sh generations <trace-id> to see exactly what the LLM received and returned instead of adding print statements. ## Quick Start Ask the assistant to list the five most recent Langfuse traces and show the generations for the one that failed.

Frequently Asked Questions about langfuse

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query Langfuse traces from the command line?

Run langfuse_query.sh traces --limit 5 to list recent traces, then langfuse_query.sh trace <trace-id> for full detail. The script reads credentials from .agent.env and formats results with python3, no jq required.

How to debug what an LLM received and returned in Langfuse?

Use langfuse_query.sh generations <trace-id> to see each generation's model, prompt name and version, token counts, user input, and output including tool calls. This is the fastest way to confirm which prompt version produced a given output.

Does this work with Langfuse v4 and self-hosted instances?

Yes, the script detects the server version from /api/public/health and routes to the v2/v3 read APIs on servers major version 4 or higher, or the legacy v1 API otherwise. It works against self-hosted, EU cloud, and US cloud instances.

Why do Langfuse v4 traces and sessions commands show derived data?

Langfuse v4 removed the trace and session read entities, so the script reconstructs them by grouping observations by traceId or sessionId. Output is labeled as derived and trace names are inferred from the earliest observation.

Why does langfuse_query.sh return 404 on every command?

A 404 on every command means API generation detection picked the wrong surface. Check langfuse_query.sh apigen and force the correct one with LANGFUSE_API_GEN=legacy or LANGFUSE_API_GEN=v4.