🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(evals): expand selected gallery categories (#16867)
Tobias Wochinger558daac30325
diff --git a/.agents/skills/seed-test-data/SKILL.md b/.agents/skills/seed-test-data/SKILL.mdindex 06c2c49a0f..a30e4c501e 100644--- a/.agents/skills/seed-test-data/SKILL.md+++ b/.agents/skills/seed-test-data/SKILL.md@@ -26,36 +26,37 @@ this.## Need → command-| I need... | Command |-| ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| A very complex observation tree (v3) | `pnpm run seed -- trace-tree --observations 5000 --depth 12 --breadth 500` |-| The same tree readable in the v4 events UI | add `--v4` (writes `events_full`; `events_core` fills via MV) |-| Async parents whose subtree outlives their own span (subtree wall-clock duration badge) | add `--async-parents` to `trace-tree` (root + hub end immediately while children keep running) |-| A realistic agent flow over a timeline (graph view + scrubbable timeline) | `pnpm run seed -- agent-timeline --turns 6 --v4` (LangGraph refine loop planner→retriever→generator→critic→loop, staggered in time; add `--timing-only` for the pure timing fallback) |-| A trace that is large as a GRAPH (many distinct node names + connections, the trace-graph layout stress) | `pnpm run seed -- agent-graph --v4` (~1,350 distinct connections from 350 observations; `--nodes 120 --steps 100 --parallel 8` crosses the layout ceiling, `--nodes 80 --steps 30 --parallel 4` is small-but-dense) |-| A dozen SMALL traces, each a different timeline shape (the everyday case, not a stress test) | `pnpm run seed -- timeline-shapes --v4` (12 hand-timed traces of 4-25 observations: rag answer, streamed chat with a TTFT split, 8-way fan-out, retry backoff with widening gaps, a 13-minute wait on a human, one slow tool dwarfing everything, an error cascade with failover, in-flight spans with no end time, zero-duration checkpoints, a ten-level ladder, 24 flat siblings, a three-turn agent loop with think time; `--shape <slug>` for one) |-| A row carrying every annotation at once, to judge whether the timeline is overloaded | `pnpm run seed -- timeline-annotated --v4` (ONE trace, 12 observations: one/two/four scores — the last collapsing into `+1` — one and twelve comments, a streaming first-token mark, costs and durations spread so the heat map paints some rows, plain rows beside them for contrast, and all three label placements on screen together) |-| A multi-HOUR agent run (wall clock dominated by waiting, as production ones are) | `pnpm run seed -- agent-timeline --turns 120 --turn-gap-ms 60000 --v4` (~2.5h; the gap is jittered up to 2x, so the work lands at a few percent of the trace instead of packing every span into a few seconds) |-| A demo-grade, real-looking agent trace (videos, screenshots, docs) | `pnpm run seed -- support-agent --v4 --id-prefix <hex>` (one fixed, fully handcrafted support-copilot refund run: guardrails, parallel context fan-out, 3-turn ReAct loop with real payloads/costs; deterministic — reseed with a FRESH prefix for a clean take; the prefix is the trace id, so a hex prefix reads like production) |-| A plain trace with no agentic types (collapsed-by-default graph panel) | add `--plain` to `trace-tree` (SPAN/GENERATION/EVENT only) |-| A trace with MORE observations than the detail view loads (v4 caps the tree at 10k, `startTime ASC` — the chronological tail is missing) | `pnpm run seed -- trace-tree --observations 12000 --stride-ms 10 --v4` (`--stride-ms` starts each observation index × N ms in, so start times are unique and strictly increasing: observation index < 10000 loads, `-obs-10000` and up fall past the cap. Without it thousands of rows share one millisecond and the boundary is arbitrary. Re-runs that CHANGE timing flags need a fresh `--id-prefix`: `start_time` is an events ORDER BY key, so both versions persist in the same trace) |-| An extremely DEEP single-chain trace (tree depth = observation count; layout stress) | `pnpm run seed -- deep-chain --v4` (1401 sequential generations, each the sole child of the previous — the mis-parented-instrumentation shape from LFE-10959 that collapses tree/timeline layouts; `--observations N` to change depth) |-| A super tough session (v3 legacy session view) | `pnpm run seed -- long-session --traces 300 --observations-per-trace 8` |-| Diverse v4 session shapes (chat / coding-agent / mixed / media) for the session-detail view | `pnpm run seed -- session-shapes --shape all` (the `agent` shape has I/O on AGENT/TOOL with no GENERATION — pre-LFE-10520 the "first generation" default rendered empty cards for it; the current "All observations with I/O" default renders it correctly; v4 on by default) |+| I need... | Command |+| ------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| A very complex observation tree (v3) | `pnpm run seed -- trace-tree --observations 5000 --depth 12 --breadth 500` |+| The same tree readable in the v4 events UI | add `--v4` (writes `events_full`; `events_core` fills via MV) |+| Async parents whose subtree outlives their own span (subtree wall-clock duration badge) | add `--async-parents` to `trace-tree` (root + hub end immediately while children keep running) |+| A realistic agent flow over a timeline (graph view + scrubbable timeline) | `pnpm run seed -- agent-timeline --turns 6 --v4` (LangGraph refine loop planner→retriever→generator→critic→loop, staggered in time; add `--timing-only` for the pure timing fallback) |+| A trace that is large as a GRAPH (many distinct node names + connections, the trace-graph layout stress) | `pnpm run seed -- agent-graph --v4` (~1,350 distinct connections from 350 observations; `--nodes 120 --steps 100 --parallel 8` crosses the layout ceiling, `--nodes 80 --steps 30 --parallel 4` is small-but-dense) |+| A dozen SMALL traces, each a different timeline shape (the everyday case, not a stress test) | `pnpm run seed -- timeline-shapes --v4` (12 hand-timed traces of 4-25 observations: rag answer, streamed chat with a TTFT split, 8-way fan-out, retry backoff with widening gaps, a 13-minute wait on a human, one slow tool dwarfing everything, an error cascade with failover, in-flight spans with no end time, zero-duration checkpoints, a ten-level ladder, 24 flat siblings, a three-turn agent loop with think time; `--shape <slug>` for one) |+| A row carrying every annotation at once, to judge whether the timeline is overloaded | `pnpm run seed -- timeline-annotated --v4` (ONE trace, 12 observations: one/two/four scores — the last collapsing into `+1` — one and twelve comments, a streaming first-token mark, costs and durations spread so the heat map paints some rows, plain rows beside them for contrast, and all three label placements on screen together) |+| A multi-HOUR agent run (wall clock dominated by waiting, as production ones are) | `pnpm run seed -- agent-timeline --turns 120 --turn-gap-ms 60000 --v4` (~2.5h; the gap is jittered up to 2x, so the work lands at a few percent of the trace instead of packing every span into a few seconds) |+| A demo-grade, real-looking agent trace (videos, screenshots, docs) | `pnpm run seed -- support-agent --v4 --id-prefix <hex>` (one fixed, fully handcrafted support-copilot refund run: guardrails, parallel context fan-out, 3-turn ReAct loop with real payloads/costs; deterministic — reseed with a FRESH prefix for a clean take; the prefix is the trace id, so a hex prefix reads like production) |+| A plain trace with no agentic types (collapsed-by-default graph panel) | add `--plain` to `trace-tree` (SPAN/GENERATION/EVENT only) |+| A trace with MORE observations than the detail view loads (v4 caps the tree at 10k, `startTime ASC` — the chronological tail is missing) | `pnpm run seed -- trace-tree --observations 12000 --stride-ms 10 --v4` (`--stride-ms` starts each observation index × N ms in, so start times are unique and strictly increasing: observation index < 10000 loads, `-obs-10000` and up fall past the cap. Without it thousands of rows share one millisecond and the boundary is arbitrary. Re-runs that CHANGE timing flags need a fresh `--id-prefix`: `start_time` is an events ORDER BY key, so both versions persist in the same trace) |+| An extremely DEEP single-chain trace (tree depth = observation count; layout stress) | `pnpm run seed -- deep-chain --v4` (1401 sequential generations, each the sole child of the previous — the mis-parented-instrumentation shape from LFE-10959 that collapses tree/timeline layouts; `--observations N` to change depth) |+| A super tough session (v3 legacy session view) | `pnpm run seed -- long-session --traces 300 --observations-per-trace 8` |+| Diverse v4 session shapes (chat / coding-agent / mixed / media) for the session-detail view | `pnpm run seed -- session-shapes --shape all` (the `agent` shape has I/O on AGENT/TOOL with no GENERATION — pre-LFE-10520 the "first generation" default rendered empty cards for it; the current "All observations with I/O" default renders it correctly; v4 on by default) || Many sessions for the sessions TABLE and its filters / search bar (not the detail view) | `pnpm run seed -- session-variety --sessions 120 --days 14` (searchable topic ids, 1-3 userIds and 1-3 tags per session, four environments, session metadata `tier`/`region`/`channel`/`topic`, numeric + categorical + boolean session scores, comments on a quarter; v4 on by default. Widen the time-range picker past the default 1 day.) |-| Session messages carrying Langfuse media references (inline image, several refs in one message, bare refs in a content array, link-only payload) | `pnpm run seed -- session-shapes --shape media` — uploads the image/audio/pdf fixtures to MinIO and links them to the observation, so the inline chip and the "Media" strip both resolve (LFE-14815, LFE-9577) |-| Many traces for list/filter performance | `pnpm run seed -- many-traces --count 100000 --days 14` |-| Long-window v4 traffic with cost/latency/token OUTLIERS (outlier chart strip, LFE-14451) | `pnpm run seed -- outlier-traffic --days 90` (diurnal base load + deterministic spikes + hour-long ×8-latency incidents; root AGENT + GENERATION carrying cost + TOOL per trace; v4 on by default) |-| Scores with spaces in the name (filter/grammar testing) | `pnpm run seed -- scored-traces --traces 24 --v4` |-| Custom model definitions reachable from a trace (price editor entry points) | `pnpm run seed -- custom-models --v4` (a tiered model with a condition-gated second tier and one usage type priced at 0, a single-tier model, and a generation whose model matches no definition so its badge opens the create dialog) |-| Lots of scores on every node (dense score badges, tree-row overflow testing) | add `--scores-per-node 12` to `trace-tree` (N distinct scores per observation; try `--depth 2 --breadth 44` for many tall sibling rows) |-| Extra trace tags, incl. mixed case/accents (tag filter ordering) | add `--tags "Zebra,apple,Ärger"` to `trace-tree` (comma-separated, appended to the scenario's own tags) |-| Varied human-annotation queues (annotate UI / keyboard testing) | `pnpm run seed -- annotation-queue --core-items 12` (creates a "core types" queue covering every score-field render path + an "edge cases" queue with archived/stale/partial scores and observation/session/deleted/completed items) |-| Huge/malformed/unicode payloads | `pnpm run seed -- trace-tree --payload-bytes 1000000 --payload-style malformed` (styles: json, text, malformed, unicode, bignum, base64) |-| Big integers beyond 2^53-1 (number-precision testing) | `pnpm run seed -- trace-tree --observations 1 --payload-style bignum` |-| Huge base64 data-URI in ChatML IO (multimodal crash shape, LFE-10152) | `pnpm run seed -- trace-tree --observations 30 --payload-bytes 20000000 --payload-style base64 --v4` (one unbroken multi-MB base64 token in trace + root-observation IO; max 50 MB) |-| See all scenarios and flags | `pnpm run seed -- list --json` |-| Predict without writing | add `--dry-run` |+| Session messages carrying Langfuse media references (inline image, several refs in one message, bare refs in a content array, link-only payload) | `pnpm run seed -- session-shapes --shape media` — uploads the image/audio/pdf fixtures to MinIO and links them to the observation, so the inline chip and the "Media" strip both resolve (LFE-14815, LFE-9577) |+| Many traces for list/filter performance | `pnpm run seed -- many-traces --count 100000 --days 14` |+| Long-window v4 traffic with cost/latency/token OUTLIERS (outlier chart strip, LFE-14451) | `pnpm run seed -- outlier-traffic --days 90` (diurnal base load + deterministic spikes + hour-long ×8-latency incidents; root AGENT + GENERATION carrying cost + TOOL per trace; v4 on by default) |+| Scores with spaces in the name (filter/grammar testing) | `pnpm run seed -- scored-traces --traces 24 --v4` |+| Custom model definitions reachable from a trace (price editor entry points) | `pnpm run seed -- custom-models --v4` (a tiered model with a condition-gated second tier and one usage type priced at 0, a single-tier model, and a generation whose model matches no definition so its badge opens the create dialog) |+| Many project-owned evaluators for gallery infinite-scroll testing | `NEXTAUTH_URL=https://pr-<N>.preview.langfuse.com pnpm run seed -- evaluator-gallery --count 200` (uses the default synthetic seed API key and reconciles deterministic evaluator names; also works against local seeded environments when `NEXTAUTH_URL` is omitted) |+| Lots of scores on every node (dense score badges, tree-row overflow testing) | add `--scores-per-node 12` to `trace-tree` (N distinct scores per observation; try `--depth 2 --breadth 44` for many tall sibling rows) |+| Extra trace tags, incl. mixed case/accents (tag filter ordering) | add `--tags "Zebra,apple,Ärger"` to `trace-tree` (comma-separated, appended to the scenario's own tags) |+| Varied human-annotation queues (annotate UI / keyboard testing) | `pnpm run seed -- annotation-queue --core-items 12` (creates a "core types" queue covering every score-field render path + an "edge cases" queue with archived/stale/partial scores and observation/session/deleted/completed items) |+| Huge/malformed/unicode payloads | `pnpm run seed -- trace-tree --payload-bytes 1000000 --payload-style malformed` (styles: json, text, malformed, unicode, bignum, base64) |+| Big integers beyond 2^53-1 (number-precision testing) | `pnpm run seed -- trace-tree --observations 1 --payload-style bignum` |+| Huge base64 data-URI in ChatML IO (multimodal crash shape, LFE-10152) | `pnpm run seed -- trace-tree --observations 30 --payload-bytes 20000000 --payload-style base64 --v4` (one unbroken multi-MB base64 token in trace + root-observation IO; max 50 MB) |+| See all scenarios and flags | `pnpm run seed -- list --json` |+| Predict without writing | add `--dry-run` |## Contractdiff --git a/packages/shared/scripts/seeder/AGENTS.md b/packages/shared/scripts/seeder/AGENTS.mdindex da391b2e64..ced8c6ac69 100644--- a/packages/shared/scripts/seeder/AGENTS.md+++ b/packages/shared/scripts/seeder/AGENTS.md@@ -28,6 +28,7 @@ pnpm run seed -- many-traces --count 100000 --days 14pnpm run seed -- outlier-traffic --days 90 # diurnal v4 traffic w/ cost/latency/token outliers (outlier chart strip)pnpm run seed -- scored-traces --traces 24 --v4 # scores w/ spaces in the namepnpm run seed -- custom-models --v4 # project-level model definitions (tiered + single-tier, one price at 0) + a trace whose generations link to them, plus one unpriced model+NEXTAUTH_URL=https://pr-<N>.preview.langfuse.com pnpm run seed -- evaluator-gallery --count 200 # project-owned evaluators via the seeded public API key```The last stdout line of a run is a JSON summary with `traceIds`,diff --git a/packages/shared/scripts/seeder/README.md b/packages/shared/scripts/seeder/README.mdindex 6ad577fd6c..b18e7a9eb3 100644--- a/packages/shared/scripts/seeder/README.md+++ b/packages/shared/scripts/seeder/README.md@@ -11,11 +11,12 @@ pnpm run seed -- long-session --traces 300 --observations-per-trace 8pnpm run seed -- many-traces --count 100000 --days 14```-Every run preflights the stack, writes directly to ClickHouse (plus the-Postgres rows the UI needs), verifies its writes with exact readbacks, and-prints UI deep links plus a machine-readable JSON summary as the last stdout-line. This file is the design explainer; the command reference for agents-lives in [AGENTS.md](./AGENTS.md) and the `seed-test-data` skill.+Every run validates its declared target, writes directly to the local+datastores or through a seeded environment's public API, verifies its writes+with exact readbacks, and prints UI deep links plus a machine-readable JSON+summary as the last stdout line. This file is the design explainer; the command+reference for agents lives in [AGENTS.md](./AGENTS.md) and the+`seed-test-data` skill.## Why this exists@@ -36,21 +37,22 @@ programmatic calls from the dx seed chain.## Scenarios-| Scenario | Covers | Key flags |-| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `trace-tree` | one trace with a large, branching observation tree: all ten observation kinds always present, guaranteed depth backbone, hub node with many children, errors/retries/missing end times | `--observations`, `--depth`, `--breadth`, `--payload-bytes`, `--payload-style json\|text\|malformed\|unicode`, `--v4` |-| `agent-timeline` | one trace: a realistic LangGraph-style refine-loop agent (planner → retriever → generator → critic → loop) unrolled over N turns, with observations staggered across a real timeline and langgraph_node/step metadata | `--turns`, `--turn-gap-ms`, `--timing-only` |-| `agent-graph` | one trace that is large as a GRAPH, not as a tree: many distinct langgraph_node names with parallel branches per super-step, so the aggregated graph gets thousands of distinct node-pair connections from a few hundred observations | `--nodes`, `--steps`, `--parallel` |-| `deep-chain` | one trace whose observations form a single deep parent chain of sequential generations (child starts after parent ends; depth = observation count) — the mis-parented-instrumentation shape that collapses tree/timeline layouts at extreme depth | `--observations` |-| `long-session` | one session with many traces for session-detail and virtualization work; creates the Postgres `trace_sessions` row the session page requires | `--traces`, `--observations-per-trace`, `--payload-bytes`, `--minutes`, `--session-id`, `--v4` |-| `many-traces` | trace-list and filter performance via `numbers()` bulk SQL; parent/score/prompt/session links all resolve | `--count`, `--days`, `--observations-per-trace`, `--scores-per-trace`, `--rich-payloads` |-| `outlier-traffic` | diurnal base traffic over the past N days with deterministic cost/latency/token outliers and hour-long latency incidents — built for the outlier chart strip above the trace table | `--days`, `--traces-per-day`, `--incidents` |-| `scored-traces` | standalone traces with mixed current/legacy Python and JavaScript SDK attribution, each carrying numeric + categorical scores whose names contain SPACES (e.g. "Rouge Score") at observation and trace level, plus dual-level score names ("confidence", "verdict") present at both levels on the same trace | `--traces` |-| `session-shapes` | diverse v4 session shapes for the session-detail view: a clean multi-turn CHAT session (renders as chat), a coding/AGENT session whose I/O lives on AGENT/TOOL observations with NO GENERATION, a MIXED session, and a MEDIA session whose messages carry langfuseMedia references | `--shape chat\|agent\|mixed\|media\|all`, `--turns` |-| `annotation-queue` | two human-annotation queues for the annotate UI: a "core types" queue with one of every score-field render path (categorical toggle/combobox, boolean, ranged/decimal/unranged numeric, text) over fresh trace items, and an "edge cases" queue adding archived/stale/partial scores, comments, and observation/session/deleted/completed items | `--core-items`, `--v4` (default true) |-| `custom-models` | project-level model definitions (one tiered with a condition-gated second tier and a usage type priced at 0, one single-tier) plus a trace whose generations link to them, and one generation whose model matches no definition so its badge opens the create dialog | — |-| `support-agent` | one demo-grade, fully handcrafted trace: a customer-support copilot resolving a duplicate-charge refund — input guardrail → intent classification → parallel context fan-out (CRM/billing/tickets) → 3-turn ReAct loop (llm.chat + Stripe tools) → drafted reply → output guardrail → send | — |-| `timeline-shapes` | a dozen SMALL traces (4-25 observations each), one per timeline morphology: rag answer, streamed chat, parallel fan-out, retry backoff with widening gaps, a 13-minute wait on a human, one slow tool dwarfing everything, an error cascade with failover, in-flight spans, zero-duration checkpoints, a ten-level ladder, 24 flat siblings, and a three-turn agent loop | `--shape all\|rag-answer\|streaming-chat\|parallel-fanout\|retry-backoff\|waiting-on-approval\|slow-tool\|error-cascade\|still-running\|checkpoint-marks\|deep-ladder\|flat-siblings\|mixed-loop` |+| Scenario | Covers | Key flags |+| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `trace-tree` | one trace with a large, branching observation tree: all ten observation kinds always present, guaranteed depth backbone, hub node with many children, errors/retries/missing end times | `--observations`, `--depth`, `--breadth`, `--payload-bytes`, `--payload-style json\|text\|malformed\|unicode`, `--v4` |+| `agent-timeline` | one trace: a realistic LangGraph-style refine-loop agent (planner → retriever → generator → critic → loop) unrolled over N turns, with observations staggered across a real timeline and langgraph_node/step metadata | `--turns`, `--turn-gap-ms`, `--timing-only` |+| `agent-graph` | one trace that is large as a GRAPH, not as a tree: many distinct langgraph_node names with parallel branches per super-step, so the aggregated graph gets thousands of distinct node-pair connections from a few hundred observations | `--nodes`, `--steps`, `--parallel` |+| `deep-chain` | one trace whose observations form a single deep parent chain of sequential generations (child starts after parent ends; depth = observation count) — the mis-parented-instrumentation shape that collapses tree/timeline layouts at extreme depth | `--observations` |+| `long-session` | one session with many traces for session-detail and virtualization work; creates the Postgres `trace_sessions` row the session page requires | `--traces`, `--observations-per-trace`, `--payload-bytes`, `--minutes`, `--session-id`, `--v4` |+| `many-traces` | trace-list and filter performance via `numbers()` bulk SQL; parent/score/prompt/session links all resolve | `--count`, `--days`, `--observations-per-trace`, `--scores-per-trace`, `--rich-payloads` |+| `outlier-traffic` | diurnal base traffic over the past N days with deterministic cost/latency/token outliers and hour-long latency incidents — built for the outlier chart strip above the trace table | `--days`, `--traces-per-day`, `--incidents` |+| `scored-traces` | standalone traces with mixed current/legacy Python and JavaScript SDK attribution, each carrying numeric + categorical scores whose names contain SPACES (e.g. "Rouge Score") at observation and trace level, plus dual-level score names ("confidence", "verdict") present at both levels on the same trace | `--traces` |+| `session-shapes` | diverse v4 session shapes for the session-detail view: a clean multi-turn CHAT session (renders as chat), a coding/AGENT session whose I/O lives on AGENT/TOOL observations with NO GENERATION, a MIXED session, and a MEDIA session whose messages carry langfuseMedia references | `--shape chat\|agent\|mixed\|media\|all`, `--turns` |+| `annotation-queue` | two human-annotation queues for the annotate UI: a "core types" queue with one of every score-field render path (categorical toggle/combobox, boolean, ranged/decimal/unranged numeric, text) over fresh trace items, and an "edge cases" queue adding archived/stale/partial scores, comments, and observation/session/deleted/completed items | `--core-items`, `--v4` (default true) |+| `custom-models` | project-level model definitions (one tiered with a condition-gated second tier and a usage type priced at 0, one single-tier) plus a trace whose generations link to them, and one generation whose model matches no definition so its badge opens the create dialog | — |+| `evaluator-gallery` | project-owned code evaluators for gallery pagination and infinite-scroll testing; reconciles deterministic names through the seeded public API key so local and PR preview environments are supported | `--count` |+| `support-agent` | one demo-grade, fully handcrafted trace: a customer-support copilot resolving a duplicate-charge refund — input guardrail → intent classification → parallel context fan-out (CRM/billing/tickets) → 3-turn ReAct loop (llm.chat + Stripe tools) → drafted reply → output guardrail → send | — |+| `timeline-shapes` | a dozen SMALL traces (4-25 observations each), one per timeline morphology: rag answer, streamed chat, parallel fan-out, retry backoff with widening gaps, a 13-minute wait on a human, one slow tool dwarfing everything, an error cascade with failover, in-flight spans, zero-duration checkpoints, a ten-level ladder, 24 flat siblings, and a three-turn agent loop | `--shape all\|rag-answer\|streaming-chat\|parallel-fanout\|retry-backoff\|waiting-on-approval\|slow-tool\|error-cascade\|still-running\|checkpoint-marks\|deep-ladder\|flat-siblings\|mixed-loop` |Common flags: `--project` (defaults to the seeded example project),`--environment`, `--seed`, `--id-prefix`, `--dry-run` (instant, arithmetic@@ -148,10 +150,10 @@ cost.## What's next (deliberately not built yet)-- **API writer**: build the same logical data as public ingestion batches- against `LANGFUSE_BASE_URL` + keys, with batch limits and `--wait`- readback — the same command would then emulate realistic ingestion- against local web+worker or staging.+- **Ingestion API writer**: build trace and observation data as public+ ingestion batches against a target URL, with batch limits and `--wait`+ readback — the same command would then emulate realistic ingestion against+ local web+worker or staging.- **dx presets**: a `scenarios/presets.ts` invoked from the examples seed,selected via `LANGFUSE_SEED_PRESET`, to give default dx data more varietywithout flags or interactivity.diff --git a/packages/shared/scripts/seeder/cli-main.ts b/packages/shared/scripts/seeder/cli-main.tsindex f2b91f73f5..a1e47a806f 100644--- a/packages/shared/scripts/seeder/cli-main.ts+++ b/packages/shared/scripts/seeder/cli-main.ts@@ -294,7 +294,7 @@ const main = async (): Promise<number> => {},};- if (!ctx.dryRun) {+ if (!ctx.dryRun && scenario.target !== "api") {await preflight({projectId: ctx.projectId,needV4: scenario.supportsV4 && params["v4"] === true,diff --git a/packages/shared/scripts/seeder/scenarios/evaluator-gallery.ts b/packages/shared/scripts/seeder/scenarios/evaluator-gallery.tsnew file mode 100644index 0000000000..af3d673a79--- /dev/null+++ b/packages/shared/scripts/seeder/scenarios/evaluator-gallery.ts@@ -0,0 +1,200 @@+import { z } from "zod";+import { DEFAULT_SEED_API_KEY } from "../utils/postgres-seed-constants";+import {+ chunk,+ type ScenarioContext,+ type ScenarioDefinition,+ SeedError,+ type SeedSummary,+} from "./types";++const EvaluatorListResponse = z.object({+ data: z.array(+ z.object({+ id: z.string(),+ name: z.string(),+ }),+ ),+ meta: z.object({ cursor: z.string().optional() }),+});++type EvaluatorSummary = z.infer<typeof EvaluatorListResponse>["data"][number];++const apiHeaders = {+ Authorization: `Basic ${Buffer.from(+ `${DEFAULT_SEED_API_KEY.public}:${DEFAULT_SEED_API_KEY.secret}`,+ ).toString("base64")}`,+ "Content-Type": "application/json",+};++const request = async (+ ctx: ScenarioContext,+ path: string,+ init?: RequestInit,+): Promise<Response> => {+ const response = await fetch(`${ctx.baseUrl}${path}`, {+ ...init,+ headers: { ...apiHeaders, ...init?.headers },+ });+ if (!response.ok) {+ const detail = (await response.text()).slice(0, 500);+ throw new SeedError(+ `Evaluator API ${init?.method ?? "GET"} ${path} returned ${response.status}: ${detail}`,+ "target a seeded local or preview environment with the default synthetic API key",+ );+ }+ return response;+};++const listEvaluators = async (+ ctx: ScenarioContext,+): Promise<EvaluatorSummary[]> => {+ const evaluators: EvaluatorSummary[] = [];+ let cursor: string | undefined;++ do {+ const query = new URLSearchParams({ limit: "100" });+ if (cursor) query.set("cursor", cursor);+ const response = await request(+ ctx,+ `/api/public/v2/evaluators?${query.toString()}`,+ );+ const page = EvaluatorListResponse.parse(await response.json());+ evaluators.push(...page.data);+ cursor = page.meta.cursor;+ } while (cursor);++ return evaluators;+};++const run = async (+ ctx: ScenarioContext,+ params: Record<string, string | number | boolean>,+): Promise<SeedSummary> => {+ const startedAt = Date.now();+ const count = params.count as number;+ if (count < 1 || count > 1_000) {+ throw new SeedError(+ `--count must be between 1 and 1000, got ${count}`,+ "pass a count such as --count 200",+ );+ }++ const namePrefix = `${ctx.idPrefix}-custom-evaluator-`;+ const expectedNames = Array.from(+ { length: count },+ (_, index) => `${namePrefix}${String(index + 1).padStart(4, "0")}`,+ );+ const galleryLink = `${ctx.baseUrl}/project/${ctx.projectId}/evals?gallery=open`;++ if (ctx.dryRun) {+ return {+ scenario: "evaluator-gallery",+ target: "api",+ params,+ projectId: ctx.projectId,+ environment: ctx.environment,+ traceIds: [],+ sessionIds: [],+ counts: { evaluators: count, created: count, deleted: 0 },+ verified: {},+ links: [galleryLink],+ dryRun: true,+ durationMs: Date.now() - startedAt,+ };+ }++ const expectedNameSet = new Set(expectedNames);+ const existing = await listEvaluators(ctx);+ const retainedNames = new Set<string>();+ const toDelete = existing.filter((evaluator) => {+ if (!evaluator.name.startsWith(namePrefix)) return false;+ if (+ !expectedNameSet.has(evaluator.name) ||+ retainedNames.has(evaluator.name)+ ) {+ return true;+ }+ retainedNames.add(evaluator.name);+ return false;+ });+ const toCreate = expectedNames.filter((name) => !retainedNames.has(name));++ ctx.log(+ `reconciling ${count} custom evaluators via ${ctx.baseUrl}: create ${toCreate.length}, delete ${toDelete.length}`,+ );+ for (const batch of chunk(toDelete, 10)) {+ await Promise.all(+ batch.map((evaluator) =>+ request(+ ctx,+ `/api/public/v2/evaluators/${encodeURIComponent(evaluator.id)}`,+ { method: "DELETE" },+ ),+ ),+ );+ }+ for (const batch of chunk(toCreate, 10)) {+ await Promise.all(+ batch.map((name) =>+ request(ctx, "/api/public/v2/evaluators", {+ method: "POST",+ body: JSON.stringify({+ name,+ description: `Synthetic evaluator for gallery pagination: ${name}`,+ type: "code",+ sourceCode:+ "function evaluate() { return { scores: [{ name: 'seed-score', value: 1 }] }; }",+ sourceCodeLanguage: "TYPESCRIPT",+ }),+ }),+ ),+ );+ }++ const readback = await listEvaluators(ctx);+ const verifiedCount = readback.filter((evaluator) =>+ expectedNameSet.has(evaluator.name),+ ).length;+ if (verifiedCount !== count) {+ throw new SeedError(+ `Readback mismatch: expected ${count} custom evaluators, found ${verifiedCount}`,+ );+ }++ return {+ scenario: "evaluator-gallery",+ target: "api",+ params,+ projectId: ctx.projectId,+ environment: ctx.environment,+ traceIds: [],+ sessionIds: [],+ counts: {+ evaluators: count,+ created: toCreate.length,+ deleted: toDelete.length,+ },+ verified: { evaluators: verifiedCount },+ links: [galleryLink],+ dryRun: false,+ durationMs: Date.now() - startedAt,+ };+};++export const evaluatorGalleryScenario: ScenarioDefinition = {+ name: "evaluator-gallery",+ description:+ "Many project-owned code evaluators for testing the evaluator gallery and its infinite scrolling. Reconciles deterministic names through the public evaluator API, so it can target seeded local and PR preview environments.",+ supportsV4: false,+ target: "api",+ flags: [+ {+ flag: "count",+ type: "number",+ default: 200,+ description: "number of project-owned evaluators to keep",+ },+ ],+ run,+};diff --git a/packages/shared/scripts/seeder/scenarios/index.ts b/packages/shared/scripts/seeder/scenarios/index.tsindex a4526c9bca..9541ad0962 100644--- a/packages/shared/scripts/seeder/scenarios/index.ts+++ b/packages/shared/scripts/seeder/scenarios/index.ts@@ -3,6 +3,7 @@ import { agentTimelineScenario } from "./agent-timeline";import { annotationQueueScenario } from "./annotation-queue";import { customModelsScenario } from "./custom-models";import { deepChainScenario } from "./deep-chain";+import { evaluatorGalleryScenario } from "./evaluator-gallery";import { longSessionScenario } from "./long-session";import { manyTracesScenario } from "./many-traces";import { outlierTrafficScenario } from "./outlier-traffic";@@ -23,6 +24,7 @@ export const scenarios: Record<string, ScenarioDefinition> = {"agent-timeline": agentTimelineScenario,"agent-graph": agentGraphScenario,"deep-chain": deepChainScenario,+ "evaluator-gallery": evaluatorGalleryScenario,"long-session": longSessionScenario,"many-traces": manyTracesScenario,"outlier-traffic": outlierTrafficScenario,diff --git a/packages/shared/scripts/seeder/scenarios/types.ts b/packages/shared/scripts/seeder/scenarios/types.tsindex 10d294328b..8436b4c7fa 100644--- a/packages/shared/scripts/seeder/scenarios/types.ts+++ b/packages/shared/scripts/seeder/scenarios/types.ts@@ -18,7 +18,7 @@ export type ScenarioFlag = {export type SeedSummary = {scenario: string;- target: "clickhouse";+ target: "clickhouse" | "api";params: Record<string, string | number | boolean>;projectId: string;environment: string;@@ -50,6 +50,8 @@ export type ScenarioDefinition = {flags: ScenarioFlag[];/** true if the scenario supports mirroring rows into v4 events tables */supportsV4: boolean;+ /** API scenarios authenticate against ctx.baseUrl and do not need local datastore preflight. */+ target?: "local" | "api";run: (ctx: ScenarioContext,params: Record<string, string | number | boolean>,diff --git a/packages/shared/scripts/seeder/seed-postgres.ts b/packages/shared/scripts/seeder/seed-postgres.tsindex f697606961..8e7baa9f9d 100644--- a/packages/shared/scripts/seeder/seed-postgres.ts+++ b/packages/shared/scripts/seeder/seed-postgres.ts@@ -19,6 +19,7 @@ import {import { getDisplaySecretKey, hashSecretKey, logger } from "../../src/server";import { redis } from "../../src/server/redis/redis";import {+ DEFAULT_SEED_API_KEY,EVAL_TRACE_COUNT,FAILED_EVAL_TRACE_INTERVAL,SEED_CHAT_ML_PROMPTS,@@ -204,10 +205,8 @@ async function main() {});const seedApiKey = {- id: "seed-api-key",- secret: process.env.SEED_SECRET_KEY ?? "sk-lf-1234567890", // eslint-disable-line turbo/no-undeclared-env-vars- public: "pk-lf-1234567890",- note: "seeded key",+ ...DEFAULT_SEED_API_KEY,+ secret: process.env.SEED_SECRET_KEY ?? DEFAULT_SEED_API_KEY.secret, // eslint-disable-line turbo/no-undeclared-env-vars};if (!(await prisma.apiKey.findUnique({ where: { id: seedApiKey.id } }))) {diff --git a/packages/shared/scripts/seeder/utils/postgres-seed-constants.ts b/packages/shared/scripts/seeder/utils/postgres-seed-constants.tsindex 8138bea101..4409ad7644 100644--- a/packages/shared/scripts/seeder/utils/postgres-seed-constants.ts+++ b/packages/shared/scripts/seeder/utils/postgres-seed-constants.ts@@ -1,3 +1,10 @@+export const DEFAULT_SEED_API_KEY = {+ id: "seed-api-key",+ public: "pk-lf-1234567890",+ secret: "sk-lf-1234567890",+ note: "seeded key",+} as const;+// Datasetsconst SEED_DATASET_ITEMS_COUNTRIES = [{ input: { country: "France" }, output: "Paris" },diff --git a/web/src/__tests__/server/evaluator-v2-trpc.servertest.ts b/web/src/__tests__/server/evaluator-v2-trpc.servertest.tsindex 9d85dfb987..68cb60c08c 100644--- a/web/src/__tests__/server/evaluator-v2-trpc.servertest.ts+++ b/web/src/__tests__/server/evaluator-v2-trpc.servertest.ts@@ -169,6 +169,61 @@ describe("evalsV2 tRPC", () => {).rejects.toMatchObject({ code: "NOT_FOUND" });});+ it("paginates evaluator gallery results", async () => {+ const search = `Gallery pagination ${randomUUID()}`;+ const created = await Promise.all(+ Array.from({ length: 3 }, (_, index) =>+ caller.evalsV2.create({+ projectId,+ name: `${search} ${index + 1}`,+ description: null,+ definition,+ }),+ ),+ );++ const firstPage = await caller.evalsV2.listGallery({+ projectId,+ search,+ limit: 2,+ });+ const firstPageIds = new Set(+ firstPage.evaluators.map((evaluator) => evaluator.id),+ );+ const remainingId = created.find(+ (evaluator) => !firstPageIds.has(evaluator.id),+ )?.id;+ if (!remainingId) throw new Error("Expected an evaluator on the next page");+ await prisma.evaluator.update({+ where: { id: remainingId },+ data: { updatedAt: new Date(Date.now() + 60_000) },+ });++ const secondPage = await caller.evalsV2.listGallery({+ projectId,+ search,+ limit: 2,+ cursor: firstPage.nextCursor,+ });++ expect(firstPage.evaluators).toHaveLength(2);+ expect(firstPage.totalItems).toBe(3);+ expect(firstPage.nextCursor).toEqual({+ createdAt: expect.any(Date),+ id: expect.any(String),+ });+ expect(secondPage.evaluators).toHaveLength(1);+ expect(secondPage.totalItems).toBeUndefined();+ expect(secondPage.nextCursor).toBeUndefined();+ expect(+ new Set(+ [...firstPage.evaluators, ...secondPage.evaluators].map(+ (evaluator) => evaluator.id,+ ),+ ),+ ).toEqual(new Set(created.map((evaluator) => evaluator.id)));+ });+it("rejects access to another project", async () => {await expect(caller.evalsV2.list({ projectId: otherProjectId }),diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryDialog/EvaluatorGalleryDialog.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryDialog/EvaluatorGalleryDialog.tsxindex e241035d9b..32fe1b19a3 100644--- a/web/src/features/evals/v2/components/EvaluatorGalleryDialog/EvaluatorGalleryDialog.tsx+++ b/web/src/features/evals/v2/components/EvaluatorGalleryDialog/EvaluatorGalleryDialog.tsx@@ -11,12 +11,7 @@ import {import { EvaluatorGalleryView } from "@/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView";import type { GalleryTemplate } from "@/src/features/evals/v2/types/templateGallery";import { prepareEvaluatorGallery } from "@/src/features/evals/v2/fns/templateGallery/prepareEvaluatorGallery";-import {- EVALUATOR_GALLERY_ALL_SECTION_KEY,- EVALUATOR_GALLERY_EXPANDED_PROJECT_LIMIT,- EVALUATOR_GALLERY_PREVIEW_SIZE,- EVALUATOR_GALLERY_PROJECT_SECTION_KEY,-} from "@/src/features/evals/v2/constants/evaluatorGallery";+import { EVALUATOR_GALLERY_ALL_SECTION_KEY } from "@/src/features/evals/v2/constants/evaluatorGallery";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { getEvaluatorCreationAnalyticsProperties } from "@/src/features/evals/v2/fns/evaluators/getEvaluatorCreationAnalyticsProperties";import { api } from "@/src/utils/api";@@ -44,44 +39,42 @@ export function EvaluatorGalleryDialog({);const searchInputRef = useRef<HTMLInputElement | null>(null);const scrollContainerRef = useRef<HTMLDivElement | null>(null);- const projectEvaluators = api.evalsV2.list.useQuery(+ const projectEvaluators = api.evalsV2.listGallery.useInfiniteQuery({projectId,- page: 1,- limit: expandedSections.has(EVALUATOR_GALLERY_PROJECT_SECTION_KEY)- ? EVALUATOR_GALLERY_EXPANDED_PROJECT_LIMIT- : EVALUATOR_GALLERY_PREVIEW_SIZE,+ limit: 50,search: search.trim() || undefined,},{enabled: open && Boolean(projectId),+ getNextPageParam: (lastPage) => lastPage.nextCursor,placeholderData: (previous) => previous,},);- const customTemplates = (projectEvaluators.data?.evaluators ?? []).flatMap(- (evaluator) => {- const latest = evaluator.versions[0];- return latest- ? [- {- id: evaluator.id,- name: evaluator.name,- description: evaluator.description,- type: evaluator.type,- prompt: latest.prompt,- sourceCodeLanguage: latest.sourceCodeLanguage,- updatedAt: evaluator.updatedAt,- version: latest.version,- createdByUser: evaluator.createdByUser,- },- ]- : [];- },- );+ const customTemplates = (+ projectEvaluators.data?.pages.flatMap((page) => page.evaluators) ?? []+ ).flatMap((evaluator) => {+ const latest = evaluator.versions[0];+ return latest+ ? [+ {+ id: evaluator.id,+ name: evaluator.name,+ description: evaluator.description,+ type: evaluator.type,+ prompt: latest.prompt,+ sourceCodeLanguage: latest.sourceCodeLanguage,+ updatedAt: evaluator.updatedAt,+ version: latest.version,+ createdByUser: evaluator.createdByUser,+ },+ ]+ : [];+ });const { navigationItems, sections } = prepareEvaluatorGallery({customTemplates,customTemplateCount:- projectEvaluators.data?.totalItems ?? customTemplates.length,+ projectEvaluators.data?.pages[0]?.totalItems ?? customTemplates.length,search,});const selectSection = (key: string) => {@@ -154,6 +147,9 @@ export function EvaluatorGalleryDialog({onCreateFromScratch={handleCreateFromScratch}scrollContainerRef={scrollContainerRef}isLoading={projectEvaluators.isPending}+ hasMoreProjectTemplates={projectEvaluators.hasNextPage}+ isLoadingMoreProjectTemplates={projectEvaluators.isFetchingNextPage}+ onLoadMoreProjectTemplates={projectEvaluators.fetchNextPage}errorMessage={projectEvaluators.isError? projectEvaluators.error.messagediff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.stories.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.stories.tsxindex cd358acc69..9179abe26e 100644--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.stories.tsx+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.stories.tsx@@ -1,6 +1,6 @@import { useState } from "react";import { User } from "lucide-react";-import { expect, fn, userEvent } from "storybook/test";+import { expect, fn, userEvent, waitFor } from "storybook/test";import { EvalTemplateTypeEnum } from "@langfuse/shared";import preview from "../../../../../../.storybook/preview";import { EvaluatorGalleryView } from "./EvaluatorGalleryView";@@ -206,6 +206,28 @@ export const YourTemplates = meta.story({render: StatefulEvaluatorGalleryView,});+export const LoadsMoreYourTemplates = meta.story({+ name: "(Test) Loads more Your templates",+ args: {+ ...defaultArgs,+ activeSection: "custom",+ navigationItems: defaultArgs.navigationItems.map((item) =>+ item.key === "custom" ? { ...item, count: 51 } : item,+ ),+ sections: sections.map((section) =>+ section.key === "custom" ? { ...section, totalCount: 51 } : section,+ ),+ hasMoreProjectTemplates: true,+ onLoadMoreProjectTemplates: fn(),+ },+ render: StatefulEvaluatorGalleryView,+ play: async ({ args }) => {+ await waitFor(() =>+ expect(args.onLoadMoreProjectTemplates).toHaveBeenCalledOnce(),+ );+ },+});+export const Loading = meta.story({args: {...defaultArgs,@@ -260,5 +282,14 @@ export const SelectsCategory = meta.story({await expect(canvas.queryByRole("heading", { name: "Your templates" }),).not.toBeInTheDocument();+ await expect(+ canvas.getByRole("button", { name: /Quality evaluator 7/ }),+ ).toBeInTheDocument();+ await expect(+ canvas.queryByRole("button", { name: "Show all 7 templates" }),+ ).not.toBeInTheDocument();+ await expect(+ canvas.queryByRole("button", { name: "Show fewer" }),+ ).not.toBeInTheDocument();},});diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.tsxindex d8ae45095e..b3a373b59b 100644--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.tsx+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/EvaluatorGalleryView.tsx@@ -1,4 +1,4 @@-import type { RefObject } from "react";+import { useCallback, type RefObject } from "react";import { Code2, Search, Sparkles } from "lucide-react";import { EvalTemplateTypeEnum, type EvalTemplateType } from "@langfuse/shared";@@ -12,7 +12,10 @@ import type {GalleryNavigationItem,GallerySection,} from "../../types/templateGallery";-import { EVALUATOR_GALLERY_ALL_SECTION_KEY } from "../../constants/evaluatorGallery";+import {+ EVALUATOR_GALLERY_ALL_SECTION_KEY,+ EVALUATOR_GALLERY_PROJECT_SECTION_KEY,+} from "../../constants/evaluatorGallery";import {gallerySidebarItems,visibleGallerySections,@@ -45,6 +48,9 @@ export function EvaluatorGalleryView({onCreateFromScratch,scrollContainerRef,isLoading,+ hasMoreProjectTemplates = false,+ isLoadingMoreProjectTemplates = false,+ onLoadMoreProjectTemplates,errorMessage,}: {search: string;@@ -60,6 +66,9 @@ export function EvaluatorGalleryView({onCreateFromScratch: (type: EvalTemplateType) => void;scrollContainerRef?: RefObject<HTMLDivElement | null>;isLoading: boolean;+ hasMoreProjectTemplates?: boolean;+ isLoadingMoreProjectTemplates?: boolean;+ onLoadMoreProjectTemplates?: () => void;errorMessage?: string;}) {const sidebarItems = gallerySidebarItems(navigationItems, sections);@@ -70,6 +79,44 @@ export function EvaluatorGalleryView({: EVALUATOR_GALLERY_ALL_SECTION_KEY;const displayedSections = visibleGallerySections(sections, resolvedSection);const hasTemplates = displayedSections.length > 0;+ const isSingleSection = resolvedSection !== EVALUATOR_GALLERY_ALL_SECTION_KEY;+ const selectSection = (key: string) => {+ if (key !== resolvedSection) onSearchChange("");+ onSelectSection(key);+ };+ const loadMoreSentinelRef = useCallback(+ (sentinel: HTMLDivElement | null) => {+ if (+ !sentinel ||+ !hasMoreProjectTemplates ||+ isLoadingMoreProjectTemplates ||+ !onLoadMoreProjectTemplates+ ) {+ return;+ }++ const observer = new IntersectionObserver(+ ([entry]) => {+ if (entry?.isIntersecting) {+ observer.disconnect();+ onLoadMoreProjectTemplates();+ }+ },+ { root: scrollContainerRef?.current, rootMargin: "200px 0px" },+ );+ observer.observe(sentinel);+ return () => observer.disconnect();+ },+ [+ hasMoreProjectTemplates,+ isLoadingMoreProjectTemplates,+ onLoadMoreProjectTemplates,+ scrollContainerRef,+ ],+ );+ const shouldLoadMoreProjectTemplates =+ resolvedSection === EVALUATOR_GALLERY_PROJECT_SECTION_KEY &&+ (hasMoreProjectTemplates || isLoadingMoreProjectTemplates);return (<div className="@container flex flex-1 flex-col overflow-hidden">@@ -78,10 +125,7 @@ export function EvaluatorGalleryView({<EvaluatorGallerySidebaritems={sidebarItems}activeSection={resolvedSection}- onSelectSection={(key) => {- if (key !== resolvedSection) onSearchChange("");- onSelectSection(key);- }}+ onSelectSection={selectSection}/>) : (<div aria-hidden="true" className="w-56 shrink-0 border-r" />@@ -140,9 +184,23 @@ export function EvaluatorGalleryView({<EvaluatorGallerySectionkey={section.key}section={section}- expanded={expandedSections.has(section.key)}- onExpandedChange={(expanded) =>- onExpandedChange(section.key, expanded)+ expanded={+ isSingleSection || expandedSections.has(section.key)+ }+ onExpandedChange={+ isSingleSection+ ? undefined+ : (expanded) => {+ if (+ expanded &&+ section.key ===+ EVALUATOR_GALLERY_PROJECT_SECTION_KEY+ ) {+ selectSection(section.key);+ return;+ }+ onExpandedChange(section.key, expanded);+ }}onSelectTemplate={onSelectTemplate}/>@@ -153,6 +211,19 @@ export function EvaluatorGalleryView({</div>)) : null}+ {shouldLoadMoreProjectTemplates ? (+ <div+ ref={+ hasMoreProjectTemplates ? loadMoreSentinelRef : undefined+ }+ className="text-muted-foreground py-2 text-center text-sm"+ role={isLoadingMoreProjectTemplates ? "status" : undefined}+ >+ {isLoadingMoreProjectTemplates+ ? "Loading more templates…"+ : null}+ </div>+ ) : null}</div></div></div>diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsxindex 53edae18ee..3e6878c8b4 100644--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.stories.tsx@@ -22,7 +22,7 @@ function StatefulEvaluatorGallerySection(args: EvaluatorGallerySectionProps) {expanded={expanded}onExpandedChange={(nextExpanded) => {setExpanded(nextExpanded);- args.onExpandedChange(nextExpanded);+ args.onExpandedChange?.(nextExpanded);}}/>);diff --git a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsxindex 9d2664086d..609f4904fc 100644--- a/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx+++ b/web/src/features/evals/v2/components/EvaluatorGalleryView/components/EvaluatorGallerySection/EvaluatorGallerySection.tsx@@ -26,7 +26,7 @@ export function EvaluatorGallerySection({}: {section: GallerySection;expanded: boolean;- onExpandedChange: (expanded: boolean) => void;+ onExpandedChange?: (expanded: boolean) => void;onSelectTemplate: (template: GalleryTemplate) => void;}) {const isRecommended =@@ -79,7 +79,7 @@ export function EvaluatorGallerySection({</div></>)}- {totalCount > EVALUATOR_GALLERY_PREVIEW_SIZE ? (+ {totalCount > EVALUATOR_GALLERY_PREVIEW_SIZE && onExpandedChange ? (<buttontype="button"className="text-muted-foreground hover:text-foreground flex w-fit items-center gap-1.5 px-1 text-sm"diff --git a/web/src/features/evals/v2/constants/evaluatorGallery.ts b/web/src/features/evals/v2/constants/evaluatorGallery.tsindex 1611c7e5d7..c1614028c1 100644--- a/web/src/features/evals/v2/constants/evaluatorGallery.ts+++ b/web/src/features/evals/v2/constants/evaluatorGallery.ts@@ -3,6 +3,5 @@ export const EVALUATOR_GALLERY_PROJECT_SECTION_KEY = "custom";export const EVALUATOR_GALLERY_RECOMMENDED_SECTION_KEY = "recommended";export const EVALUATOR_GALLERY_SAFETY_SECTION_KEY = "safety";export const EVALUATOR_GALLERY_ALL_SECTION_KEY = "all";-export const EVALUATOR_GALLERY_EXPANDED_PROJECT_LIMIT = 100;export const EVALUATOR_GALLERY_SAFETY_CALLOUT ="These evaluators run after the fact on completed traces. They are not real-time guardrails.";diff --git a/web/src/features/evals/v2/server/evaluators/evaluatorRepository.ts b/web/src/features/evals/v2/server/evaluators/evaluatorRepository.tsindex 04a172b887..144a2216f7 100644--- a/web/src/features/evals/v2/server/evaluators/evaluatorRepository.ts+++ b/web/src/features/evals/v2/server/evaluators/evaluatorRepository.ts@@ -330,6 +330,7 @@ export async function listEvaluatorsCursor(params: {projectId: string;limit: number;cursor?: { createdAt: Date; id: string };+ search?: string;}) {const baseWhere = await evaluatorWhere(params);const where: Prisma.EvaluatorWhereInput = params.cursor@@ -368,6 +369,15 @@ export async function listEvaluatorsCursor(params: {};}+export async function countEvaluators(params: {+ prisma: PrismaClient;+ projectId: string;+ search?: string;+}) {+ const where = await evaluatorWhere(params);+ return params.prisma.evaluator.count({ where });+}+export async function listEvaluatorFilterOptions(params: {prisma: PrismaClient;projectId: string;diff --git a/web/src/features/evals/v2/server/evaluators/evaluatorRouter.ts b/web/src/features/evals/v2/server/evaluators/evaluatorRouter.tsindex ae9afa4115..bb0cca9a1a 100644--- a/web/src/features/evals/v2/server/evaluators/evaluatorRouter.ts+++ b/web/src/features/evals/v2/server/evaluators/evaluatorRouter.ts@@ -15,6 +15,7 @@ import {EvaluatorIdsSchema,EvaluatorOptionsSchema,EvaluatorVersionsSchema,+ ListEvaluatorGallerySchema,ListEvaluatorsSchema,SuggestEvaluatorTextSchema,UpdateEvaluatorSchema,@@ -67,6 +68,30 @@ export const evaluatorRouter = createTRPCRouter({});}),+ listGallery: protectedProjectProcedure+ .input(ListEvaluatorGallerySchema)+ .query(async ({ input, ctx }) => {+ throwIfNoProjectAccess({+ session: ctx.session,+ projectId: ctx.session.projectId,+ scope: "evaluator:read",+ });+ const service = serviceForContext(ctx);+ const params = {+ ...input,+ projectId: ctx.session.projectId,+ };+ const [result, totalItems] = await Promise.all([+ service.listCursor(params),+ input.cursor ? undefined : service.count(params),+ ]);++ return {+ ...result,+ totalItems,+ };+ }),+filterOptions: protectedProjectProcedure.input(ListEvaluatorsSchema.pick({ projectId: true })).query(({ ctx }) => {diff --git a/web/src/features/evals/v2/server/evaluators/evaluatorService.ts b/web/src/features/evals/v2/server/evaluators/evaluatorService.tsindex 4d2eb7b16f..85ca3c6b8c 100644--- a/web/src/features/evals/v2/server/evaluators/evaluatorService.ts+++ b/web/src/features/evals/v2/server/evaluators/evaluatorService.ts@@ -104,6 +104,7 @@ export class EvaluatorService {projectId: string;limit: number;cursor?: { createdAt: Date; id: string };+ search?: string;}) {return repository.listEvaluatorsCursor({prisma: this.prisma,@@ -111,6 +112,13 @@ export class EvaluatorService {});}+ count(params: { projectId: string; search?: string }) {+ return repository.countEvaluators({+ prisma: this.prisma,+ ...params,+ });+ }+listFilterOptions(projectId: string) {return repository.listEvaluatorFilterOptions({prisma: this.prisma,diff --git a/web/src/features/evals/v2/server/evaluators/evaluatorTypes.ts b/web/src/features/evals/v2/server/evaluators/evaluatorTypes.tsindex 3e80c4f9bc..bd3e7d137f 100644--- a/web/src/features/evals/v2/server/evaluators/evaluatorTypes.ts+++ b/web/src/features/evals/v2/server/evaluators/evaluatorTypes.ts@@ -200,6 +200,18 @@ export const ListEvaluatorsSchema = z.object({filter: EvaluatorListFilterSchema,});+export const ListEvaluatorGallerySchema = z.object({+ projectId: z.string(),+ cursor: z+ .object({+ createdAt: z.date(),+ id: z.string(),+ })+ .optional(),+ limit: paginationLimitZod.optional().default(50),+ search: z.string().trim().max(200).optional(),+});+export const EvaluatorOptionsSchema = z.object({projectId: z.string(),search: z.string().trim().max(200).optional(),