Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(traces): add dedicated skills tab (#18872)

tobi_kl3c649f5cdd7f
diff --git a/web/src/features/traces/components/DetailAttributesTab.tsx b/web/src/features/traces/components/DetailAttributesTab.tsx
index e1f01be6a8..ab3c4995db 100644
--- a/web/src/features/traces/components/DetailAttributesTab.tsx
+++ b/web/src/features/traces/components/DetailAttributesTab.tsx
@@ -1,14 +1,9 @@
/** Trace metadata, or observation attributes, model parameters and metadata. */
import { useMemo } from "react";
-import {
- type SkillsAvailable,
- type SkillsResourceLoaded,
-} from "@langfuse/shared";
import { type MediaReturnType } from "@/src/features/media";
import { PrettyJsonView } from "@/src/components/ui/PrettyJsonView";
-import { useInternalFeaturesEnabled } from "@/src/features/feature-flags";
import { cn } from "@/src/utils/tailwind";
import { IO_SECTIONS_FLUSH_CLASS } from "@/src/features/traces/constants/ioSectionClasses";
import { type MetadataFilterActions } from "@/src/components/table/ValueCell";
@@ -36,8 +31,6 @@ export function DetailAttributesTab({
attributes: Record<string, unknown>;
attributesAnchorTime: Date;
modelParameters: Record<string, unknown> | null;
- skillsAvailable?: SkillsAvailable;
- skillsResourceLoaded?: SkillsResourceLoaded;
};
metadata: unknown;
/** Avoids re-parsing. */
@@ -55,12 +48,6 @@ export function DetailAttributesTab({
projectId,
filterTarget: observation ? "observations" : "traces",
};
- const internalFeaturesEnabled = useInternalFeaturesEnabled();
- const skillsAvailable = observation?.skillsAvailable ?? [];
- const skillsResourceLoaded = observation?.skillsResourceLoaded ?? [];
- const hasSkills =
- internalFeaturesEnabled &&
- (skillsAvailable.length > 0 || skillsResourceLoaded.length > 0);
const hasAttributes =
observation && Object.keys(observation.attributes).length > 0;
const hasMetadata =
@@ -133,24 +120,7 @@ export function DetailAttributesTab({
)}
</div>
) : null}
- {hasSkills ? (
- <>
- <PrettyJsonView
- title="Available skills"
- json={skillsAvailable}
- currentView={currentView}
- />
- <PrettyJsonView
- title="Loaded resources"
- json={skillsResourceLoaded}
- currentView={currentView}
- />
- </>
- ) : null}
- {!hasSkills &&
- !hasAttributes &&
- !observation?.modelParameters &&
- !hasMetadata ? (
+ {!hasAttributes && !observation?.modelParameters && !hasMetadata ? (
<p className="text-muted-foreground text-base">
{observation
? "No attributes, model parameters or metadata on this observation."
diff --git a/web/src/features/traces/components/DetailSkillsTab.stories.tsx b/web/src/features/traces/components/DetailSkillsTab.stories.tsx
new file mode 100644
index 0000000000..aa0e7db5ca
--- /dev/null
+++ b/web/src/features/traces/components/DetailSkillsTab.stories.tsx
@@ -0,0 +1,79 @@
+import preview from "../../../../.storybook/preview";
+import { DetailSkillsTab } from "./DetailSkillsTab";
+
+const meta = preview.meta({ component: DetailSkillsTab });
+
+export const Available = meta.story({
+ args: {
+ projectId: "storybook-project",
+ isLoading: false,
+ skills: {
+ kind: "available",
+ items: [
+ {
+ skillName: "refund-policy",
+ langfuseSkillId: "refund",
+ skillVersion: 3,
+ },
+ {
+ skillName: "shipping-policy",
+ langfuseSkillId: "shipping",
+ skillVersion: 1,
+ },
+ {
+ skillName: "subscription-support",
+ langfuseSkillId: "subscription",
+ skillVersion: 2,
+ },
+ { skillName: "account-security" },
+ ],
+ },
+ },
+});
+
+export const Loaded = meta.story({
+ args: {
+ projectId: "storybook-project",
+ isLoading: false,
+ skills: {
+ kind: "loaded",
+ items: [
+ {
+ skillName: "refund-policy",
+ langfuseSkillId: "refund",
+ skillVersion: 3,
+ filePath: "SKILL.md",
+ },
+ {
+ skillName: "refund-policy",
+ langfuseSkillId: "refund",
+ skillVersion: 3,
+ filePath: "references/refunds.md",
+ },
+ {
+ skillName: "shipping-policy",
+ langfuseSkillId: "shipping",
+ skillVersion: 1,
+ filePath: "references/international-shipping.md",
+ },
+ { skillName: "local-customer-support", filePath: "SKILL.md" },
+ ],
+ },
+ },
+});
+
+export const Empty = meta.story({
+ args: {
+ projectId: "storybook-project",
+ isLoading: false,
+ skills: { kind: "loaded", items: [] },
+ },
+});
+
+export const Loading = meta.story({
+ args: {
+ projectId: "storybook-project",
+ isLoading: true,
+ skills: { kind: "available", items: [] },
+ },
+});
diff --git a/web/src/features/traces/components/DetailSkillsTab.tsx b/web/src/features/traces/components/DetailSkillsTab.tsx
new file mode 100644
index 0000000000..0786f2de13
--- /dev/null
+++ b/web/src/features/traces/components/DetailSkillsTab.tsx
@@ -0,0 +1,147 @@
+import {
+ type SkillsAvailable,
+ type SkillsResourceLoaded,
+} from "@langfuse/shared";
+import { FileCode2, FileText } from "lucide-react";
+
+import { Badge } from "@/src/components/design-system/Badge/Badge";
+import { LinkBadge } from "@/src/components/design-system/LinkBadge/LinkBadge";
+import { Skeleton } from "@/src/components/ui/skeleton";
+
+type SkillGroup = {
+ skill: SkillsAvailable[number];
+ files: Set<string>;
+};
+
+export function DetailSkillsTab({
+ projectId,
+ skills,
+ isLoading,
+}: {
+ projectId: string;
+ skills:
+ | { kind: "available"; items: SkillsAvailable }
+ | { kind: "loaded"; items: SkillsResourceLoaded };
+ isLoading: boolean;
+}) {
+ const groups = new Map<string, SkillGroup>();
+ for (const skill of skills.items) {
+ const key = JSON.stringify([
+ skill.langfuseSkillId ?? null,
+ skill.skillName,
+ skill.skillVersion ?? null,
+ ]);
+ const group = groups.get(key) ?? { skill, files: new Set<string>() };
+ groups.set(key, group);
+ if ("filePath" in skill) group.files.add(skill.filePath);
+ }
+ const fileCount = Array.from(groups.values()).reduce(
+ (count, group) => count + group.files.size,
+ 0,
+ );
+ const isAvailable = skills.kind === "available";
+
+ return (
+ <div className="ph-no-capture flex min-h-0 flex-1 flex-col gap-4 overflow-auto p-4">
+ <div className="flex flex-col gap-1.5">
+ <div className="flex flex-wrap items-center gap-2">
+ <h3 className="text-sm font-bold">
+ {isAvailable ? "Available skills" : "Loaded skills"}
+ </h3>
+ {!isLoading && groups.size > 0 ? (
+ <Badge color="filled" size="sm" text={String(groups.size)} />
+ ) : null}
+ {!isLoading && !isAvailable && fileCount > 0 ? (
+ <span className="text-muted-foreground text-xs">
+ {fileCount} {fileCount === 1 ? "file" : "files"} loaded
+ </span>
+ ) : null}
+ </div>
+ <p className="text-muted-foreground text-xs leading-relaxed">
+ {isAvailable
+ ? "Skills offered to this generation. Availability does not mean a skill was loaded."
+ : "Skill files loaded by this tool call."}
+ </p>
+ </div>
+
+ {isLoading ? (
+ <div
+ className="flex flex-col gap-3"
+ role="status"
+ aria-label="Loading skills"
+ >
+ <Skeleton className="h-16 w-full rounded-md" />
+ <Skeleton className="h-16 w-full rounded-md" />
+ </div>
+ ) : null}
+ {!isLoading && groups.size === 0 ? (
+ <div className="flex flex-col items-center gap-2 rounded-md border border-dashed px-4 py-10 text-center">
+ <FileCode2 className="icon-lg text-muted-foreground" aria-hidden />
+ <p className="text-sm font-bold">
+ {isAvailable
+ ? "No available skills recorded"
+ : "No loaded skills recorded"}
+ </p>
+ <p className="text-muted-foreground max-w-sm text-xs">
+ {isAvailable
+ ? "This generation has no recorded skill availability."
+ : "This tool call has no recorded skill file loads."}
+ </p>
+ </div>
+ ) : null}
+ {!isLoading && groups.size > 0 ? (
+ <ul className="flex flex-col gap-3">
+ {Array.from(groups, ([key, { skill, files }]) => (
+ <li key={key} className="min-w-0 overflow-hidden rounded-md border">
+ <div className="flex min-w-0 items-center gap-3 px-3 py-3">
+ <div className="bg-muted flex shrink-0 items-center justify-center rounded-md p-2">
+ <FileCode2
+ className="icon-base text-muted-foreground"
+ aria-hidden
+ />
+ </div>
+ <div className="flex min-w-0 flex-1 flex-wrap items-center gap-2">
+ {skill.langfuseSkillId && skill.skillVersion != null ? (
+ <LinkBadge
+ href={`/project/${projectId}/skills/${encodeURIComponent(skill.skillName)}?version=${skill.skillVersion}`}
+ text={skill.skillName}
+ newTab
+ noCapture
+ />
+ ) : (
+ <Badge color="ghost" font="mono" text={skill.skillName} />
+ )}
+ {skill.skillVersion != null ? (
+ <Badge
+ color="filled"
+ size="sm"
+ text={`v${skill.skillVersion}`}
+ />
+ ) : null}
+ </div>
+ </div>
+ {files.size > 0 ? (
+ <ul className="bg-muted/20 flex flex-col border-t">
+ {Array.from(files, (filePath) => (
+ <li
+ key={filePath}
+ className="flex min-w-0 items-start gap-2 px-3 py-2"
+ >
+ <FileText
+ className="icon-base text-muted-foreground mt-0.5 shrink-0"
+ aria-hidden
+ />
+ <span className="min-w-0 font-mono text-xs leading-relaxed break-all">
+ {filePath}
+ </span>
+ </li>
+ ))}
+ </ul>
+ ) : null}
+ </li>
+ ))}
+ </ul>
+ ) : null}
+ </div>
+ );
+}
diff --git a/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx b/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx
index 483b8243b3..3130a167d8 100644
--- a/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx
+++ b/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx
@@ -69,6 +69,7 @@ import { ObservationPreview } from "./ObservationPreview";
import { useInternalFeaturesEnabled } from "@/src/features/feature-flags";
import { TraceMessagesView } from "../TraceMessagesView/TraceMessagesView";
import { DetailAttributesTab } from "../DetailAttributesTab";
+import { DetailSkillsTab } from "../DetailSkillsTab";
import { buildModelParameters } from "@/src/features/traces/fns/buildModelParameters";
import { buildObservationAttributes } from "@/src/features/traces/fns/buildObservationAttributes";
@@ -124,6 +125,7 @@ export function ConnectedObservationDetailView({
isAnnotationMode,
hasObservations: observations.length > 0,
canViewScores: true,
+ hasSkills: observation.type === "GENERATION" || observation.type === "TOOL",
});
const showLogViewTab = tabs.includes("log");
const showScoresTab = tabs.includes("scores");
@@ -553,8 +555,6 @@ export function ConnectedObservationDetailView({
attributes,
attributesAnchorTime: observation.startTime,
modelParameters,
- skillsAvailable: observationWithIO?.skillsAvailable,
- skillsResourceLoaded: observationWithIO?.skillsResourceLoaded,
}}
metadata={observationWithIOCompat.data?.metadata ?? undefined}
parsedMetadata={parsedMetadata}
@@ -564,6 +564,26 @@ export function ConnectedObservationDetailView({
/>
</Tabs.Content>
+ {tabs.includes("skills") ? (
+ <Tabs.Content value="skills" layout="fill">
+ <DetailSkillsTab
+ projectId={projectId}
+ isLoading={isLoadingObservation}
+ skills={
+ observation.type === "GENERATION"
+ ? {
+ kind: "available",
+ items: observationWithIO?.skillsAvailable ?? [],
+ }
+ : {
+ kind: "loaded",
+ items: observationWithIO?.skillsResourceLoaded ?? [],
+ }
+ }
+ />
+ </Tabs.Content>
+ ) : null}
+
{showScoresTab ? (
<Tabs.Content value="scores" layout="fill">
<div className="flex h-full min-h-0 w-full flex-1 flex-col overflow-hidden">
diff --git a/web/src/features/traces/components/TraceDetailTabsBarList.tsx b/web/src/features/traces/components/TraceDetailTabsBarList.tsx
index ac63f5142b..dd94e57d6f 100644
--- a/web/src/features/traces/components/TraceDetailTabsBarList.tsx
+++ b/web/src/features/traces/components/TraceDetailTabsBarList.tsx
@@ -10,6 +10,7 @@ const labels: Record<DetailTab, string> = {
preview: "Preview",
messages: "Messages",
attributes: "Attributes",
+ skills: "Skills",
scores: "Scores",
log: "Log View",
};
@@ -68,7 +69,7 @@ function LoadedTraceDetailTabsBarList({
key={tab}
value={tab}
label={labels[tab]}
- internal={tab === "messages"}
+ internal={tab === "messages" || tab === "skills"}
tooltip={tab === "log" ? logViewDescription : undefined}
/>
))}
diff --git a/web/src/features/traces/constants/detailTabs.ts b/web/src/features/traces/constants/detailTabs.ts
index 5cfcbe9e10..04eba2952a 100644
--- a/web/src/features/traces/constants/detailTabs.ts
+++ b/web/src/features/traces/constants/detailTabs.ts
@@ -2,6 +2,7 @@ export const DETAIL_TABS = [
"preview",
"messages",
"attributes",
+ "skills",
"scores",
"log",
] as const;
diff --git a/web/src/features/traces/fns/getDetailTabs.ts b/web/src/features/traces/fns/getDetailTabs.ts
index 275a266f14..3d76f59ff6 100644
--- a/web/src/features/traces/fns/getDetailTabs.ts
+++ b/web/src/features/traces/fns/getDetailTabs.ts
@@ -7,6 +7,7 @@ export function getDetailTabs({
isAnnotationMode,
hasObservations,
canViewScores,
+ hasSkills = false,
}: {
target: "trace" | "observation";
isV4: boolean;
@@ -14,11 +15,13 @@ export function getDetailTabs({
isAnnotationMode: boolean;
hasObservations: boolean;
canViewScores: boolean;
+ hasSkills?: boolean;
}) {
const visibility: Record<DetailTab, boolean> = {
preview: true,
messages: isV4 && internalFeaturesEnabled,
attributes: true,
+ skills: target === "observation" && internalFeaturesEnabled && hasSkills,
scores: canViewScores && !isAnnotationMode,
log: (target === "trace" || isV4) && hasObservations && !isAnnotationMode,
};