: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
fix(aio): have agents enable the evals people approve (#128245)
Bernat Torresb09a33d4303b
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 8013e8f0ce44..ea60bc5161a7 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -1905,9 +1905,9 @@ snapshots:components-mcp-hint-toast--sql-execute--light:hash: v1.k794b7964.074a12be4bb4b4e8d0e96dfb2b204e18690ad62d12a402c5d32baf83aa923d58.Lm28qnogGZySU6YYFH4LxDZhNyMlrk5N3PwlwWa4CB0components-mcp-use-case-card--ai-observability-evaluations-create--dark:- hash: v1.k794b7964.937b1bd9fca1facf1588992cf7ad79eb12455c5c30455163f383f02fc3aea5fd.AoZo4BbPEVhhOhr1cGOHYOFg_OcSWMrqH5rcXW8blWY+ hash: v1.k794b7964.33923387c2136960a85be798a93ea8a30d1d0421ac84aadb9a2301671c96fa24.ryRu_8rxX99LG2aLkyXkNIDGxK8vBe92Sngi1cJh9fMcomponents-mcp-use-case-card--ai-observability-evaluations-create--light:- hash: v1.k794b7964.7f1fe4358cb1f7a55ae13dee39888d7429ddec56f82fe61db9128e7631ee76f0.kVBmsSuAVFHUdgfuZX8JUuM3l5XHarGa8oYDA3rjv8g+ hash: v1.k794b7964.758cfec3c8714b86c2e5946f27d9104dfa4a993a6749b0c142dc07ecc9d323dd.HwVYmief57ucBI3kz3ocNlDRYmQhV8eQJlz2DvWYPGccomponents-mcp-use-case-card--dashboards-create--dark:hash: v1.k794b7964.882b81373f07d8e8ba905e72da374b487bbca22689cc1988da41a710976b8cdc.iILpg7P0SDKzpVtX6XOKCm5jRLBI83TF2NdsFrZBrFIcomponents-mcp-use-case-card--dashboards-create--light:diff --git a/frontend/src/lib/components/MCPHint/prompts.ts b/frontend/src/lib/components/MCPHint/prompts.tsindex 55c915d58458..de134521298e 100644--- a/frontend/src/lib/components/MCPHint/prompts.ts+++ b/frontend/src/lib/components/MCPHint/prompts.ts@@ -30,7 +30,7 @@ export type SurfacePrompts = {}const AI_OBSERVABILITY_EVALUATION_PROMPT =- "Use the connected PostHog MCP server and this project's AI observability data to inspect recent traces. Identify and rank real failure modes, with an example trace for each. Recommend one evaluation per failure mode, and say whether it should return pass/fail, a score, or categories. If this project has no AI provider key, still create the LLM judges and tell me how to add a key so they can run. Ask which ones I want before creating anything. Create them disabled, test each on a few recent generations, and show me the results before enabling."+ "Use the connected PostHog MCP server and this project's AI observability data to inspect recent traces. Identify and rank real failure modes, with an example trace for each. Recommend one evaluation per failure mode, and say whether it should return pass/fail, a score, or categories. If this project has no AI provider key, still create the LLM judges and tell me how to add a key so they can run. Ask which ones I want before creating anything. Create them disabled, test each on a few recent generations, show me the results, and ask me once whether to enable them. Enable the ones I approve."export const FALLBACK_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {'feature_flags.create': {diff --git a/products/ai_observability/mcp/tools.yaml b/products/ai_observability/mcp/tools.yamlindex 265d538ef646..dbeec22f4a3a 100644--- a/products/ai_observability/mcp/tools.yaml+++ b/products/ai_observability/mcp/tools.yaml@@ -566,21 +566,22 @@ tools:idempotent: falsetitle: Create evaluationdescription: >- Create an evaluation. 'llm_judge': set evaluation_config.prompt and model_configuration with provider and- model; provider_key_id may be null when no key is pinned. An llm_judge runs on one of the team's own AI- provider keys, and keys can't be added through MCP. Check llma-evaluation-config-get and- llma-provider-key-list first: pin an ok-state key with provider_key_id when one exists. With no usable key,- still create the judge with enabled=false, and tell the user it starts scoring once a project admin adds a- key in Settings > AI observability > Bring your own key (BYOK) and enables it. 'hog':- evaluation_config.source (Hog returning a boolean, a finite number, or category keys). For 'hog' and- 'llm_judge', choose output_type='boolean', 'numeric', or 'categorical'; numeric output_config accepts min,- max, step, allows_na, and passing_rule; categorical output_config accepts options, selection_mode,- allows_na, and passing_rule. 'sentiment': output_type='sentiment', omit model_configuration, optional- evaluation_config.source='user_messages'. To tag or classify generations into labels (what taggers used to- do), use output_type='categorical' with selection_mode='multiple'. `target` accepts 'generation' (default),- 'trace', or 'session'. A session target runs once per `$ai_session_id` and defaults to the 'inactivity'- settle strategy. Pass `enabled` as a boolean (true to start scoring new $ai_generation events immediately,- false to create it paused). To organize the evaluation, pass a `directory_id` returned by+ Create an evaluation that scores live traffic. Don't use it to record evals that run elsewhere (CI, local+ eval suites); those are offline experiments. 'llm_judge': set evaluation_config.prompt and+ model_configuration with provider and model; provider_key_id may be null when no key is pinned. An llm_judge+ runs on one of the team's own AI provider keys, and keys can't be added through MCP. Check+ llma-evaluation-config-get and llma-provider-key-list first: pin an ok-state key with provider_key_id when+ one exists. With no usable key, still create the judge with enabled=false, and tell the user it starts+ scoring once a project admin adds a key in Settings > AI observability > Bring your own key (BYOK) and+ enables it. 'hog': evaluation_config.source (Hog returning a boolean, a finite number, or category keys).+ For 'hog' and 'llm_judge', choose output_type='boolean', 'numeric', or 'categorical'; numeric output_config+ accepts min, max, step, allows_na, and passing_rule; categorical output_config accepts options,+ selection_mode, allows_na, and passing_rule. 'sentiment': output_type='sentiment', omit model_configuration,+ optional evaluation_config.source='user_messages'. To tag or classify generations into labels (what taggers+ used to do), use output_type='categorical' with selection_mode='multiple'. `target` accepts 'generation'+ (default), 'trace', or 'session'. A session target runs once per `$ai_session_id` and defaults to the+ 'inactivity' settle strategy. Pass `enabled` as a boolean (true to start scoring new $ai_generation events+ immediately, false to create it paused). To organize the evaluation, pass a `directory_id` returned byllma-evaluation-directory-list. Omit `directory_id` or pass null to keep it at the top level. Results are'$ai_evaluation' events. An evaluation only scores data that arrives after it is enabled, so once it isenabled, offer the user a backfill over past data with llma-evaluation-backfill-estimate.diff --git a/products/ai_observability/skills/creating-online-evaluations/SKILL.md b/products/ai_observability/skills/creating-online-evaluations/SKILL.mdindex 569375072dde..b6bb155c2703 100644--- a/products/ai_observability/skills/creating-online-evaluations/SKILL.md+++ b/products/ai_observability/skills/creating-online-evaluations/SKILL.md@@ -347,9 +347,13 @@ Each now runs on every new matching generation, or once per matching trace for aone-and-done: the user should be aware that they need to keep an eye on results and iterate if the outcomeis not the expected one. To wire results into a Slack feed, see `feature-usage-feed`.+If the user asked to see results before anything goes live, show the test results for the whole set and ask+once, in the same reply: "Enable these N now?" Enable the ones they approve right away, in this session. Don't+end the conversation on a list of drafts: an eval nobody answered about stays disabled and never runs.+Close the loop across the whole set at once — one short list of what's now live with a link each, not a-play-by-play per eval. Mention any candidate you left disabled (no usable provider key, volume too high to-enable yet) and what would unblock it.+play-by-play per eval. Mention any candidate you left disabled (the user said no, no usable provider key,+volume too high to enable yet), what would unblock it, and the link to enable it later.### 2.7 — Offer to evaluate past data@@ -428,6 +432,9 @@ creating so the user can review and toggle it in the UI.- **A judge draft needs only a provider and model.** A usable provider key is needed to enable it, not tosave it, so no `ok` key means keep it disabled — not stop. `provider_key_id` may be `null` to run on theteam's active key.+- **Online evals are for live traffic, not a registry.** Don't create disabled online evals as records or+ placeholders for evals that run elsewhere (CI, a local eval folder, a test suite). Record those as offline+ experiments (`analyzing-offline-evaluations`). Every online eval you create should be one you mean to enable.- **`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/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 787ceffea1b3..c0ecb108eb39 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -9054,7 +9054,7 @@}},"llma-evaluation-create": {- "description": "Create an evaluation. 'llm_judge': set evaluation_config.prompt and model_configuration with provider and model; provider_key_id may be null when no key is pinned. An llm_judge runs on one of the team's own AI provider keys, and keys can't be added through MCP. Check llma-evaluation-config-get and llma-provider-key-list first: pin an ok-state key with provider_key_id when one exists. With no usable key, still create the judge with enabled=false, and tell the user it starts scoring once a project admin adds a key in Settings > AI observability > Bring your own key (BYOK) and enables it. 'hog': evaluation_config.source (Hog returning a boolean, a finite number, or category keys). For 'hog' and 'llm_judge', choose output_type='boolean', 'numeric', or 'categorical'; numeric output_config accepts min, max, step, allows_na, and passing_rule; categorical output_config accepts options, selection_mode, allows_na, and passing_rule. 'sentiment': output_type='sentiment', omit model_configuration, optional evaluation_config.source='user_messages'. To tag or classify generations into labels (what taggers used to do), use output_type='categorical' with selection_mode='multiple'. `target` accepts 'generation' (default), 'trace', or 'session'. A session target runs once per `$ai_session_id` and defaults to the 'inactivity' settle strategy. Pass `enabled` as a boolean (true to start scoring new $ai_generation events immediately, false to create it paused). To organize the evaluation, pass a `directory_id` returned by llma-evaluation-directory-list. Omit `directory_id` or pass null to keep it at the top level. Results are '$ai_evaluation' events. An evaluation only scores data that arrives after it is enabled, so once it is enabled, offer the user a backfill over past data with llma-evaluation-backfill-estimate.",+ "description": "Create an evaluation that scores live traffic. Don't use it to record evals that run elsewhere (CI, local eval suites); those are offline experiments. 'llm_judge': set evaluation_config.prompt and model_configuration with provider and model; provider_key_id may be null when no key is pinned. An llm_judge runs on one of the team's own AI provider keys, and keys can't be added through MCP. Check llma-evaluation-config-get and llma-provider-key-list first: pin an ok-state key with provider_key_id when one exists. With no usable key, still create the judge with enabled=false, and tell the user it starts scoring once a project admin adds a key in Settings > AI observability > Bring your own key (BYOK) and enables it. 'hog': evaluation_config.source (Hog returning a boolean, a finite number, or category keys). For 'hog' and 'llm_judge', choose output_type='boolean', 'numeric', or 'categorical'; numeric output_config accepts min, max, step, allows_na, and passing_rule; categorical output_config accepts options, selection_mode, allows_na, and passing_rule. 'sentiment': output_type='sentiment', omit model_configuration, optional evaluation_config.source='user_messages'. To tag or classify generations into labels (what taggers used to do), use output_type='categorical' with selection_mode='multiple'. `target` accepts 'generation' (default), 'trace', or 'session'. A session target runs once per `$ai_session_id` and defaults to the 'inactivity' settle strategy. Pass `enabled` as a boolean (true to start scoring new $ai_generation events immediately, false to create it paused). To organize the evaluation, pass a `directory_id` returned by llma-evaluation-directory-list. Omit `directory_id` or pass null to keep it at the top level. Results are '$ai_evaluation' events. An evaluation only scores data that arrives after it is enabled, so once it is enabled, offer the user a backfill over past data with llma-evaluation-backfill-estimate.","category": "AI observability","feature": "llm_analytics","summary": "Create evaluation",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 223d4ed24336..1ab643deb7b9 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -9320,7 +9320,7 @@}},"llma-evaluation-create": {- "description": "Create an evaluation. 'llm_judge': set evaluation_config.prompt and model_configuration with provider and model; provider_key_id may be null when no key is pinned. An llm_judge runs on one of the team's own AI provider keys, and keys can't be added through MCP. Check llma-evaluation-config-get and llma-provider-key-list first: pin an ok-state key with provider_key_id when one exists. With no usable key, still create the judge with enabled=false, and tell the user it starts scoring once a project admin adds a key in Settings > AI observability > Bring your own key (BYOK) and enables it. 'hog': evaluation_config.source (Hog returning a boolean, a finite number, or category keys). For 'hog' and 'llm_judge', choose output_type='boolean', 'numeric', or 'categorical'; numeric output_config accepts min, max, step, allows_na, and passing_rule; categorical output_config accepts options, selection_mode, allows_na, and passing_rule. 'sentiment': output_type='sentiment', omit model_configuration, optional evaluation_config.source='user_messages'. To tag or classify generations into labels (what taggers used to do), use output_type='categorical' with selection_mode='multiple'. `target` accepts 'generation' (default), 'trace', or 'session'. A session target runs once per `$ai_session_id` and defaults to the 'inactivity' settle strategy. Pass `enabled` as a boolean (true to start scoring new $ai_generation events immediately, false to create it paused). To organize the evaluation, pass a `directory_id` returned by llma-evaluation-directory-list. Omit `directory_id` or pass null to keep it at the top level. Results are '$ai_evaluation' events. An evaluation only scores data that arrives after it is enabled, so once it is enabled, offer the user a backfill over past data with llma-evaluation-backfill-estimate.",+ "description": "Create an evaluation that scores live traffic. Don't use it to record evals that run elsewhere (CI, local eval suites); those are offline experiments. 'llm_judge': set evaluation_config.prompt and model_configuration with provider and model; provider_key_id may be null when no key is pinned. An llm_judge runs on one of the team's own AI provider keys, and keys can't be added through MCP. Check llma-evaluation-config-get and llma-provider-key-list first: pin an ok-state key with provider_key_id when one exists. With no usable key, still create the judge with enabled=false, and tell the user it starts scoring once a project admin adds a key in Settings > AI observability > Bring your own key (BYOK) and enables it. 'hog': evaluation_config.source (Hog returning a boolean, a finite number, or category keys). For 'hog' and 'llm_judge', choose output_type='boolean', 'numeric', or 'categorical'; numeric output_config accepts min, max, step, allows_na, and passing_rule; categorical output_config accepts options, selection_mode, allows_na, and passing_rule. 'sentiment': output_type='sentiment', omit model_configuration, optional evaluation_config.source='user_messages'. To tag or classify generations into labels (what taggers used to do), use output_type='categorical' with selection_mode='multiple'. `target` accepts 'generation' (default), 'trace', or 'session'. A session target runs once per `$ai_session_id` and defaults to the 'inactivity' settle strategy. Pass `enabled` as a boolean (true to start scoring new $ai_generation events immediately, false to create it paused). To organize the evaluation, pass a `directory_id` returned by llma-evaluation-directory-list. Omit `directory_id` or pass null to keep it at the top level. Results are '$ai_evaluation' events. An evaluation only scores data that arrives after it is enabled, so once it is enabled, offer the user a backfill over past data with llma-evaluation-backfill-estimate.","category": "AI observability","feature": "llm_analytics","summary": "Create evaluation",