Skip to content

Agents service & evals ​

Agents worker (services/agents) ​

Headless Worker for model-driven Agents (distinct from the in-workspace coding agent in conductor). Plan docs under docs/plans/agents/. Shares Triggers with Workflows; still an Agent when Trigger-started (Glossary).

Side-envs deploy brilliant-agents-<env> when the branch carries this service. Studio may open an agents WebSocket directly (VITE_AGENTS_URL on side-envs).

Gap: this seed does not deep-dive ThreadDO/RunDO internals — expand from docs/plans/agents/ when Outline is live.

Feature flag gate (#505, merged) ​

On main since 2026-10-06 (yoni-monday, merge 4d2fcd0d). Agents sits behind the agents platform flag (boolean, default off for everyone), set per tenant or user in Admin Feature Flags.

  • UI: without the flag, the Agents settings section and the mobile Agents tab are hidden, and the AgentDock doesn't mount (so it stops polling /agents). A direct link to /settings/agents* shows a "not available" notice instead of the page.
  • API: every session-authenticated control-plane route in agents.ts, agent-grants.ts, and agent-skills.ts returns 403 {error:"feature_disabled"} unless the flag is exactly true (fails closed).
  • Threads: adding a kind:"agent" participant, on POST /threads or POST /threads/:id/participants, returns the same 403 without the flag, and nothing is created. Threads with only user participants work as before, and Threads itself stays reachable. Existing agents stop taking on new thread work while the flag is off.
  • Independent of the workflows flag; see Workflows, feature flag gate.
  • Known gap: no test yet asserts the AgentDock stays unmounted without the flag (accepted as a follow-up in review).

Evals (services/evals) ​

Measures vibe-coding / app-builder quality on real multi-turn Studio runs. Metrics derived from D1 tables (runs, scenario_runs, turns, scores).

Existing wiki seed: docs/wiki/modules/evals.md (pass@1, create vs extend splits, flake/cost, scoreboard, CLI bun scripts/evals.ts).

Nightly / dashboard model pin: merged #173 moved the Sol slot from gpt-6-sol to gpt-6.1-sol (Bedrock Responses path on conductor). First nightly on the new id is still the multi-turn soak (encrypted reasoning round-trips / compaction).

P0/P1 metric dictionary and actor vs Jev judge notes live there — prefer that page over re-copying numbers here.

Runner config (resolveRunnerConfig) may load .dev.vars via Secrets Manager. Unit tests inject loadVars so they never spawn aws (live lookups timed out the 5s test on CI and laptops). See Secrets & environments (#135).

Evals Docker image workspace copies (#419, merged) ​

services/evals/Dockerfile copies selected packages/* into the image, then runs bun install --frozen-lockfile --production. Bun refuses a lockfile workspace that is listed but missing on disk.

After #345, @brilliant/capabilities depends on @brilliant/service-contracts. The Dockerfile therefore must COPY packages/service-contracts alongside models and capabilities. Without that line, every staging (and thus prod) deploy fails at the evals build with depends on workspace "@brilliant/service-contracts" … listed in bun.lock but not on disk.

Rule: every workspace package a copied package depends on must be copied too. services/evals/test/image-files.test.ts asserts this. The older dry-run test cannot catch it — it symlinks the repo’s node_modules.

Evals D1 migrations on deploy (#172 via #295, merged) ​

deploy.yml runs wrangler d1 migrations list / apply for evals before the evals Worker deploy (same shape as the admin step). Without it, cron failed with no such table: runs while migrations sat unapplied.

Staging was migrated by hand on 2026-09-30, so the step is a no-op there until new migrations land. After #406, this step (and the evals deploy) run on staging only — prod CD skips them.

Automatic eval scheduling paused (#580, merged) ​

Evals no longer run on a schedule. The hourly 0 * * * * cron that started nightly runs has been removed from both deployed evals Workers (staging and production) via the Cloudflare schedules API, and the readback for each is schedules: []. This is already live (2026-10-07); no Worker or container deploy was needed.

  • Repo side (#580, merged 2026-10-07 14:30 IDT, yoni-monday, merge 66400b50): services/evals/wrangler.jsonc on main now sets "triggers": { "crons": [] }, so a staging evals deploy from main keeps scheduling off. services/evals/README.md ("Nightly run") says the same. Config and docs only, no application logic changed.
  • Still available: manual runs (POST /api/trigger/nightly with the evals key; {"force": true} runs even when nothing changed), past results, and all infrastructure (Worker, D1, R2).
  • Re-enabling: put the cron back in wrangler.jsonc and deploy staging. The nightly policy in services/evals/README.md (models, budgets, run only when something deployed since that model's last finished nightly, judge canaries on the 03:00 tick) applies again once hourly scheduling returns.

Evals staging-only (#406, merged) ​

Evals drives agents against the staging studio. Production is not a deploy target.

GuardBehaviour
CD (deploy.yml)Evals Worker deploy + D1 migrations are if: BRILLIANT_ENV != 'prod'
Direct deployscripts/env/deploy.ts assertDeployable refuses evals for production and side envs
Renderscripts/env/lib/render.ts does not render a prod evals config
Secrets catalogNo catalog entry may list evals as a consumer in prod (evals-never-receives-prod-secrets; full-table test in infra/secrets/catalog.test.ts). EVALS_KEY / TYPESAFE_API_KEY are DEPLOYED_OUTSIDE_PROD. Staging evals deliberately receives SESSION_SECRET / PUBLIC_GUARD as a privileged peer (no LangSmith ids after #959) — compromise can mint staging sessions; EVALS_KEY protects that HTTP surface
Image startupRunner stays on the production dependency graph: narrow scripts/env/lib/*.js imports (not the barrel), include jev-lint, retain production-only bun install. test/image-files.test.ts rebuilds the layout, runs --production install, and starts the runner with no config — exit 2 (missing config) is healthy; exit 1 “Cannot find module” is an image gap

Ops: production brilliant-evals hourly cron was removed (API readback empty; staging hourly was unchanged at the time, and has since also been removed, see Automatic eval scheduling paused). Production Worker / D1 / R2 are retained; normal CD cannot reintroduce production evals. Cron removal is not HTTP Worker retirement — tracked as #410. Timer consolidation without changing alarm log contracts is #411.

Deploy / identity: from a clean main, bun run deploy --env staging inside services/evals (goes through deploy.ts; refuses dirty tree / non-main). Do not bare wrangler deploy. Fixture IDs in wrangler.jsonc are staging-database-assigned — after a staging DB rebuild or fixture deletion, re-run bun scripts/evals-identity.ts --env staging, update the reported EVALS_USER_ID / EVALS_TENANT_ID / EVALS_EMAIL, and redeploy. The script detects stale IDs; it does not invent them. Canonical preview host follows the conductor (PREVIEW_HOST / resolveRunnerConfig). Open #447: if that host is missing, evals throws (no brilliant.lighting default) — see Hosting — no lighting fallbacks.

Local bun run dev / wrangler dev for evals also targets the staging studio once credentials are configured (deliberate — can create staging apps and spend staging model budget).

Source of truth: gotchas/evals.md.

PostHog LLM analytics / evals trace artifact (#959, merged) ​

#959 (merged 2026-10-15 14:48 IDT by yoni-monday, merge e2107120, head 28de255f, branch posthog-3-llm-analytics) changes how evals build the trace artifact.

What landed:

  • The runner no longer reads anything back from LangSmith. runner/turn-trace.ts builds the trace artifact from the turn transcript (model calls, tool calls with args, results and errors).
  • Entries carry no per-call timing, so the trace has none.
  • Migration 0012_drop_langsmith_run_id.sql drops the column; the dashboard loses only the LangSmith link.
  • Side note: privileged peer config no longer passes LangSmith ids (see Secrets); it still gets SESSION_SECRET / PUBLIC_GUARD.

Full design: PostHog — LLM analytics (#959, merged).

Jev linter eval corpus (#981, merged) ​

PR #981 (merged 2026-10-17 09:07 IDT, merge 644fe79c) adds @brilliant/jev-linter-eval (packages/jev-linter-eval): 407 labeled fixtures, recorded Jev answers, and a harness that scores precision, recall and F1 per rule and sweeps cutoffs. bun run eval with TYPESAFE_API_KEY unset replays the recordings; bun run eval:jev without a key exits 2. The harness still calls TypeSafe over HTTP, so TYPESAFE_API_KEY stays an optional consumers: ["evals"] catalog entry. At merge (jev-1.13.0) every rule scored F1 1.00 at its cutoff; watch the margins on int/catch-integrations-error and mut/optimistic-update.

See Semantic lint (Jev linter).

Evals dashboard login is POST-only (#1015, merged) ​

PR #1015 (merged 2026-10-18 17:23 IDT by yoni-monday, merge 49dddd9e) changes handleLogin in services/evals/src/dashboard/auth.ts. EVALS_KEY is now read only from a POST /login form body (key=<EVALS_KEY>). A ?key= query parameter is ignored on both GET and POST, so GET /login?key=… now returns 401 with no cookie. The reason: workers_dev is still enabled, and a key in the URL could end up in browser history, Referer and access logs. The /login-required page's form already posts to /login, so signing in through the page works as before; bookmarks or scripts that used ?key= need to switch to a POST. On success it still sets an HttpOnly, Secure, SameSite=Lax session cookie and redirects to /.