:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(aio): update online-eval skill to unpinned provider key (#70447)
posthog[bot]4ff4ac1bf094
diff --git a/products/ai_observability/skills/creating-online-evaluations/SKILL.md b/products/ai_observability/skills/creating-online-evaluations/SKILL.mdindex 3bb48acf78b8..df6d33149989 100644--- a/products/ai_observability/skills/creating-online-evaluations/SKILL.md+++ b/products/ai_observability/skills/creating-online-evaluations/SKILL.md@@ -5,8 +5,9 @@ description: >mode you've identified. Use when the user wants an evaluation that automatically scores new generationsor whole traces going forward — "create an eval to catch X", "continuously check that responses do Y","turn this failure into an eval". Covers choosing the target and eval type (hog / llm_judge / sentiment),- gating on the team's provider key before an llm_judge eval, scoping which generations trigger it via- conditions (property filters + rollout sampling), creating it disabled, verifying scope, and enabling.+ configuring a provider, model, and usable provider key for an llm_judge eval, scoping which generations+ trigger it via conditions (property filters + rollout sampling), creating it disabled, verifying scope,+ and enabling.Finding and ranking the failure modes worth evaluating is its own job — use exploring-ai-failures first.To debug or manage evaluations that already exist, use exploring-llm-evaluations.---@@ -30,7 +31,8 @@ debugging a live eval), defer to `exploring-llm-evaluations`.| Tool | Purpose || -------------------------------------- | ------------------------------------------------------------- |-| `posthog:llma-provider-key-list` | Find a usable (`ok` state) provider key to pin (llm_judge) |+| `posthog:llma-evaluation-config-get` | Check the active provider key used by unpinned judges |+| `posthog:llma-provider-key-list` | Find a usable (`ok` state) provider key to pin || `posthog:llma-evaluation-judge-models` | List valid provider+model combos || `posthog:llma-evaluation-test-hog` | Dry-run Hog source against recent generations before creating || `posthog:llma-evaluation-create` | Create the evaluation (always `enabled: false` first) |@@ -63,7 +65,7 @@ tool call must include an `order_id`". Then move to Phase 2.| Use… | When the criterion is… || ----------- | ------------------------------------------------------------------------------------------------------------------------------------- || `hog` | Structural / rule-based (JSON parses, length, regex, tool-call shape). Cheap, deterministic, **no provider key needed.** |-| `llm_judge` | Subjective / fuzzy (tone, factuality, on-topic). Costs an LLM call per run; needs AI data-processing approval + a provider key. |+| `llm_judge` | Subjective / fuzzy (tone, factuality, on-topic). Costs an LLM call per run; needs a provider, model, and usable provider key. || `sentiment` | You want sentiment labels on user messages, not a pass/fail (unless very specifically asked for, usually not relevant to this skill). |Reach for `hog` first, escalate to `llm_judge` if there is no deterministic way to check for what we want to check.@@ -104,20 +106,29 @@ evaluators. Do not use target-specific globals in new source that needs to workprojections recognize common provider payloads but are not authoritative; use `item.input` / `item.output` whenexact structure matters.-### 2.3 — Gate (llm_judge only)+### 2.3 — Configure the LLM judge-Before creating an `llm_judge` eval, confirm it can actually run, or it errors on first fire. Hog and-sentiment skip this.+An `llm_judge` evaluation requires a valid `provider` and `model`. It also needs a usable provider key+when it runs. `provider_key_id` controls whether the evaluation pins one specific key:++- Set `provider_key_id` to the UUID of an `ok`-state key for the same provider to pin it.+- Set `provider_key_id` to `null` to use the team's active provider key. The active key must be in the+ `ok` state and use the same provider as `model_configuration.provider`.++Hog and sentiment evaluations skip this step.```json-posthog:llma-provider-key-list // pick a key whose state == "ok"+posthog:llma-evaluation-config-get // check active_provider_key for an unpinned judge+posthog:llma-provider-key-list // find an ok-state key to pinposthog:llma-evaluation-judge-models // { "provider": "openai" } → valid models```-Every `llm_judge` eval runs on a provider key. Pick an `ok`-state key from `llma-provider-key-list` and set-it as `model_configuration.provider_key_id`.+Confirm the provider and model with `llma-evaluation-judge-models`. Prefer pinning the chosen key so a later+team-wide active-key change does not change how the evaluation runs. Leave `provider_key_id` as `null` only+after `llma-evaluation-config-get` confirms the active key is usable and its provider matches.-If there's no `ok` key, stop and ask the user to add/validate one in the UI — the agent can't create keys.+If there is no usable key, you may still create a disabled draft for the user to review. Do not spot-run or+enable it. Ask the user to add or validate a key in the UI before continuing.### 2.4 — Create it disabled@@ -143,7 +154,8 @@ posthog:llma-evaluation-createFor `llm_judge`, swap `evaluation_config` to `{ "prompt": "…" }` and add`"model_configuration": { "provider": "openai", "model": "gpt-5-mini", "provider_key_id": "<uuid of an ok-state key from llma-provider-key-list>" }`.-Full field reference: [references/evaluation-payload.md](references/evaluation-payload.md).+Use `null` only when the active team key is `ok` and uses the same provider. Full field reference:+[references/evaluation-payload.md](references/evaluation-payload.md).### 2.5 — Verify the scope before enabling@@ -222,7 +234,8 @@ creating so the user can review and toggle it in the UI.criterion genuinely can't be coded.- **Always create disabled, verify scope, then enable.** An eval firing on the wrong events is worse thannone — noise, and (for llm_judge) cost.-- **Gate llm_judge before creating**, not after. A judge eval with no usable provider key errors on first run.+- **Configure llm_judge credentials before running.** A judge needs a valid provider and model plus a usable+ provider key. `provider_key_id` may be `null` only when the matching active team key can be used.- **`bytecode` is server-written** for hog evals — never pass it; send only `evaluation_config.source`.- For cluster-scoped evals, identify the cluster with `exploring-llm-clusters`, then translate its eventfilter into `conditions`.diff --git a/products/ai_observability/skills/creating-online-evaluations/references/evaluation-payload.md.j2 b/products/ai_observability/skills/creating-online-evaluations/references/evaluation-payload.md.j2index ddfd2f2fefe0..aae5ee9bf1b3 100644--- a/products/ai_observability/skills/creating-online-evaluations/references/evaluation-payload.md.j2+++ b/products/ai_observability/skills/creating-online-evaluations/references/evaluation-payload.md.j2@@ -13,7 +13,7 @@ schemas below are rendered from the backend Pydantic models at build time, so th| `evaluation_config` | yes | Shape depends on `evaluation_type` (below). || `output_type` | yes | `"boolean"` for `hog`/`llm_judge`; `"sentiment"` for `sentiment`. || `output_config` | no | `{ "allows_na": bool }` for boolean; `{}` for sentiment. |-| `model_configuration` | llm_judge only | Provider/model/key. Rejected on `hog`/`sentiment`. |+| `model_configuration` | llm_judge only | Provider + model; key ID optional. Rejected on `hog`/`sentiment`. || `target` | no | `"generation"` (default) or `"trace"`. Sentiment supports only `"generation"`. || `target_config` | trace only | Settle config discriminated on `strategy` (below); defaults to a 1800-second fixed window. || `conditions` | no | Trigger condition sets (below). For traces, conditions match the triggering generation. |@@ -77,9 +77,11 @@ Empty object: `{}`.| ----------------- | -------- | ------------------------------------------------------------------------------ || `provider` | yes | One of `openai`, `anthropic`, `gemini`, `openrouter`, `fireworks`, `azure_openai`, `together_ai`. || `model` | yes | Model id, e.g. `gpt-5-mini`. Validate against `llma-evaluation-judge-models`. |-| `provider_key_id` | yes | UUID of an `ok`-state `LLMProviderKey` from `llma-provider-key-list`. |+| `provider_key_id` | no | UUID of an `ok`-state key for the same provider. `null` uses the matching active team key. |-Pin `provider_key_id` to an `ok`-state key; the eval runs on that key.+`provider` and `model` are required. Pin `provider_key_id` to run on one specific key. Leave it `null` only+when `llma-evaluation-config-get` shows an `ok`-state active key for the same provider. A disabled draft may+be saved without a usable key, but it cannot be tested or enabled until a key can be resolved.## `conditions`@@ -170,3 +172,6 @@ matters."enabled": false}```++Set `provider_key_id` to `null` only when the team's active key is in the `ok` state and its provider is+`openai`.