: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
feat(dashboards): offer a subscription after a dashboard gains content (#88657)
Vasco de Krijger8e03ecbda236
diff --git a/products/dashboards/mcp/tools.yaml b/products/dashboards/mcp/tools.yamlindex c4b5554d839c..b5e30ea667cf 100644--- a/products/dashboards/mcp/tools.yaml+++ b/products/dashboards/mcp/tools.yaml@@ -31,6 +31,20 @@ tools:an investigation with a narrative, intermediate steps, and a conclusion belongs in a notebook (`searchnotebooks-`), which interleaves prose with executable SQL and Python cells. When a deep dive turns up a fewmetrics worth tracking, save those as insights rather than reshaping the analysis into a dashboard.+ agent_note: Consider offering the user a recurring delivery of this dashboard as a next step, but only when the+ dashboard in this response has tiles on it. Creating from a template (`use_template`) or duplicating another+ dashboard (`use_dashboard`) usually starts with tiles, though duplicating an empty dashboard does not. A+ dashboard with no tiles has nothing to deliver, and subscriptions-create needs at least one chart, so say+ nothing about subscriptions until it has some. Describe it the way a person would recognize it, for example+ a weekly email every Monday morning with these charts attached, or the same thing posted to a Slack channel.+ To create it, use subscriptions-create. It needs `dashboard` set to the dashboard's id,+ `dashboard_export_insights` listing up to 10 charts, `target_type` of `email` or `slack`, and+ `target_value`, `frequency`, `interval` and `start_date`. For a Slack delivery, also set `integration_id`.+ Find the connected Slack workspace with integrations-list (filter kind=slack) and the channel for+ `target_value` with integrations-channels-retrieve. Ask the user for the recipients and the cadence rather+ than choosing them, since this creates a recurring outbound delivery. If either subscriptions-create or+ subscriptions-list is not available to you in this session, say nothing about subscriptions. If the user+ already declined a subscription earlier in this conversation, do not offer again.exclude_params:- creation_mode- effective_restriction_leveldiff --git a/products/product_analytics/mcp/tools.yaml b/products/product_analytics/mcp/tools.yamlindex a6e0b18eb3ae..6d9da2d26783 100644--- a/products/product_analytics/mcp/tools.yaml+++ b/products/product_analytics/mcp/tools.yaml@@ -183,6 +183,22 @@ tools:Update a saved insight by numeric `id` or `short_id`. Can update name, description, query, tags, favoritedstatus, and dashboards. Returns insight metadata only — after updating the query, call the insight-querytool with the same identifier if you want to see the recomputed results.+ agent_note:+ If this update added the insight to a dashboard through the `dashboards` field, consider offering the user a+ recurring delivery of that dashboard as a next step. `dashboards` is a full replacement, so only offer when+ the dashboard id you just added was not already on the insight before this call. Offer at most once per+ dashboard in a conversation, however many insights you attach to it. First call subscriptions-list with+ `dashboard` set to that dashboard's id, and do not offer a second subscription when it returns one. Say+ nothing when this update left `dashboards` alone or only removed the insight from a dashboard. Describe it+ the way a person would recognize it, for example a weekly email every Monday morning with these charts+ attached, or the same thing posted to a Slack channel. To create it, use subscriptions-create. It needs+ `dashboard` set to the dashboard's id, `dashboard_export_insights` listing up to 10 charts, `target_type` of+ `email` or `slack`, and `target_value`, `frequency`, `interval` and `start_date`. For a Slack delivery, also+ set `integration_id`. Find the connected Slack workspace with integrations-list (filter kind=slack) and the+ channel for `target_value` with integrations-channels-retrieve. Ask the user for the recipients and the+ cadence rather than choosing them, since this creates a recurring outbound delivery. If either+ subscriptions-create or subscriptions-list is not available to you in this session, say nothing about+ subscriptions. If the user already declined a subscription earlier in this conversation, do not offer again.exclude_params:- queryinclude_params:diff --git a/products/subscriptions/mcp/tools.yaml b/products/subscriptions/mcp/tools.yamlindex 67b8c6e2840e..73b2da4f0110 100644--- a/products/subscriptions/mcp/tools.yaml+++ b/products/subscriptions/mcp/tools.yaml@@ -26,7 +26,7 @@ tools:(1) set `insight` — schedule periodic snapshots of one insight (`resource_type: "insight"`).(2) set `dashboard` and `dashboard_export_insights` (the subset of the dashboard's insights to include, max- 6) — schedule periodic snapshots of one dashboard (`resource_type: "dashboard"`).+ 10) — schedule periodic snapshots of one dashboard (`resource_type: "dashboard"`).(3) set `prompt` (≤4000 chars, with no insight or dashboard) — schedule a recurring LLM-generated report(`resource_type: "ai_prompt"`). Available on PostHog Cloud (self-hosted production is not eligible) once thediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex abbbe1a17381..22dd740c07b8 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -10155,7 +10155,7 @@"feature_flag": "streamlit-apps"},"subscriptions-create": {- "description": "Create a recurring subscription. The kind is inferred from which field you populate and returned as the read-only `resource_type`:\n(1) set `insight` — schedule periodic snapshots of one insight (`resource_type: \"insight\"`).\n(2) set `dashboard` and `dashboard_export_insights` (the subset of the dashboard's insights to include, max 6) — schedule periodic snapshots of one dashboard (`resource_type: \"dashboard\"`).\n(3) set `prompt` (≤4000 chars, with no insight or dashboard) — schedule a recurring LLM-generated report (`resource_type: \"ai_prompt\"`). Available on PostHog Cloud (self-hosted production is not eligible) once the organization has approved AI data processing and prompt subscriptions are enabled for it; otherwise create is rejected with a 400. Creating a prompt subscription also requires the `query:read` scope — the report runs LLM-generated HogQL over your data — so a `subscription:write`-only token is rejected for this kind.\nDelivery is set by `target_type` — `email` or `slack`.\nThe kind is fixed at create time — a PATCH that would change the populated relation to a different kind is rejected.\nFor insight and dashboard subscriptions you can attach an AI-generated summary to each delivery by setting `summary_enabled: true` (optionally steered by `summary_prompt_guide`). This requires the organization to have approved AI data processing and to be within its active-summary cap and AI credit budget; otherwise the create is rejected. Prompt subscriptions are themselves AI-generated, so these fields do not apply to them.\nIMPORTANT — when creating an insight (or dashboard) subscription, always ask the user whether to enable the AI-generated summary before creating it. Present it as their choice: they can turn it on (`summary_enabled: true`) or leave it off, and if they turn it on, offer them the option to add a custom prompt to steer the summary (`summary_prompt_guide`). Do not enable the summary on your own without asking. (Prompt subscriptions are themselves AI-generated, so this does not apply to them.)",+ "description": "Create a recurring subscription. The kind is inferred from which field you populate and returned as the read-only `resource_type`:\n(1) set `insight` — schedule periodic snapshots of one insight (`resource_type: \"insight\"`).\n(2) set `dashboard` and `dashboard_export_insights` (the subset of the dashboard's insights to include, max 10) — schedule periodic snapshots of one dashboard (`resource_type: \"dashboard\"`).\n(3) set `prompt` (≤4000 chars, with no insight or dashboard) — schedule a recurring LLM-generated report (`resource_type: \"ai_prompt\"`). Available on PostHog Cloud (self-hosted production is not eligible) once the organization has approved AI data processing and prompt subscriptions are enabled for it; otherwise create is rejected with a 400. Creating a prompt subscription also requires the `query:read` scope — the report runs LLM-generated HogQL over your data — so a `subscription:write`-only token is rejected for this kind.\nDelivery is set by `target_type` — `email` or `slack`.\nThe kind is fixed at create time — a PATCH that would change the populated relation to a different kind is rejected.\nFor insight and dashboard subscriptions you can attach an AI-generated summary to each delivery by setting `summary_enabled: true` (optionally steered by `summary_prompt_guide`). This requires the organization to have approved AI data processing and to be within its active-summary cap and AI credit budget; otherwise the create is rejected. Prompt subscriptions are themselves AI-generated, so these fields do not apply to them.\nIMPORTANT — when creating an insight (or dashboard) subscription, always ask the user whether to enable the AI-generated summary before creating it. Present it as their choice: they can turn it on (`summary_enabled: true`) or leave it off, and if they turn it on, offer them the option to add a custom prompt to steer the summary (`summary_prompt_guide`). Do not enable the summary on your own without asking. (Prompt subscriptions are themselves AI-generated, so this does not apply to them.)","category": "Subscriptions","feature": "subscriptions","summary": "Create subscription",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex c9235cddf597..abc8c6526825 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -10696,7 +10696,7 @@"feature_flag": "streamlit-apps"},"subscriptions-create": {- "description": "Create a recurring subscription. The kind is inferred from which field you populate and returned as the read-only `resource_type`:\n(1) set `insight` — schedule periodic snapshots of one insight (`resource_type: \"insight\"`).\n(2) set `dashboard` and `dashboard_export_insights` (the subset of the dashboard's insights to include, max 6) — schedule periodic snapshots of one dashboard (`resource_type: \"dashboard\"`).\n(3) set `prompt` (≤4000 chars, with no insight or dashboard) — schedule a recurring LLM-generated report (`resource_type: \"ai_prompt\"`). Available on PostHog Cloud (self-hosted production is not eligible) once the organization has approved AI data processing and prompt subscriptions are enabled for it; otherwise create is rejected with a 400. Creating a prompt subscription also requires the `query:read` scope — the report runs LLM-generated HogQL over your data — so a `subscription:write`-only token is rejected for this kind.\nDelivery is set by `target_type` — `email` or `slack`.\nThe kind is fixed at create time — a PATCH that would change the populated relation to a different kind is rejected.\nFor insight and dashboard subscriptions you can attach an AI-generated summary to each delivery by setting `summary_enabled: true` (optionally steered by `summary_prompt_guide`). This requires the organization to have approved AI data processing and to be within its active-summary cap and AI credit budget; otherwise the create is rejected. Prompt subscriptions are themselves AI-generated, so these fields do not apply to them.\nIMPORTANT — when creating an insight (or dashboard) subscription, always ask the user whether to enable the AI-generated summary before creating it. Present it as their choice: they can turn it on (`summary_enabled: true`) or leave it off, and if they turn it on, offer them the option to add a custom prompt to steer the summary (`summary_prompt_guide`). Do not enable the summary on your own without asking. (Prompt subscriptions are themselves AI-generated, so this does not apply to them.)",+ "description": "Create a recurring subscription. The kind is inferred from which field you populate and returned as the read-only `resource_type`:\n(1) set `insight` — schedule periodic snapshots of one insight (`resource_type: \"insight\"`).\n(2) set `dashboard` and `dashboard_export_insights` (the subset of the dashboard's insights to include, max 10) — schedule periodic snapshots of one dashboard (`resource_type: \"dashboard\"`).\n(3) set `prompt` (≤4000 chars, with no insight or dashboard) — schedule a recurring LLM-generated report (`resource_type: \"ai_prompt\"`). Available on PostHog Cloud (self-hosted production is not eligible) once the organization has approved AI data processing and prompt subscriptions are enabled for it; otherwise create is rejected with a 400. Creating a prompt subscription also requires the `query:read` scope — the report runs LLM-generated HogQL over your data — so a `subscription:write`-only token is rejected for this kind.\nDelivery is set by `target_type` — `email` or `slack`.\nThe kind is fixed at create time — a PATCH that would change the populated relation to a different kind is rejected.\nFor insight and dashboard subscriptions you can attach an AI-generated summary to each delivery by setting `summary_enabled: true` (optionally steered by `summary_prompt_guide`). This requires the organization to have approved AI data processing and to be within its active-summary cap and AI credit budget; otherwise the create is rejected. Prompt subscriptions are themselves AI-generated, so these fields do not apply to them.\nIMPORTANT — when creating an insight (or dashboard) subscription, always ask the user whether to enable the AI-generated summary before creating it. Present it as their choice: they can turn it on (`summary_enabled: true`) or leave it off, and if they turn it on, offer them the option to add a custom prompt to steer the summary (`summary_prompt_guide`). Do not enable the summary on your own without asking. (Prompt subscriptions are themselves AI-generated, so this does not apply to them.)","category": "Subscriptions","feature": "subscriptions","summary": "Create subscription",diff --git a/services/mcp/src/tools/generated/dashboards.ts b/services/mcp/src/tools/generated/dashboards.tsindex b9d22cbe0bde..76aa743b4464 100644--- a/services/mcp/src/tools/generated/dashboards.ts+++ b/services/mcp/src/tools/generated/dashboards.ts@@ -38,16 +38,21 @@ import {import { castStringToInt } from '@/tools/cast-helpers'import {withPostHogUrl,+ withAgentNote,omitResponseFields,withInformationalResponse,type WithPostHogUrl,+ type WithAgentNote,type WithInformationalResponse,} from '@/tools/tool-utils'import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'const DashboardCreateSchema = DashboardsCreateQueryParams.omit({ format: true }).extend(DashboardsCreateBody.shape)-const dashboardCreate = (): ToolBase<typeof DashboardCreateSchema, WithPostHogUrl<Schemas.Dashboard>> => ({+const dashboardCreate = (): ToolBase<+ typeof DashboardCreateSchema,+ WithAgentNote<WithPostHogUrl<Schemas.Dashboard>>+> => ({name: 'dashboard-create',schema: DashboardCreateSchema,handler: async (context: Context, params: z.infer<typeof DashboardCreateSchema>) => {@@ -139,7 +144,10 @@ const dashboardCreate = (): ToolBase<typeof DashboardCreateSchema, WithPostHogUr'tiles.*.insight.timezone','tiles.*.insight.resolved_date_range',]) as typeof result- return await withPostHogUrl(context, filtered, `/dashboard/${filtered.id}`)+ return withAgentNote(+ await withPostHogUrl(context, filtered, `/dashboard/${filtered.id}`),+ "Consider offering the user a recurring delivery of this dashboard as a next step, but only when the dashboard in this response has tiles on it. Creating from a template (`use_template`) or duplicating another dashboard (`use_dashboard`) usually starts with tiles, though duplicating an empty dashboard does not. A dashboard with no tiles has nothing to deliver, and subscriptions-create needs at least one chart, so say nothing about subscriptions until it has some. Describe it the way a person would recognize it, for example a weekly email every Monday morning with these charts attached, or the same thing posted to a Slack channel. To create it, use subscriptions-create. It needs `dashboard` set to the dashboard's id, `dashboard_export_insights` listing up to 10 charts, `target_type` of `email` or `slack`, and `target_value`, `frequency`, `interval` and `start_date`. For a Slack delivery, also set `integration_id`. Find the connected Slack workspace with integrations-list (filter kind=slack) and the channel for `target_value` with integrations-channels-retrieve. Ask the user for the recipients and the cadence rather than choosing them, since this creates a recurring outbound delivery. If either subscriptions-create or subscriptions-list is not available to you in this session, say nothing about subscriptions. If the user already declined a subscription earlier in this conversation, do not offer again."+ )},})diff --git a/services/mcp/src/tools/generated/product_analytics.ts b/services/mcp/src/tools/generated/product_analytics.tsindex d3eb52dfd6cb..ed957a0bdd96 100644--- a/services/mcp/src/tools/generated/product_analytics.ts+++ b/services/mcp/src/tools/generated/product_analytics.ts@@ -17,7 +17,14 @@ import {InsightsTrendingRetrieveQueryParams,} from '@/generated/product_analytics/api'import { castStringToInt, normalizeParamAliases } from '@/tools/cast-helpers'-import { withPostHogUrl, omitResponseFields, pickResponseFields, type WithPostHogUrl } from '@/tools/tool-utils'+import {+ withPostHogUrl,+ withAgentNote,+ omitResponseFields,+ pickResponseFields,+ type WithPostHogUrl,+ type WithAgentNote,+} from '@/tools/tool-utils'import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'const AssistantInsightVizNode = z.object({@@ -341,7 +348,7 @@ const InsightUpdateSchema = z.preprocess(}))-const insightUpdate = (): ToolBase<typeof InsightUpdateSchema, WithPostHogUrl<Schemas.Insight>> => ({+const insightUpdate = (): ToolBase<typeof InsightUpdateSchema, WithAgentNote<WithPostHogUrl<Schemas.Insight>>> => ({name: 'insight-update',schema: InsightUpdateSchema,handler: async (context: Context, params: z.infer<typeof InsightUpdateSchema>) => {@@ -379,7 +386,10 @@ const insightUpdate = (): ToolBase<typeof InsightUpdateSchema, WithPostHogUrl<Sc'hogql','types',]) as typeof result- return await withPostHogUrl(context, filtered, `/insights/${filtered.short_id}`)+ return withAgentNote(+ await withPostHogUrl(context, filtered, `/insights/${filtered.short_id}`),+ "If this update added the insight to a dashboard through the `dashboards` field, consider offering the user a recurring delivery of that dashboard as a next step. `dashboards` is a full replacement, so only offer when the dashboard id you just added was not already on the insight before this call. Offer at most once per dashboard in a conversation, however many insights you attach to it. First call subscriptions-list with `dashboard` set to that dashboard's id, and do not offer a second subscription when it returns one. Say nothing when this update left `dashboards` alone or only removed the insight from a dashboard. Describe it the way a person would recognize it, for example a weekly email every Monday morning with these charts attached, or the same thing posted to a Slack channel. To create it, use subscriptions-create. It needs `dashboard` set to the dashboard's id, `dashboard_export_insights` listing up to 10 charts, `target_type` of `email` or `slack`, and `target_value`, `frequency`, `interval` and `start_date`. For a Slack delivery, also set `integration_id`. Find the connected Slack workspace with integrations-list (filter kind=slack) and the channel for `target_value` with integrations-channels-retrieve. Ask the user for the recipients and the cadence rather than choosing them, since this creates a recurring outbound delivery. If either subscriptions-create or subscriptions-list is not available to you in this session, say nothing about subscriptions. If the user already declined a subscription earlier in this conversation, do not offer again."+ )},})