Trace-native CI/CD for AI agents — production failures become regression tests that block the PR. Auto-detect, cluster, freeze into hermetic cases, replay in CI for $0.
Python agentagent-observabilityai-agentsci-cdclickhouseevalsevaluationllmllm-as-judgellm-evaluationllm-observabilityllm-opsllmopsmcpmonitoringopentelemetrypythonself-hostedtracing
feat: add Evaluators page and manager for improved trace evaluation
Wuthrich Julien8031ebdad151
diff --git a/frontend/app/(app)/evaluators/page.tsx b/frontend/app/(app)/evaluators/page.tsxnew file mode 100644index 0000000..15636c7--- /dev/null+++ b/frontend/app/(app)/evaluators/page.tsx@@ -0,0 +1,25 @@+import { DocLink } from "@/app/components/DocLink";+import { EvaluatorsManager } from "@/app/components/EvaluatorsManager";++export const metadata = { title: "Evaluators · Tracely" };++/** Every evaluator in one place. They are still the columns of the traces table — this is the+ * same editor, reachable without first finding the "Add Column" button on a grid. */+export default function EvaluatorsPage() {+ return (+ <div className="space-y-6">+ <header className="reveal">+ <div className="flex items-center gap-3">+ <h1 className="font-display text-[26px] font-extrabold tracking-tight">Evaluators</h1>+ <DocLink path="/product/traces" />+ </div>+ <p className="mt-1.5 max-w-3xl text-[14px] text-fg-muted">+ The checks that grade every new run — deterministic structural checks and LLM-judge rubrics. Each one is a+ column on the Traces table; a <span className="text-fg">FAIL</span> on a non-advisory evaluator fails the+ run, feeds failure clustering, and can fire an alert.+ </p>+ </header>+ <EvaluatorsManager />+ </div>+ );+}diff --git a/frontend/app/(app)/settings/alerts/new/page.tsx b/frontend/app/(app)/settings/alerts/new/page.tsxindex bff56f6..a530c38 100644--- a/frontend/app/(app)/settings/alerts/new/page.tsx+++ b/frontend/app/(app)/settings/alerts/new/page.tsx@@ -12,9 +12,9 @@ export const metadata = { title: "New alert · Tracely" };export default async function NewAlertPage({searchParams,}: {- searchParams: Promise<{ recipe?: string }>;+ searchParams: Promise<{ recipe?: string; score?: string; name?: string }>;}) {- const { recipe } = await searchParams;+ const { recipe, score, name } = await searchParams;const index = recipe === undefined ? -1 : Number(recipe);if (recipe !== undefined && (Number.isNaN(index) || index < 0 || index >= RECIPES.length)) notFound();const picked = index >= 0 ? RECIPES[index] : undefined;@@ -30,8 +30,14 @@ export default async function NewAlertPage({),];- const draft = emptyDraft(picked?.draft ?? {});- const steps: StepDraft[] = (picked?.steps ?? []).map((s, i) => ({+ // `?score=` comes from an evaluator's "Alert on fail": scope the rule to that column, and drop the+ // recipe's example condition step — left in, it would quietly filter out most real failures.+ const draft = emptyDraft({+ ...(picked?.draft ?? {}),+ ...(score ? { score_name: score, name: `${name || score} failing live` } : {}),+ });+ const recipeSteps = (picked?.steps ?? []).filter((s) => !score || s.step_type !== "condition");+ const steps: StepDraft[] = recipeSteps.map((s, i) => ({id: newStepId(),order_index: i,name: s.name,diff --git a/frontend/app/components/Activation.tsx b/frontend/app/components/Activation.tsxindex 1f484f5..6dc4d05 100644--- a/frontend/app/components/Activation.tsx+++ b/frontend/app/components/Activation.tsx@@ -99,7 +99,7 @@ with tracely.trace(agent="support", conversation="conv-1"):Evaluators are the columns of the traces table — structural checks run free, an LLMjudge grades the answer. This ticks when one actually produces a verdict on your trace.</p>- <Action href="/traces">Add a column on Traces →</Action>+ <Action href="/evaluators">Add an evaluator →</Action></>),},diff --git a/frontend/app/components/EvaluatorsManager.tsx b/frontend/app/components/EvaluatorsManager.tsxnew file mode 100644index 0000000..fb07441--- /dev/null+++ b/frontend/app/components/EvaluatorsManager.tsx@@ -0,0 +1,123 @@+"use client";++import Link from "next/link";+import { useEffect, useState } from "react";+import { EVALUATOR_RECIPE } from "../lib/alerts";+import { deleteColumnError, deleteEvaluator, listEvaluators, updateEvaluator, type EvaluatorDef } from "../lib/evaluators";+import { AddColumnModal } from "./AddColumnModal";+import { Toggle } from "./Toggle";+import { Badge } from "./ui";++const LEVEL_LABEL: Record<string, string> = {+ CONVERSATION: "Conversation", AGENT_RUN: "Message", SPAN: "Step",+ TOOL: "Tool step", GENERATION: "Generation step", CHAIN: "Chain step",+};++/** The /evaluators list: create, edit, arm/disarm, delete — and a one-click alert per column. */+export function EvaluatorsManager() {+ const [rows, setRows] = useState<EvaluatorDef[] | null>(null);+ const [modal, setModal] = useState<{ open: boolean; editing: EvaluatorDef | null }>({ open: false, editing: null });+ const [err, setErr] = useState<string | null>(null);++ const reload = () => void listEvaluators().then(setRows);+ useEffect(reload, []);++ async function toggle(ev: EvaluatorDef, enabled: boolean) {+ try {+ const d = await updateEvaluator(ev.id, { enabled });+ setRows((prev) => prev?.map((x) => (x.id === d.id ? d : x)) ?? null);+ } catch {+ setErr(`Could not ${enabled ? "enable" : "disable"} “${ev.name}”.`);+ }+ }++ async function remove(ev: EvaluatorDef) {+ if (!confirm(`Delete evaluator “${ev.name}”? Its column disappears from the traces table.`)) return;+ try {+ await deleteEvaluator(ev.id);+ setRows((prev) => prev?.filter((x) => x.id !== ev.id) ?? null);+ } catch (e) {+ setErr(deleteColumnError(e, ev.name));+ }+ }++ return (+ <section className="reveal card overflow-hidden">+ <div className="flex items-center justify-between border-b border-line px-4 py-3">+ <span className="text-[13px] font-semibold text-fg">+ Evaluators {rows ? <span className="font-mono text-[11px] text-fg-faint">({rows.length})</span> : null}+ </span>+ <button onClick={() => setModal({ open: true, editing: null })} className="btn-primary text-[12.5px]">+ + New evaluator+ </button>+ </div>++ {err ? (+ <p role="alert" className="border-b border-line px-4 py-2 text-[12.5px] text-fail">+ {err}+ </p>+ ) : null}++ {rows === null ? (+ <div className="px-4 py-12 text-center text-[13px] text-fg-faint">Loading…</div>+ ) : rows.length === 0 ? (+ <div className="px-4 py-12 text-center text-[13px] text-fg-muted">+ No evaluators yet. Start from the template library — most teams begin with a tool-success check and a+ goal-completion judge.+ <div className="mt-4">+ <button onClick={() => setModal({ open: true, editing: null })} className="btn-primary text-[12.5px]">+ Browse templates+ </button>+ </div>+ </div>+ ) : (+ <div className="divide-y divide-line">+ {rows.map((ev) => (+ <div key={ev.id} className="flex flex-wrap items-center gap-x-3 gap-y-2 px-4 py-3.5">+ <div className="min-w-0 flex-1">+ <div className="flex flex-wrap items-center gap-2">+ <button+ onClick={() => setModal({ open: true, editing: ev })}+ className="text-[13.5px] font-medium text-fg transition-colors hover:text-signal"+ >+ {ev.name}+ </button>+ <Badge variant={ev.kind === "llm_judge" ? "signal" : "info"}>+ {ev.kind === "llm_judge" ? "LLM judge" : "Check"}+ </Badge>+ <span className="font-mono text-[10.5px] text-fg-faint">{LEVEL_LABEL[ev.level] ?? ev.level}</span>+ </div>+ {ev.description ? (+ <p className="mt-1 truncate text-[12px] text-fg-muted">{ev.description}</p>+ ) : null}+ </div>+ <div className="flex items-center gap-1.5">+ <Toggle checked={ev.enabled} onChange={(next) => toggle(ev, next)} label={ev.enabled ? "on" : "off"} />+ <Link+ href={`/settings/alerts/new?recipe=${EVALUATOR_RECIPE}&score=${encodeURIComponent(ev.score_name)}&name=${encodeURIComponent(ev.name)}`}+ className="btn-ghost text-[12px]"+ title="Create an alert that fires when this evaluator fails a live run"+ >+ Alert on fail+ </Link>+ <button onClick={() => setModal({ open: true, editing: ev })} className="btn-ghost text-[12px]">+ Edit+ </button>+ <button onClick={() => remove(ev)} className="btn-ghost text-[12px]" title="Delete">+ ✕+ </button>+ </div>+ </div>+ ))}+ </div>+ )}++ <AddColumnModal+ open={modal.open}+ editing={modal.editing}+ onClose={() => setModal({ open: false, editing: null })}+ onSaved={reload}+ />+ </section>+ );+}diff --git a/frontend/app/components/Sidebar.tsx b/frontend/app/components/Sidebar.tsxindex 7a202cd..ff28f8b 100644--- a/frontend/app/components/Sidebar.tsx+++ b/frontend/app/components/Sidebar.tsx@@ -6,7 +6,7 @@ import { usePathname } from "next/navigation";import type { Me } from "@/app/lib/auth/types";import { AccountMenu } from "./AccountMenu";import { DOCS_URL } from "@/app/lib/site";-import { IconActivity, IconBell, IconBolt, IconBook, IconCard, IconDatabase, IconGate, IconGrid, IconLayers, IconScale, IconSettings, IconShield, IconTrend, IconUsers } from "./icons";+import { IconActivity, IconBell, IconBolt, IconBook, IconCard, IconCheck, IconDatabase, IconGate, IconGrid, IconLayers, IconScale, IconSettings, IconShield, IconTrend, IconUsers } from "./icons";type NavItem = { href: string; label: string; Icon: typeof IconGrid; exact?: boolean; external?: boolean };@@ -22,6 +22,7 @@ const NAV: { group: string; items: NavItem[] }[] = [items: [{ href: "/clusters", label: "Failure clusters", Icon: IconLayers },{ href: "/traces", label: "Traces", Icon: IconActivity },+ { href: "/evaluators", label: "Evaluators", Icon: IconCheck },{ href: "/trends", label: "Trends", Icon: IconTrend },],},@@ -35,13 +36,16 @@ const NAV: { group: string; items: NavItem[] }[] = [},{group: "Runs",- items: [{ href: "/gates", label: "CI gates", Icon: IconGate }],+ items: [+ { href: "/gates", label: "CI gates", Icon: IconGate },+ // Alerts are a working tool, not a setting — the route stays under /settings for old links.+ { href: "/settings/alerts", label: "Alerts", Icon: IconBell },+ ],},{group: "Configure",items: [{ href: "/settings/api-keys", label: "API keys", Icon: IconSettings },- { href: "/settings/alerts", label: "Alerts", Icon: IconBell },{ href: "/settings/data", label: "Data", Icon: IconDatabase },{ href: "/settings/team", label: "Team", Icon: IconUsers },// The ONLY route to billing — deliberately not duplicated in the AccountMenu dropdown,diff --git a/frontend/app/lib/alerts.test.ts b/frontend/app/lib/alerts.test.tsindex 09e053e..97cd4dc 100644--- a/frontend/app/lib/alerts.test.ts+++ b/frontend/app/lib/alerts.test.ts@@ -1,5 +1,6 @@import { describe, expect, it } from "vitest";import {+ EVALUATOR_RECIPE,RECIPES,TRIGGERS,draftProblem,@@ -128,3 +129,11 @@ describe("RECIPES", () => {}});});++describe("EVALUATOR_RECIPE", () => {+ it("points at a trace_failed recipe scoped by score_name", () => {+ const r = RECIPES[EVALUATOR_RECIPE];+ expect(r?.draft.type).toBe("trace_failed");+ expect(r?.draft).toHaveProperty("score_name");+ });+});diff --git a/frontend/app/lib/alerts.ts b/frontend/app/lib/alerts.tsindex 47de2ac..41efea3 100644--- a/frontend/app/lib/alerts.ts+++ b/frontend/app/lib/alerts.ts@@ -227,6 +227,10 @@ export const RECIPES: { title: string; why: string; draft: Partial<Draft>; steps},];+/** The recipe an evaluator's "Alert on fail" opens (`?recipe=…&score=<score_name>`). Found by+ * shape, not position, so reordering the gallery can't point the link at the wrong alert. */+export const EVALUATOR_RECIPE = RECIPES.findIndex((r) => r.draft.type === "trace_failed" && "score_name" in r.draft);+export function emptyDraft(patch: Partial<Draft> = {}): Draft {return { ...BASE, ...patch };}diff --git a/frontend/app/lib/quest.ts b/frontend/app/lib/quest.tsindex 1b5ca29..9836b98 100644--- a/frontend/app/lib/quest.ts+++ b/frontend/app/lib/quest.ts@@ -140,8 +140,8 @@ export function deriveSteps(s: QuestStatus, l: QuestLocal): QuestStep[] {group: "Explore",title: "Add an evaluator column",detail: "Evaluators are the columns of the traces table — every new run gets graded automatically.",- href: "/traces",- cta: "+ Add column on Traces",+ href: "/evaluators",+ cta: "Add an evaluator",done: s.evaluators > 0,},{