* feat: add Phoenix LLM tracing service to the dev stack (ai profile) * chore(deps): add openinference pydantic-ai instrumentation (dev) * feat: export assistant traces to Phoenix when BASEROW_ASSISTANT_PHOENIX_URL is set * fix: harden Phoenix tracing setup after review * feat: Phoenix postgres storage, ai-evals profile and auth support * docs: ADR 007 and assistant tracing/evals guides * feat: assistant eval platform core (types, registries, scenarios) * feat: eval harness with shared assistant factory * feat: phoenix dataset sync for assistant evals * feat: assistant eval experiments via phoenix client + CLI * feat: migrate core, database and docs evals to the platform Ports the 42 kuma-core/kuma-database/kuma-docs pytest evals into declarative EvalCase/EvalScenario registrations, plus structure-level tests asserting dataset counts, ids, and scenario wiring. * feat: migrate builder and automation evals to the platform Ports the 12 builder + 2 proactive + 2 user-source cases into evals/datasets/builder.py (kuma-builder, 16 cases) and the 7 automation cases into evals/datasets/automation.py (kuma-automation), following the Task 5 pattern established in core.py/database.py. Extends eval_platform/test_datasets.py with counts, id lists, a mode-per-case assertion, and pre_state snapshot checks for the two cases that need one. * fix: link traces and final counts for single-case eval runs * fix: root spans for single-case eval runs use the assistant tracer provider * feat: assistant eval runner service with run page Adds the assistant_eval_runner management command (migrate -> instrumentation -> dataset sync -> single worker thread -> wsgiref server) and its runner.py module: a stdlib WSGI app serving a plain server-rendered page (GET /, POST /run, GET /healthz) backed by a bounded in-memory run history and one background worker draining a queue.Queue via run.run_experiment_for. Wires the assistant-eval-runner compose service (ai-evals profile, own baserow_evals DB), renames phoenix-db-init to ai-evals-db-init and extends it to also create baserow_evals, and adds BASEROW_EVAL_RUNNER_PORT to both env example files and the dev docs. * fix: eval runner integration fixes assistant-eval-runner needs its own SECRET_KEY/DATABASE_*/REDIS_* env vars: dev-overlay compose services don't inherit docker-compose.yml's x-backend-variables anchor (that's file-scoped YAML), so the container was starting without a Django SECRET_KEY and without a Redis password, crashing on auth. Also links to finished experiments pointed at the container-internal BASEROW_ASSISTANT_PHOENIX_URL (http://phoenix:6006), unreachable from the developer's browser. Adds BASEROW_ASSISTANT_PHOENIX_PUBLIC_URL (defaulting to http://localhost:${BASEROW_PHOENIX_PORT:-6060}) and has runner.py build the Phoenix link from it, deep-linking straight to the finished run's experiment compare view when its dataset_id/experiment_id are known, falling back to the datasets list otherwise. * refactor: retire the pytest eval harness All 65 eval cases now live in baserow_enterprise.assistant.evals.datasets; delete the legacy pytest-based suite and its `eval` markers. * docs: rewrite assistant evals guide for the Phoenix platform * feat: docs judge, prompt sync, git stamping and UI-contributed eval examples - answer_quality LLM-as-judge evaluator for kuma-docs (BASEROW_EVAL_JUDGE_MODEL) - Kuma prompts versioned into Phoenix on sync; experiments stamped with prompt hashes, git branch/commit and judge model - sync preserves UI-added dataset examples with prompt-match adoption; eval-export emits paste-ready docs.py snippets - final-review fixes: skip-safe scoring, runner CSRF/bind hardening, doc corrections * feat: eval runner UI round — tabs, fan-out, reference answers, 64-case docs dataset - Runner page: dataset tabs with selection badges, per-dataset and global all/none, cross-dataset fan-out (one experiment per dataset), 5s auto-refresh of runs, persistent run history across restarts, per-dataset Phoenix links, in-page Help tab rendering the repo docs via /docs.json. - Reference answers for kuma-docs: EvalCase.reference_answer, judge grades against it, sync preserves UI-curated ones, eval-export round-trips them. - kuma-docs grown to 64 cases: reference answers for all, PostHog-mined frequent questions, and cannot-do guardrail cases. - Gemini (google:gemini-3.6-flash) in the eval model list. * feat: runnable UI examples, prompt overrides, eval baseline and results view - UI-added Phoenix examples now execute: docs questions get the standard docs checks + judge; tool cases declare scenario/expected_tools/ answer_contains in metadata (empty-workspace default scenario). They are tickable per dataset on the runner page and run in whole-dataset experiments too. - Prompt overrides: run any experiment with a prompt's latest Phoenix version instead of the code constant (runner checkbox panel with soft per-tab ordering, or --override-prompt). Agent singletons keep their dynamic instructions; effective hashes + override list stamped on the experiment. - Committed baseline snapshot (evals/baseline.json, 111 cases) with just b eval-baseline capture/import; the runner imports it on startup so every Phoenix instance gets a baseline experiment per dataset, idempotent by content hash and run count. - Results tab: all datasets in one view for a named experiment, with baseline deltas and a case-weighted overall row, via Phoenix experiment annotation summaries. - New evaluation guide (docs/testing/ai-assistant-eval-analysis.md) served in the Help tab; layout uses horizontal space better (single tab row, fluid case columns). * feat: time and cost in eval results, frozen into the baseline snapshot - Results tab gains time (sum of run latencies) and cost/token columns per dataset and summed overall, with lower-is-better baseline deltas. - eval-baseline capture freezes each dataset's time/cost/token totals into baseline.json; import stamps them as metadata so imported baselines (which carry no traces to price) still show time and cost. - Importing a new baseline supersedes the previously imported one instead of accumulating duplicates. - Changelog entry for the eval platform. * fix: OpenInference attributes on subset-run task root spans Bare wrapper spans rendered as kind 'unknown' with Unset status and empty input/output in Phoenix. The Task root span now carries the CHAIN kind, the case prompt as input, the run result as JSON output, and an explicit OK status. * polish; minor fixes * fix: address eval platform review feedback Apply production model settings and retries, isolate automation checks, and fix runner configuration, links, and result status. Defer GPT-5.6 compatibility and baseline comparisons to #6034. * fix: preserve model profiles in rebased eval harness Use an explicit model profile for evals and share concrete models with tools. Manage model clients through the existing lifecycle helper and preserve regression coverage from the retired harness. * fix: harden eval persistence and Phoenix access
4.7 KiB
007: AI assistant eval and observability platform
Status: accepted (2026-08-21). Tracing, the eval framework (111 cases in 5
datasets), and the runner are shipped (2026-08-24); the pytest harness is
retired. Judge evaluators are shipped for kuma-docs (answer_quality);
other datasets don't have a judge yet.
The problem
The AI assistant has ~38 LLM evals that exist only as opt-in pytest tests
(-m eval) run on individual laptops. There is no shared place to run them,
compare models and providers, inspect traces, or track quality, cost, and
latency over time. We need one standard, team-wide way to evaluate the
assistant.
Decision
Self-host Arize Phoenix as the eval and LLM-observability platform, plus a small eval runner service we own:
- Traces: the assistant's pydantic-ai OTel spans are exported to Phoenix
(OpenInference format) whenever
BASEROW_ASSISTANT_PHOENIX_URLis set. See AI assistant tracing. - Evals as code: eval cases live in the codebase as declarative dataset items with code evaluators, and are synced idempotently into Phoenix (stable case ids; the codebase is authoritative for code-owned cases — removed cases are removed from the dataset, so ids must never be renamed). Examples added from the Phoenix UI are preserved across syncs until promoted to code (matched and adopted by prompt) or deleted in the UI. The former pytest harness is retired; AI assistant evals is the runbook.
- Runner: a dev-stack service that executes the real agent against a dataset (from a minimal run page, a management command, or CI later) and records results as Phoenix experiments — scores, cost, latency, traces.
- Judges as code: LLM-as-judge evaluators are pydantic-ai agents versioned in the repo, optionally grounded on the assistant's knowledge base. Phoenix's UI-configured evaluators stay available for ad-hoc use but are not the standard.
Why Phoenix?
A structural fact drove the choice: no platform executes your Python agent server-side. "Run evals from a UI" therefore requires a self-owned runner on every platform — which removes the main advantage of the heavier candidates and makes footprint, licensing, and integration quality decisive.
| Candidate | Verdict |
|---|---|
| Phoenix | 1 container, Postgres-backed; zero feature gates; free auth/RBAC/OAuth2; first-party pydantic-ai instrumentation; datasets/experiments/playground/cost tracking included. |
| Langfuse v4 | Full feature set, MIT, native remote-run webhook — but 6 required containers (ClickHouse, Redis, MinIO, …) with no lighter profile. |
| Opik | No authentication at all in self-hosted OSS, ~9 containers, no UI batch runs of a real agent. |
| LangSmith, Braintrust, W&B Weave | Self-hosting is enterprise-contract only. |
| promptfoo, MLflow, agenta, Laminar | Wrong shape (YAML evals, view-only UI, weak velocity, or gated alerts). |
Key choices
- Storage: Postgres everywhere — locally a
phoenixdatabase in the dev stack's existing Postgres (created by the one-shotai-evals-db-initservice), a dedicated Postgres for the shared team instance. No storage drift between dev and team. - Compose profile: Phoenix runs under
ai-evals, separate fromai(assistant prerequisites), so using the assistant never requires Phoenix. - Off by default, additive to PostHog:
BASEROW_ASSISTANT_PHOENIX_URLempty disables the export entirely; PostHog LLM analytics stays the production path (dual export is a config-only change — see AI assistant tracing). - Auth: team instances enable Phoenix auth; ingest authenticates with a
system API key via
BASEROW_ASSISTANT_PHOENIX_API_KEY. - Dependencies are dev-group only (
openinference-instrumentation-pydantic-ai, laterarize-phoenix-client); the export degrades with a logged warning if they are missing, so production images are unaffected.
Consequences and risks
- Phoenix is ELv2 (source-available): free for internal self-hosting, forbids only reselling Phoenix itself as a service.
- The dev stack's Postgres 14 is exactly Phoenix's minimum version; if a future Phoenix raises the floor, Phoenix gets its own database container again.
- The Phoenix image,
openinference-instrumentation-pydantic-ai, andarize-phoenix-clientversions are one upgrade unit; pydantic-ai upgrades can silently degrade trace quality (the span rewriting is untyped), so re-verify a trace after upgrading either side. - We own the runner: a small service to build and maintain, in exchange for running the real agent (not a prompt approximation) from a UI.