Skip to content

: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.

feat(workflows): add a replay vision step for the triggering session (#115240)

Tue Haulund705fa3b2d591
diff --git a/frontend/src/generated/core/api.schemas.ts b/frontend/src/generated/core/api.schemas.ts
index 2b0ec92951a1..40df096e607f 100644
--- a/frontend/src/generated/core/api.schemas.ts
+++ b/frontend/src/generated/core/api.schemas.ts
@@ -1743,6 +1743,18 @@ export interface TeamWorkflowsConfigApi {
* @nullable
*/
workflow_task_team_rate_limit_per_day?: number | null
+ /**
+ * How many Replay Vision scans one workflow can request in a rolling 24 hours. Null uses the default of 100; zero pauses scans for every workflow in the project. Support raises the limit above 500.
+ * @minimum 0
+ * @nullable
+ */
+ replay_vision_scan_rate_limit_per_day?: number | null
+ /**
+ * How many Replay Vision scans all workflows in the project request together in a rolling 24 hours. Null uses the default of 500; zero pauses scans for the project. Support raises the limit above 2500.
+ * @minimum 0
+ * @nullable
+ */
+ replay_vision_scan_team_rate_limit_per_day?: number | null
/**
* ID of the verified email integration that new broadcasts and workflow email steps use as their sender. Null means no default. Set automatically when the project's first email sender is verified, and cleared when that integration is deleted.
* @nullable
diff --git a/posthog/api/team/team_config.py b/posthog/api/team/team_config.py
index 6cdde97fbc7b..248054e8de42 100644
--- a/posthog/api/team/team_config.py
+++ b/posthog/api/team/team_config.py
@@ -17,6 +17,12 @@ from products.customer_analytics.backend.facade.contracts import PinnedAccountPr
from products.customer_analytics.backend.facade.enums import AccountPropertyPinKind
from products.customer_analytics.backend.facade.team_extension import TeamCustomerAnalyticsConfig
from products.feature_flags.backend.models.team_feature_flag_policy_config import TeamFeatureFlagPolicyConfig
+from products.replay_vision.backend.facade.workflow_scan_limits import (
+ MAX_SELF_SERVE_WORKFLOW_SCAN_RATE_CAP_PER_DAY,
+ MAX_SELF_SERVE_WORKFLOW_SCAN_TEAM_RATE_CAP_PER_DAY,
+ WORKFLOW_SCAN_RATE_CAP_PER_DAY,
+ WORKFLOW_SCAN_TEAM_RATE_CAP_PER_DAY,
+)
from products.tasks.backend.facade.workflow_tasks import (
MAX_SELF_SERVE_WORKFLOW_TASK_RATE_CAP_PER_DAY,
MAX_SELF_SERVE_WORKFLOW_TASK_TEAM_RATE_CAP_PER_DAY,
@@ -266,6 +272,28 @@ class TeamWorkflowsConfigSerializer(serializers.ModelSerializer, UserAccessContr
),
)
+ replay_vision_scan_rate_limit_per_day = serializers.IntegerField(
+ required=False,
+ allow_null=True,
+ min_value=0,
+ help_text=(
+ "How many Replay Vision scans one workflow can request in a rolling 24 hours. "
+ f"Null uses the default of {WORKFLOW_SCAN_RATE_CAP_PER_DAY}; zero pauses scans "
+ f"for every workflow in the project. Support raises the limit above "
+ f"{MAX_SELF_SERVE_WORKFLOW_SCAN_RATE_CAP_PER_DAY}."
+ ),
+ )
+ replay_vision_scan_team_rate_limit_per_day = serializers.IntegerField(
+ required=False,
+ allow_null=True,
+ min_value=0,
+ help_text=(
+ "How many Replay Vision scans all workflows in the project request together in a rolling "
+ f"24 hours. Null uses the default of {WORKFLOW_SCAN_TEAM_RATE_CAP_PER_DAY}; zero pauses "
+ f"scans for the project. Support raises the limit above "
+ f"{MAX_SELF_SERVE_WORKFLOW_SCAN_TEAM_RATE_CAP_PER_DAY}."
+ ),
+ )
default_email_integration_id = serializers.IntegerField(
required=False,
allow_null=True,
@@ -283,6 +311,8 @@ class TeamWorkflowsConfigSerializer(serializers.ModelSerializer, UserAccessContr
"email_tracking_consent_mode",
"workflow_task_rate_limit_per_day",
"workflow_task_team_rate_limit_per_day",
+ "replay_vision_scan_rate_limit_per_day",
+ "replay_vision_scan_team_rate_limit_per_day",
"default_email_integration_id",
"marketing_frequency_cap_max_messages",
"marketing_frequency_cap_window_days",
@@ -316,6 +346,16 @@ class TeamWorkflowsConfigSerializer(serializers.ModelSerializer, UserAccessContr
"workflow_task_team_rate_limit_per_day", value, MAX_SELF_SERVE_WORKFLOW_TASK_TEAM_RATE_CAP_PER_DAY
)
+ def validate_replay_vision_scan_rate_limit_per_day(self, value: int | None) -> int | None:
+ return self._enforce_self_serve_ceiling(
+ "replay_vision_scan_rate_limit_per_day", value, MAX_SELF_SERVE_WORKFLOW_SCAN_RATE_CAP_PER_DAY
+ )
+
+ def validate_replay_vision_scan_team_rate_limit_per_day(self, value: int | None) -> int | None:
+ return self._enforce_self_serve_ceiling(
+ "replay_vision_scan_team_rate_limit_per_day", value, MAX_SELF_SERVE_WORKFLOW_SCAN_TEAM_RATE_CAP_PER_DAY
+ )
+
def validate_default_email_integration_id(self, value: int | None) -> int | None:
if self.parent or value is None:
return value
diff --git a/posthog/jwt.py b/posthog/jwt.py
index 63935b45299a..0414c1eb594b 100644
--- a/posthog/jwt.py
+++ b/posthog/jwt.py
@@ -36,6 +36,7 @@ class PosthogJwtAudience(Enum):
CUSTOMER_TASKS_CREATE = "posthog:customer-tasks:create"
WORKFLOW_SCOUT_RUN = "posthog:workflows:scout_run"
WORKFLOW_CLASSIFY = "posthog:workflows:classify"
+ WORKFLOW_VISION_REQUEST = "posthog:workflows:vision_request"
CONVERSATIONS_TICKETS = "posthog:conversations:tickets"
CUSTOMER_ANALYTICS_ACCOUNTS = "posthog:customer_analytics:accounts"
SECURITY_HUB_RULES = "posthog:security_hub:rules"
diff --git a/posthog/settings/data_stores.py b/posthog/settings/data_stores.py
index fd7d2e2e77d2..86ffe7a41fce 100644
--- a/posthog/settings/data_stores.py
+++ b/posthog/settings/data_stores.py
@@ -620,6 +620,12 @@ WORKFLOW_CLASSIFY_JWT_SECRETS = get_list(
get_from_env("WORKFLOW_CLASSIFY_JWT_SECRET", "local-dev-workflow-classify-jwt" if DEBUG or TEST else "")
)
+# Signs the tokens a workflow's Replay Vision step calls back with. Its own
+# key for the same reason as the scout one. The dev/test value must match the plugin server's minting default.
+WORKFLOW_VISION_REQUEST_JWT_SECRETS = get_list(
+ get_from_env("WORKFLOW_VISION_REQUEST_JWT_SECRET", "local-dev-workflow-vision-request-jwt" if DEBUG or TEST else "")
+)
+
# Verifies the scoped JWTs the CDP worker's conversations ticket actions send to the internal
# ticket route (the worker mints, Django verifies; products/conversations/backend/api/internal.py).
# Comma-separated, newest first. Empty outside dev/test, so the internal route rejects every
diff --git a/products/cdp/backend/test/test_validation.py b/products/cdp/backend/test/test_validation.py
index 84a8aa24893c..880bf8c37601 100644
--- a/products/cdp/backend/test/test_validation.py
+++ b/products/cdp/backend/test/test_validation.py
@@ -1457,6 +1457,9 @@ class TestTaskInputTypeValidation(SimpleTestCase):
("skills_string_list", "task_skills", ["error-triage", "db-runbook"], True),
("skills_not_list", "task_skills", "error-triage", False),
("skills_not_strings", "task_skills", [{"name": "error-triage"}], False),
+ ("vision_scan_setup", "replay_vision_scan", {"type": "monitor", "prompt": "p"}, True),
+ ("vision_scan_without_type", "replay_vision_scan", {"prompt": "p"}, False),
+ ("vision_scan_not_object", "replay_vision_scan", "monitor", False),
]
)
def test_task_input_value_shapes(self, _name, schema_type, value, expect_valid):
diff --git a/products/cdp/backend/validation.py b/products/cdp/backend/validation.py
index 17965a2e4c30..aff88702f5fc 100644
--- a/products/cdp/backend/validation.py
+++ b/products/cdp/backend/validation.py
@@ -621,6 +621,7 @@ class _TemplatingChoiceField(serializers.ChoiceField):
class InputsSchemaItemSerializer(serializers.Serializer):
+ # nosemgrep: choices-need-a-class -- existing input-type list; this change only adds one value to it
type = serializers.ChoiceField(
choices=[
"string",
@@ -645,6 +646,7 @@ class InputsSchemaItemSerializer(serializers.Serializer):
"task_mcp_installations",
"signals_scout",
"task_skills",
+ "replay_vision_scan",
]
)
key = serializers.CharField()
@@ -836,6 +838,13 @@ class InputsItemSerializer(serializers.Serializer):
elif item_type == "signals_scout":
if not isinstance(value, str):
raise serializers.ValidationError({"input": "Value must be a scout skill name."})
+ elif item_type == "replay_vision_scan":
+ if not isinstance(value, dict) or not isinstance(value.get("type"), str):
+ raise serializers.ValidationError({"input": "Choose what Replay Vision should do."})
+ # The setup is never templated. Compiled code or a Liquid template from the client could name a different
+ # scanner than the value the access checks read, so only the literal value reaches the engine.
+ for key in ("bytecode", "transpiled", "templating"):
+ attrs.pop(key, None)
elif item_type == "task_skills":
if not isinstance(value, list) or not all(isinstance(v, str) for v in value):
raise serializers.ValidationError({"input": "Value must be a list of skill names."})
diff --git a/products/cdp/frontend/generated/api.schemas.ts b/products/cdp/frontend/generated/api.schemas.ts
index 110533cba482..43850476dd33 100644
--- a/products/cdp/frontend/generated/api.schemas.ts
+++ b/products/cdp/frontend/generated/api.schemas.ts
@@ -289,6 +289,7 @@ export const HogFunctionTypeEnumApi = {
* * `task_mcp_installations` - task_mcp_installations
* * `signals_scout` - signals_scout
* * `task_skills` - task_skills
+ * * `replay_vision_scan` - replay_vision_scan
*/
export type InputsSchemaItemTypeEnumApi = (typeof InputsSchemaItemTypeEnumApi)[keyof typeof InputsSchemaItemTypeEnumApi]
@@ -315,6 +316,7 @@ export const InputsSchemaItemTypeEnumApi = {
TaskMcpInstallations: 'task_mcp_installations',
SignalsScout: 'signals_scout',
TaskSkills: 'task_skills',
+ ReplayVisionScan: 'replay_vision_scan',
} as const
export type InputsSchemaItemApiChoicesItem = { [key: string]: unknown }
diff --git a/products/cdp/frontend/generated/api.zod.ts b/products/cdp/frontend/generated/api.zod.ts
index 80aabdcffa98..e86b2ed8d1da 100644
--- a/products/cdp/frontend/generated/api.zod.ts
+++ b/products/cdp/frontend/generated/api.zod.ts
@@ -86,9 +86,10 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -192,9 +193,10 @@ export const HogFunctionsCreateBody = /* @__PURE__ */ zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -364,9 +366,10 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -470,9 +473,10 @@ export const HogFunctionsUpdateBody = /* @__PURE__ */ zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -642,9 +646,10 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -748,9 +753,10 @@ export const HogFunctionsPartialUpdateBody = /* @__PURE__ */ zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -924,9 +930,10 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object(
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -1030,9 +1037,10 @@ export const HogFunctionsEnableBackfillsCreateBody = /* @__PURE__ */ zod.object(
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -1278,9 +1286,10 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -1399,9 +1408,10 @@ export const HogFunctionsInvocationsCreateBody = /* @__PURE__ */ zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
diff --git a/products/desktop/packages/api-client/src/generated.ts b/products/desktop/packages/api-client/src/generated.ts
index 7b4d8bcd9523..31f2229d6f31 100644
--- a/products/desktop/packages/api-client/src/generated.ts
+++ b/products/desktop/packages/api-client/src/generated.ts
@@ -19909,6 +19909,8 @@ export namespace Schemas {
email_tracking_consent_mode: EmailTrackingConsentModeEnum;
workflow_task_rate_limit_per_day: number | null;
workflow_task_team_rate_limit_per_day: number | null;
+ replay_vision_scan_rate_limit_per_day: number | null;
+ replay_vision_scan_team_rate_limit_per_day: number | null;
default_email_integration_id: number | null;
marketing_frequency_cap_max_messages: number | null;
marketing_frequency_cap_window_days: number | null;
diff --git a/products/workflows/backend/admin/team_workflows_config_admin.py b/products/workflows/backend/admin/team_workflows_config_admin.py
index 5c337817a1ec..d2086cccc56a 100644
--- a/products/workflows/backend/admin/team_workflows_config_admin.py
+++ b/products/workflows/backend/admin/team_workflows_config_admin.py
@@ -10,8 +10,16 @@ class TeamWorkflowsConfigAdmin(admin.ModelAdmin):
"team",
"workflow_task_rate_limit_per_day",
"workflow_task_team_rate_limit_per_day",
+ "replay_vision_scan_rate_limit_per_day",
+ "replay_vision_scan_team_rate_limit_per_day",
+ )
+ fields = (
+ "team",
+ "workflow_task_rate_limit_per_day",
+ "workflow_task_team_rate_limit_per_day",
+ "replay_vision_scan_rate_limit_per_day",
+ "replay_vision_scan_team_rate_limit_per_day",
)
- fields = ("team", "workflow_task_rate_limit_per_day", "workflow_task_team_rate_limit_per_day")
search_fields = ("team__id", "team__name", "team__organization__name")
raw_id_fields = ("team",)
list_select_related = ("team", "team__organization")
diff --git a/products/workflows/backend/facade/api.py b/products/workflows/backend/facade/api.py
index 85a9966a7f3e..5afd0fea6009 100644
--- a/products/workflows/backend/facade/api.py
+++ b/products/workflows/backend/facade/api.py
@@ -22,6 +22,7 @@ from products.workflows.backend.facade.contracts import (
WorkflowNotFound,
WorkflowSummary,
WorkflowTaskDailyLimits,
+ WorkflowVisionScanDailyLimits,
)
from products.workflows.backend.models import HogFlow, TeamWorkflowsConfig
from products.workflows.backend.services.batch_jobs import create_batch_job
@@ -157,6 +158,20 @@ def get_workflow_task_daily_limits(*, team_id: int) -> WorkflowTaskDailyLimits:
)
+def get_workflow_vision_scan_daily_limits(*, team_id: int) -> WorkflowVisionScanDailyLimits:
+ config = (
+ TeamWorkflowsConfig.objects.filter(team_id=team_id)
+ .only("replay_vision_scan_rate_limit_per_day", "replay_vision_scan_team_rate_limit_per_day")
+ .first()
+ )
+ if config is None:
+ return WorkflowVisionScanDailyLimits(per_workflow=None, per_team=None)
+ return WorkflowVisionScanDailyLimits(
+ per_workflow=config.replay_vision_scan_rate_limit_per_day,
+ per_team=config.replay_vision_scan_team_rate_limit_per_day,
+ )
+
+
def accept_github_event(delivery: WebhookDelivery) -> None:
"""The inbound GitHub App webhook enters workflows here, so its consumer needs no internal import."""
# Deferred to keep the Kafka producer off the facade import path.
diff --git a/products/workflows/backend/facade/contracts.py b/products/workflows/backend/facade/contracts.py
index 638add89a373..332b4bf859da 100644
--- a/products/workflows/backend/facade/contracts.py
+++ b/products/workflows/backend/facade/contracts.py
@@ -58,6 +58,14 @@ class WorkflowTaskDailyLimits:
per_team: int | None
+@frozen
+class WorkflowVisionScanDailyLimits:
+ """A team's daily caps on Replay Vision scans requested by workflows. None means the default cap applies."""
+
+ per_workflow: int | None
+ per_team: int | None
+
+
@frozen
class WorkflowBatchJob:
"""One batch run of a workflow.
diff --git a/products/workflows/backend/facade/service_jwt.py b/products/workflows/backend/facade/service_jwt.py
index d5713d58e2be..dabe5f89cab3 100644
--- a/products/workflows/backend/facade/service_jwt.py
+++ b/products/workflows/backend/facade/service_jwt.py
@@ -1,13 +1,19 @@
"""The scoped service JWT purposes that the workflow callback endpoints verify.
-The plugin server mints these tokens for the "Create AI task", "Run scout", and "Classify with AI"
-workflow steps.
+The plugin server mints tokens for the "Create AI task", "Run scout", "Classify with AI" and
+"Replay Vision" workflow steps.
"""
from products.workflows.backend.service_jwt import (
TASKS_CREATE_PURPOSE,
WORKFLOW_CLASSIFY_PURPOSE,
WORKFLOW_SCOUT_RUN_PURPOSE,
+ WORKFLOW_VISION_REQUEST_PURPOSE,
)
-__all__ = ["TASKS_CREATE_PURPOSE", "WORKFLOW_CLASSIFY_PURPOSE", "WORKFLOW_SCOUT_RUN_PURPOSE"]
+__all__ = [
+ "TASKS_CREATE_PURPOSE",
+ "WORKFLOW_CLASSIFY_PURPOSE",
+ "WORKFLOW_SCOUT_RUN_PURPOSE",
+ "WORKFLOW_VISION_REQUEST_PURPOSE",
+]
diff --git a/products/workflows/backend/migrations/0034_teamworkflowsconfig_replay_vision_scan_limits.py b/products/workflows/backend/migrations/0034_teamworkflowsconfig_replay_vision_scan_limits.py
new file mode 100644
index 000000000000..4f4c618f1d04
--- /dev/null
+++ b/products/workflows/backend/migrations/0034_teamworkflowsconfig_replay_vision_scan_limits.py
@@ -0,0 +1,31 @@
+# Generated by Django 5.2.18 on 2026-10-12 08:07
+
+import django.core.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("workflows", "0033_workflowidea"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="teamworkflowsconfig",
+ name="replay_vision_scan_rate_limit_per_day",
+ field=models.IntegerField(
+ blank=True,
+ null=True,
+ validators=[django.core.validators.MinValueValidator(0)],
+ ),
+ ),
+ migrations.AddField(
+ model_name="teamworkflowsconfig",
+ name="replay_vision_scan_team_rate_limit_per_day",
+ field=models.IntegerField(
+ blank=True,
+ null=True,
+ validators=[django.core.validators.MinValueValidator(0)],
+ ),
+ ),
+ ]
diff --git a/products/workflows/backend/migrations/max_migration.txt b/products/workflows/backend/migrations/max_migration.txt
index b8a3cae39e72..852bd44b6c8d 100644
--- a/products/workflows/backend/migrations/max_migration.txt
+++ b/products/workflows/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0033_workflowidea
+0034_teamworkflowsconfig_replay_vision_scan_limits
diff --git a/products/workflows/backend/models/team_workflows_config.py b/products/workflows/backend/models/team_workflows_config.py
index a3ae9ce1fc1b..a1868ff77c7d 100644
--- a/products/workflows/backend/models/team_workflows_config.py
+++ b/products/workflows/backend/models/team_workflows_config.py
@@ -61,6 +61,13 @@ class TeamWorkflowsConfig(models.Model):
workflow_task_team_rate_limit_per_day = models.IntegerField(
null=True, blank=True, validators=[MinValueValidator(0)]
)
+ # The same overrides for Replay Vision scans that workflow steps request.
+ replay_vision_scan_rate_limit_per_day = models.IntegerField(
+ null=True, blank=True, validators=[MinValueValidator(0)]
+ )
+ replay_vision_scan_team_rate_limit_per_day = models.IntegerField(
+ null=True, blank=True, validators=[MinValueValidator(0)]
+ )
# Max marketing messages per person per rolling window across all workflows; null on either means no cap.
marketing_frequency_cap_max_messages = models.IntegerField(null=True, blank=True, validators=[MinValueValidator(1)])
diff --git a/products/workflows/backend/presentation/views/hog_flow.py b/products/workflows/backend/presentation/views/hog_flow.py
index 2f89e4f8e5d3..b10138dbe14f 100644
--- a/products/workflows/backend/presentation/views/hog_flow.py
+++ b/products/workflows/backend/presentation/views/hog_flow.py
@@ -122,6 +122,11 @@ from products.cdp.backend.presentation.serializers import (
)
from products.messaging.backend.presentation.views.serializers import DesignOperationSerializer
from products.notifications.backend.facade.api import publish_resource_edited
+from products.replay_vision.backend.facade.api import (
+ ObservationRequestRejected,
+ parse_workflow_scan_setup,
+ workflow_scan_editor_error,
+)
from products.tasks.backend.facade.api import list_workflow_last_runs
from products.tasks.backend.facade.contracts import WorkflowLastRunDTO
from products.tasks.backend.facade.model_catalogue import TASK_RUN_GATEWAY_PRODUCT, available_model_choices
@@ -566,6 +571,66 @@ _RUN_SCOUT_TEMPLATE_ID = "template-posthog-run-scout"
# 400, which fails the step on every run, so a strict save applies the same limits.
_CLASSIFY_TEMPLATE_ID = "template-posthog-classify"
+# The scan runs as the workflow's owner, but whoever saves the step chooses which sessions it reads and
+# where the answers go, so the editor needs recording access too.
+_REPLAY_VISION_TEMPLATE_ID = "template-posthog-replay-vision"
+# Each group lists the scopes that grant one thing the step needs: reading recordings, and starting scans,
+# which the scan APIs gate on scanner write.
+_REPLAY_VISION_STEP_SCOPES = (
+ ("session_recording:read", "session_recording:write"),
+ ("replay_scanner:write",),
+)
+
+
+def _strip_replay_vision_code(inputs: Any) -> None:
+ # A draft keeps its raw inputs when they fail validation, so client-compiled code or a Liquid template can still
+ # be there. The engine would render those instead of the literal value the access checks read.
+ analysis = inputs.get("analysis") if isinstance(inputs, dict) else None
+ if isinstance(analysis, dict):
+ for key in ("bytecode", "transpiled", "templating"):
+ analysis.pop(key, None)
+
+
+def _replay_vision_step_error(request: Request | None, team: Team, inputs: Any) -> str | None:
+ """Why the caller may not save or live-test a Replay Vision step with these inputs, or None."""
+ _strip_replay_vision_code(inputs)
+ scopes = get_authenticator_scopes(getattr(request, "successful_authenticator", None))
+ if scopes is not None and "*" not in scopes:
+ for accepted in _REPLAY_VISION_STEP_SCOPES:
+ if not any(scope in scopes for scope in accepted):
+ return f"The Replay Vision step needs a key with the {accepted[0]} scope."
+ user = getattr(request, "user", None)
+ if user is None or not user.is_authenticated or isinstance(user, SyntheticUser):
+ return None
+ analysis = inputs.get("analysis") if isinstance(inputs, dict) else None
+ setup = analysis.get("value") if isinstance(analysis, dict) else None
+ scanner_id: uuid_mod.UUID | None = None
+ if isinstance(setup, dict) and setup.get("type") == "scanner":
+ try:
+ scanner_id = uuid_mod.UUID(str(setup.get("scanner_id")))
+ except ValueError:
+ # A strict save refuses the incomplete setup; a draft may keep it.
+ return None
+ # One save or run can hold several Replay Vision steps; each distinct scanner is checked once per request.
+ cache: dict[uuid_mod.UUID | None, str | None] = request.__dict__.setdefault("_replay_vision_editor_errors", {})
+ if scanner_id not in cache:
+ cache[scanner_id] = workflow_scan_editor_error(user=user, team=team, scanner_id=scanner_id)
+ return cache[scanner_id]
+
+
+def _require_replay_vision_editor_access(request: Request | None, context: dict[str, Any], actions: Any) -> None:
+ get_team = context.get("get_team")
+ if get_team is None:
+ return
+ for step in actions if isinstance(actions, list) else []:
+ config = (step.get("config") or {}) if isinstance(step, dict) else {}
+ if config.get("template_id") != _REPLAY_VISION_TEMPLATE_ID:
+ continue
+ error = _replay_vision_step_error(request, get_team(), config.get("inputs"))
+ if error is not None:
+ raise serializers.ValidationError({"variables": error})
+
+
_REPOSITORY_SHAPE = re.compile(r"[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+")
MIN_WORKFLOW_TASK_MAX_PARALLEL_TASKS = 1
@@ -1448,6 +1513,27 @@ class HogFlowActionSerializer(serializers.Serializer):
}
)
+ def _validate_replay_vision_action(self, inputs: dict, *, strict: bool) -> None:
+ """Reject an incomplete scan setup, and a caller who couldn't run the scan themselves: editing someone
+ else's workflow must not forward recordings or scanner answers the editor may not read."""
+ if strict:
+ try:
+ analysis = inputs.get("analysis") if isinstance(inputs, dict) else None
+ parse_workflow_scan_setup(analysis.get("value") if isinstance(analysis, dict) else None)
+ except ObservationRequestRejected as rejected:
+ raise serializers.ValidationError({"inputs": {"analysis": rejected.detail}})
+ get_team = self.context.get("get_team")
+ if get_team is None:
+ return
+ # The scan refuses a child environment on every run, so a step saved for one fails at save instead.
+ if strict and get_team().parent_team_id:
+ raise serializers.ValidationError(
+ {"template_id": "Replay Vision is only available in the project's main environment."}
+ )
+ error = _replay_vision_step_error(self.context.get("request"), get_team(), inputs)
+ if error is not None:
+ raise serializers.ValidationError({"template_id": error})
+
def _validate_run_scout_action(self) -> None:
"""Save-time check for the "Run scout" step: reject it in a child environment, matching
the runtime refusal in start_workflow_scout_run, so a broken step fails at save instead of
@@ -1742,6 +1828,8 @@ class HogFlowActionSerializer(serializers.Serializer):
self._validate_run_scout_action()
if strict and template_id == _CLASSIFY_TEMPLATE_ID:
self._validate_classify_action(data["config"]["inputs"])
+ if template_id == _REPLAY_VISION_TEMPLATE_ID:
+ self._validate_replay_vision_action(data["config"].get("inputs") or {}, strict=strict)
# Branch types fan out via 'branch' edges indexed into these arrays; a node stored without
# its array crashes the editor panel and assigns nothing at runtime. Presence is only
@@ -3081,6 +3169,14 @@ class HogFlowSerializer(HogFlowMinimalSerializer):
{"actions": stored.actions, "conversion": stored.conversion} if stored else None,
)
+ # A Replay Vision step can read its session from a variable, so changing variables alone changes what
+ # it scans. Submitted actions get this check through HogFlowActionSerializer.
+ if instance and "variables" in data and "actions" not in data:
+ # A content edit on an active workflow can land in its staged draft, whose steps may differ.
+ draft_actions = (instance.draft or {}).get("actions")
+ for stored in (instance.actions, draft_actions):
+ _require_replay_vision_editor_access(self.context.get("request"), self.context, stored)
+
# When activating a draft, re-validate actions from the instance with full (non-draft) checks
status = data.get("status", instance.status if instance else "draft")
if status == "active" and instance and instance.status != "active" and "actions" not in data:
@@ -4677,6 +4773,7 @@ class HogFlowViewSet(
serializer = HogInvocationRerunRequestSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
+ self._require_replay_vision_caller_access(request, self._edit_state().actions)
# `serializer.data` runs `to_representation`, which converts the
# `DateTimeField`s on `filter.window_start` / `filter.window_end` to
@@ -5774,6 +5871,17 @@ class HogFlowViewSet(
except Exception as error:
capture_exception(error)
+ def _require_replay_vision_caller_access(self, request: Request, actions: Any) -> None:
+ # A live test or a manual run starts the Replay Vision step as the workflow's owner, on sessions the caller
+ # can pick, so the caller needs the access that saving the step needs.
+ for step in actions if isinstance(actions, list) else []:
+ config = (step.get("config") or {}) if isinstance(step, dict) else {}
+ if config.get("template_id") != _REPLAY_VISION_TEMPLATE_ID:
+ continue
+ error = _replay_vision_step_error(request, self.team, config.get("inputs"))
+ if error is not None:
+ raise exceptions.PermissionDenied(error)
+
@extend_schema(request=HogFlowInvocationSerializer, responses={200: _FallbackSerializer})
@action(detail=True, methods=["POST"])
def invocations(self, request: Request, *args, **kwargs):
@@ -5817,6 +5925,12 @@ class HogFlowViewSet(
draft["actions"] = rehydrate_flow_secrets(draft["actions"], draft_secrets)
payload["configuration"] = draft
+ if not payload.get("mock_async_functions", True):
+ configuration = payload.get("configuration") or {}
+ self._require_replay_vision_caller_access(
+ request, configuration.get("actions") if configuration else (hog_flow.actions if hog_flow else [])
+ )
+
res = create_hog_flow_invocation_test(
team_id=self.team_id,
hog_flow_id=str(hog_flow.id) if hog_flow else "new",
@@ -6367,6 +6481,7 @@ class HogFlowViewSet(
serializer = HogFlowBatchJobSerializer(data={**request.data, "hog_flow": hog_flow.id})
if not serializer.is_valid():
return Response(serializer.errors, status=400)
+ self._require_replay_vision_caller_access(request, self._edit_state().actions)
batch_job = create_batch_job(
team_id=self.team_id,
@@ -6492,6 +6607,7 @@ class HogFlowViewSet(
serializer = HogFlowScheduleSerializer(data=request.data, context=self.get_serializer_context())
serializer.is_valid(raise_exception=True)
+ self._require_replay_vision_caller_access(request, self._edit_state().actions)
schedule = create_schedule(team_id=self.team_id, hog_flow_id=hog_flow.id, fields=serializer.validated_data)
self._report_workflow_action("hog_flow_schedule_created", hog_flow, {"schedule_id": str(schedule.id)})
return Response(HogFlowScheduleSerializer(schedule).data, status=201)
@@ -6529,6 +6645,8 @@ class HogFlowViewSet(
schedule, data=request.data, partial=True, context=self.get_serializer_context()
)
serializer.is_valid(raise_exception=True)
+ if "variables" in serializer.validated_data:
+ self._require_replay_vision_caller_access(request, self._edit_state().actions)
schedule = update_schedule(
team_id=self.team_id, hog_flow_id=hog_flow.id, schedule_id=schedule.id, fields=serializer.validated_data
)
@@ -6569,6 +6687,7 @@ class HogFlowViewSet(
serializer = HogFlowRunRequestSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
+ self._require_replay_vision_caller_access(request, self._edit_state().actions)
variables = cast(dict[str, object], {var.get("key"): var.get("default") for var in hog_flow.variables or []})
variables.update(serializer.validated_data["variables"])
diff --git a/products/workflows/backend/presentation/views/workflow_vision_requests.py b/products/workflows/backend/presentation/views/workflow_vision_requests.py
new file mode 100644
index 000000000000..aa9c8b5d486e
--- /dev/null
+++ b/products/workflows/backend/presentation/views/workflow_vision_requests.py
@@ -0,0 +1,197 @@
+import uuid
+from typing import Any, cast
+
+from django.db import models
+
+import structlog
+from drf_spectacular.utils import OpenApiResponse, extend_schema
+from rest_framework import serializers, status, viewsets
+from rest_framework.permissions import IsAuthenticated
+from rest_framework.request import Request
+from rest_framework.response import Response
+
+from posthog.auth import InternalAPIUser
+
+from products.replay_vision.backend.facade.api import (
+ MAX_SESSION_ID_LENGTH,
+ ObservationRequestRejected,
+ RejectionKind,
+ parse_workflow_scan_setup,
+ start_workflow_observation_request,
+)
+from products.replay_vision.backend.facade.workflow_scan_limits import (
+ WORKFLOW_SCAN_RATE_CAP_PER_DAY,
+ WORKFLOW_SCAN_TEAM_RATE_CAP_PER_DAY,
+)
+from products.workflows.backend.facade.api import (
+ WorkflowNotFound,
+ get_workflow_owner_id,
+ get_workflow_vision_scan_daily_limits,
+)
+from products.workflows.backend.facade.service_jwt import WORKFLOW_VISION_REQUEST_PURPOSE
+from products.workflows.backend.presentation.views.workflow_step_auth import WorkflowStepJWTAuthentication
+
+logger = structlog.get_logger(__name__)
+
+# The step skips the event on a 409 and fails on everything else, so only a daily limit maps to it.
+_REJECTION_STATUS: dict[RejectionKind, int] = {
+ "not_found": status.HTTP_404_NOT_FOUND,
+ "consent": status.HTTP_400_BAD_REQUEST,
+ "invalid": status.HTTP_400_BAD_REQUEST,
+ "forbidden": status.HTTP_403_FORBIDDEN,
+ "rate_limited": status.HTTP_409_CONFLICT,
+}
+
+
+class WorkflowVisionRequestsJWTAuthentication(WorkflowStepJWTAuthentication):
+ purpose = WORKFLOW_VISION_REQUEST_PURPOSE
+
+
+class WorkflowVisionRequestCreateSerializer(serializers.Serializer):
+ session_id = serializers.CharField(
+ max_length=MAX_SESSION_ID_LENGTH, help_text="The session recording to scan, usually the triggering event's."
+ )
+ setup = serializers.JSONField(
+ help_text=(
+ "The step's scan setup: `type` is `scanner` with a `scanner_id`, or a scan type (monitor, classifier, "
+ "scorer, summarizer) with a `prompt` and the type's `tags` or `scale`."
+ ),
+ )
+ wait_for_session_end = serializers.BooleanField(
+ default=True,
+ help_text="Wait until the session has been quiet for 35 minutes before scanning, so the whole session is seen.",
+ )
+ idempotency_key = serializers.CharField(
+ max_length=200, help_text="The step's dispatch key. A retry with the same key returns the first request."
+ )
+
+
+class WorkflowVisionRequestStatus(models.TextChoices):
+ RUNNING = "running", "Running"
+ COMPLETED = "completed", "Completed"
+
+
+class WorkflowVisionRequestResponseSerializer(serializers.Serializer):
+ request_id = serializers.UUIDField(help_text="The Replay Vision scan request this step started.")
+ status = serializers.ChoiceField(
+ choices=WorkflowVisionRequestStatus.choices,
+ help_text="'completed' when the session already settled, so there is nothing to wait for.",
+ )
+ state = serializers.CharField(
+ required=False,
+ help_text="Set when completed: how the session's scan ended, such as succeeded, failed or skipped.",
+ )
+ output = serializers.JSONField(
+ required=False, allow_null=True, help_text="Set when completed: the scan's answer, or null without one."
+ )
+ warnings = serializers.ListField(
+ child=serializers.CharField(),
+ required=False,
+ allow_null=True,
+ help_text="Set when completed: why the answer is missing or was cut, or null.",
+ )
+
+
+class WorkflowVisionRequestRejectedSerializer(serializers.Serializer):
+ detail = serializers.CharField(help_text="Why the scan was not started.")
+
+
+class WorkflowVisionRequestViewSet(viewsets.GenericViewSet):
+ """Start a Replay Vision scan for the workflow's Replay Vision step.
+
+ Authenticated by a scoped service JWT the plugin server mints, never by a user credential, with its
+ own signing key and audience. The step parks until the scan finishes and wakes with the answer."""
+
+ authentication_classes = [WorkflowVisionRequestsJWTAuthentication]
+ permission_classes = [IsAuthenticated]
+ serializer_class = WorkflowVisionRequestCreateSerializer
+
+ @extend_schema(
+ request=WorkflowVisionRequestCreateSerializer,
+ responses={
+ 200: OpenApiResponse(
+ response=WorkflowVisionRequestResponseSerializer,
+ description="This idempotency key already started a request. Nothing new was started.",
+ ),
+ 202: OpenApiResponse(
+ response=WorkflowVisionRequestResponseSerializer,
+ description="The scan request started. The step wakes when the session has settled.",
+ ),
+ 400: OpenApiResponse(
+ response=WorkflowVisionRequestRejectedSerializer,
+ description="AI analysis is off for the organization, or the scan is set up wrong",
+ ),
+ 403: OpenApiResponse(
+ response=WorkflowVisionRequestRejectedSerializer,
+ description="The workflow's owner can't view recordings or can't use this scanner",
+ ),
+ 404: OpenApiResponse(
+ response=WorkflowVisionRequestRejectedSerializer,
+ description="The scanner doesn't exist in this project",
+ ),
+ 409: OpenApiResponse(
+ response=WorkflowVisionRequestRejectedSerializer,
+ description="The workflow or the project reached its daily scan limit, so the event is skipped",
+ ),
+ 422: OpenApiResponse(
+ response=WorkflowVisionRequestRejectedSerializer, description="The workflow no longer exists"
+ ),
+ },
+ summary="Start a Replay Vision scan from a workflow",
+ )
+ def create(self, request: Request, **kwargs: Any) -> Response:
+ # Both come from the verified token, not the URL or body.
+ user = cast(InternalAPIUser, request.user)
+ team_id = cast(int, user.current_team_id)
+ hog_flow_id = cast(uuid.UUID, request.auth)
+
+ serializer = WorkflowVisionRequestCreateSerializer(data=request.data)
+ serializer.is_valid(raise_exception=True)
+ data = serializer.validated_data
+
+ try:
+ owner_id = get_workflow_owner_id(team_id=team_id, workflow_id=hog_flow_id)
+ except WorkflowNotFound:
+ return _rejected("Workflow no longer exists.", status.HTTP_422_UNPROCESSABLE_ENTITY)
+
+ limits = get_workflow_vision_scan_daily_limits(team_id=team_id)
+ try:
+ scanner_id, inline = parse_workflow_scan_setup(data["setup"])
+ started = start_workflow_observation_request(
+ team_id=team_id,
+ owner_id=owner_id,
+ hog_flow_id=hog_flow_id,
+ session_id=data["session_id"],
+ scanner_id=scanner_id,
+ inline=inline,
+ idempotency_key=data["idempotency_key"],
+ wait_for_session_end=data["wait_for_session_end"],
+ per_workflow_daily_cap=WORKFLOW_SCAN_RATE_CAP_PER_DAY
+ if limits.per_workflow is None
+ else limits.per_workflow,
+ per_team_daily_cap=WORKFLOW_SCAN_TEAM_RATE_CAP_PER_DAY if limits.per_team is None else limits.per_team,
+ )
+ except ObservationRequestRejected as error:
+ logger.info(
+ "workflow_vision_request_rejected", team_id=team_id, hog_flow_id=str(hog_flow_id), kind=error.kind
+ )
+ return _rejected(error.detail, _REJECTION_STATUS[error.kind])
+
+ logger.info(
+ "workflow_vision_request_started",
+ team_id=team_id,
+ hog_flow_id=str(hog_flow_id),
+ request_id=str(started.request_id),
+ created=started.created,
+ )
+ body = {**(started.result or {}), "request_id": started.request_id, "status": started.status}
+ # Nullable fields would otherwise serialize as null on a running request, which has no answer yet.
+ data = {key: value for key, value in WorkflowVisionRequestResponseSerializer(body).data.items() if key in body}
+ return Response(
+ data,
+ status=status.HTTP_202_ACCEPTED if started.created else status.HTTP_200_OK,
+ )
+
+
+def _rejected(detail: str, http_status: int) -> Response:
+ return Response(WorkflowVisionRequestRejectedSerializer({"detail": detail}).data, status=http_status)
diff --git a/products/workflows/backend/routes.py b/products/workflows/backend/routes.py
index 10bc49281094..4cc248e72092 100644
--- a/products/workflows/backend/routes.py
+++ b/products/workflows/backend/routes.py
@@ -14,6 +14,7 @@ from products.workflows.backend.presentation.views import (
workflow_data_suggestions,
workflow_scout_runs,
workflow_tasks,
+ workflow_vision_requests,
)
# AWS SES tenant reputation events, delivered EventBridge -> SNS HTTPS subscription. Workflows owns
@@ -61,6 +62,12 @@ def register_routes(routers: RouterRegistry) -> None:
"project_workflow_people_imports",
["team_id"],
)
+ routers.projects.register(
+ r"workflow_vision_requests",
+ workflow_vision_requests.WorkflowVisionRequestViewSet,
+ "project_workflow_vision_requests",
+ ["team_id"],
+ )
routers.projects.register(
r"hog_flow_templates",
hog_flow_template.HogFlowTemplateViewSet,
diff --git a/products/workflows/backend/service_jwt.py b/products/workflows/backend/service_jwt.py
index 8bcbbef93d97..cb3d88a57983 100644
--- a/products/workflows/backend/service_jwt.py
+++ b/products/workflows/backend/service_jwt.py
@@ -22,3 +22,9 @@ WORKFLOW_CLASSIFY_PURPOSE = ScopedServiceJwtPurpose(
audience=PosthogJwtAudience.WORKFLOW_CLASSIFY,
settings_name="WORKFLOW_CLASSIFY_JWT_SECRETS",
)
+
+# Its own key, for the same narrowest-scope reason as WORKFLOW_SCOUT_RUN_PURPOSE.
+WORKFLOW_VISION_REQUEST_PURPOSE = ScopedServiceJwtPurpose(
+ audience=PosthogJwtAudience.WORKFLOW_VISION_REQUEST,
+ settings_name="WORKFLOW_VISION_REQUEST_JWT_SECRETS",
+)
diff --git a/products/workflows/backend/test/test_hog_flow_schedule.py b/products/workflows/backend/test/test_hog_flow_schedule.py
index 22b13a23e5d7..b925b1fc799a 100644
--- a/products/workflows/backend/test/test_hog_flow_schedule.py
+++ b/products/workflows/backend/test/test_hog_flow_schedule.py
@@ -11,6 +11,9 @@ import requests
from parameterized import parameterized
from rest_framework import status
+from posthog.constants import AvailableFeature
+
+from products.access_control.backend.models.access_control import AccessControl
from products.workflows.backend.models.hog_flow.hog_flow import HogFlow
from products.workflows.backend.models.hog_flow_batch_job import HogFlowBatchJob
from products.workflows.backend.models.hog_flow_schedule import HogFlowSchedule
@@ -56,6 +59,36 @@ class TestHogFlowScheduleAPI(APIBaseTest):
def _schedule_detail_url(self, workflow_id, schedule_id):
return f"/api/projects/{self.team.id}/hog_flows/{workflow_id}/schedules/{schedule_id}/"
+ @parameterized.expand([("can_view_recordings", "viewer", status.HTTP_201_CREATED), ("cannot", "none", 403)])
+ def test_scheduling_a_replay_vision_step_needs_the_callers_recording_access(
+ self, _name, recording_access, expected
+ ):
+ self.organization.available_product_features = [
+ {"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL}
+ ]
+ self.organization.save()
+ AccessControl.objects.create(team=self.team, resource="session_recording", access_level=recording_access)
+ workflow = HogFlow.objects.create(
+ team=self.team,
+ name="Scheduled scan",
+ status="active",
+ trigger={"type": "schedule"},
+ actions=[
+ {
+ "id": "vision",
+ "name": "vision",
+ "type": "function",
+ "config": {"template_id": "template-posthog-replay-vision", "inputs": {}},
+ }
+ ],
+ )
+
+ response = self.client.post(
+ self._schedules_url(workflow.id), {**SCHEDULE_DATA, "variables": {"session": "s1"}}, format="json"
+ )
+
+ assert response.status_code == expected, response.json()
+
def test_create_schedule(self):
workflow = self._create_batch_workflow()
response = self.client.post(self._schedules_url(workflow["id"]), SCHEDULE_DATA)
@@ -596,6 +629,37 @@ class TestHogFlowRun(APIBaseTest):
variables={"greeting": "Hello", "name": "Overridden"},
)
+ def _run_replay_vision_workflow(self, mock_invocation, recording_access):
+ self._mock_success(mock_invocation)
+ self.organization.available_product_features = [
+ {"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL}
+ ]
+ self.organization.save()
+ AccessControl.objects.create(team=self.team, resource="session_recording", access_level=recording_access)
+ workflow = self._create_workflow()
+ workflow.actions = [
+ {
+ "id": "vision",
+ "name": "vision",
+ "type": "function",
+ "config": {"template_id": "template-posthog-replay-vision", "inputs": {}},
+ }
+ ]
+ workflow.save()
+ return self.client.post(self._run_url(workflow.id), {"variables": {"session": "s1"}}, format="json")
+
+ def test_run_with_a_replay_vision_step_runs_for_a_caller_who_can_view_recordings(self, mock_invocation):
+ response = self._run_replay_vision_workflow(mock_invocation, "viewer")
+
+ assert response.status_code == status.HTTP_200_OK, response.json()
+ mock_invocation.assert_called_once()
+
+ def test_run_with_a_replay_vision_step_is_refused_without_the_callers_recording_access(self, mock_invocation):
+ response = self._run_replay_vision_workflow(mock_invocation, "none")
+
+ assert response.status_code == status.HTTP_403_FORBIDDEN, response.json()
+ mock_invocation.assert_not_called()
+
def test_run_rejects_non_schedule_trigger(self, mock_invocation):
workflow = self._create_workflow(trigger_type="batch")
diff --git a/products/workflows/backend/test/test_team_workflows_config.py b/products/workflows/backend/test/test_team_workflows_config.py
index e091a47a04d1..64f89a63b90b 100644
--- a/products/workflows/backend/test/test_team_workflows_config.py
+++ b/products/workflows/backend/test/test_team_workflows_config.py
@@ -49,6 +49,8 @@ class TestTeamWorkflowsConfig(APIBaseTest):
"email_tracking_consent_mode": "off",
"workflow_task_rate_limit_per_day": None,
"workflow_task_team_rate_limit_per_day": None,
+ "replay_vision_scan_rate_limit_per_day": None,
+ "replay_vision_scan_team_rate_limit_per_day": None,
"default_email_integration_id": None,
"marketing_frequency_cap_max_messages": None,
"marketing_frequency_cap_window_days": None,
@@ -113,6 +115,8 @@ class TestTeamWorkflowsConfig(APIBaseTest):
"email_tracking_consent_mode": "off",
"workflow_task_rate_limit_per_day": None,
"workflow_task_team_rate_limit_per_day": None,
+ "replay_vision_scan_rate_limit_per_day": None,
+ "replay_vision_scan_team_rate_limit_per_day": None,
"default_email_integration_id": None,
"marketing_frequency_cap_max_messages": None,
"marketing_frequency_cap_window_days": None,
diff --git a/products/workflows/backend/tests/api/test_hog_flow.py b/products/workflows/backend/tests/api/test_hog_flow.py
index 936f9d690cc4..206428ebd873 100644
--- a/products/workflows/backend/tests/api/test_hog_flow.py
+++ b/products/workflows/backend/tests/api/test_hog_flow.py
@@ -35,6 +35,7 @@ from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.templates.fixtures import template_slack
from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.cohorts.backend.models.cohort import Cohort, CohortType
+from products.replay_vision.backend.models.replay_scanner import ReplayScanner
from products.skills.backend.models.skills import LLMSkill
from products.tasks.backend.facade.contracts import WorkflowLastRunDTO
from products.workflows.backend.facade.writes import update_workflow
@@ -7367,6 +7368,382 @@ class TestCreateTaskActionValidation(APIBaseTest):
assert response.status_code == status.HTTP_201_CREATED, response.json()
+_TRIGGER = {
+ "id": "trigger_node",
+ "name": "trigger_1",
+ "type": "trigger",
+ "config": {
+ "type": "event",
+ "filters": {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]},
+ },
+}
+
+
+class TestReplayVisionActionValidation(APIBaseTest):
+ def setUp(self):
+ super().setUp()
+ template = deepcopy(webhook_template)
+ template["id"] = "template-posthog-replay-vision"
+ template["name"] = "Replay Vision"
+ template["inputs_schema"] = [
+ {"key": "session_id", "type": "string", "label": "Session ID", "secret": False, "required": True},
+ {"key": "analysis", "type": "replay_vision_scan", "label": "Analysis", "secret": False, "required": True},
+ ]
+ sync_template_to_db(template)
+
+ def _enable_access_control(self) -> None:
+ self.organization.available_product_features = [
+ {"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL}
+ ]
+ self.organization.save()
+
+ def _save_step(self, analysis: dict, team: Team | None = None, **extra: Any):
+ trigger_action = {
+ "id": "trigger_node",
+ "name": "trigger_1",
+ "type": "trigger",
+ "config": {
+ "type": "event",
+ "filters": {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]},
+ },
+ }
+ action = {
+ "id": "action_1",
+ "name": "action_1",
+ "type": "function",
+ "config": {
+ "template_id": "template-posthog-replay-vision",
+ "inputs": {
+ "session_id": {"value": "{event.properties.$session_id}"},
+ "analysis": {"value": analysis},
+ },
+ },
+ }
+ return self.client.post(
+ f"/api/projects/{(team or self.team).id}/hog_flows",
+ {"name": "Test Flow", "actions": [trigger_action, action], "edges": []},
+ format="json",
+ HTTP_X_POSTHOG_CLIENT="mcp",
+ **extra,
+ )
+
+ @parameterized.expand(
+ [
+ ("can_view_recordings", "viewer", {"type": "monitor", "prompt": "did they rage click?"}, None),
+ ("cannot_view_recordings", "none", {"type": "monitor", "prompt": "did they rage click?"}, "template_id"),
+ ("incomplete_setup", "viewer", {"type": "classifier", "prompt": "intent?"}, "inputs"),
+ ]
+ )
+ def test_the_step_needs_recording_access_and_a_complete_setup(
+ self, _name: str, recording_access: str, analysis: dict, error_attr: str | None
+ ) -> None:
+ self._enable_access_control()
+ AccessControl.objects.create(team=self.team, resource="session_recording", access_level=recording_access)
+
+ response = self._save_step(analysis)
+
+ if error_attr is None:
+ assert response.status_code == status.HTTP_201_CREATED, response.json()
+ else:
+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()
+ assert error_attr in str(response.json()), response.json()
+
+ _VISION_STEP = {
+ "id": "vision",
+ "name": "vision",
+ "type": "function",
+ "config": {
+ "template_id": "template-posthog-replay-vision",
+ "inputs": {"session_id": {"value": "{variables.session}"}},
+ },
+ }
+
+ @patch(
+ "products.workflows.backend.models.hog_flow_batch_job.hog_flow_batch_job.create_batch_hog_flow_job_invocation"
+ )
+ def test_a_batch_run_with_the_step_needs_the_callers_recording_access(self, create_invocation: MagicMock) -> None:
+ self._enable_access_control()
+ AccessControl.objects.create(team=self.team, resource="session_recording", access_level="none")
+ flow = HogFlow.objects.create(
+ team=self.team,
+ name="Batch scan",
+ status="active",
+ trigger={"type": "batch", "filters": {"properties": []}},
+ actions=[self._VISION_STEP],
+ )
+
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/hog_flows/{flow.id}/batch_jobs",
+ {"variables": [{"key": "session", "value": "s1"}]},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_403_FORBIDDEN, response.json()
+ assert "session recordings" in response.json()["detail"], response.json()
+ create_invocation.assert_not_called()
+
+ def test_a_rerun_of_the_step_needs_the_callers_recording_access(self) -> None:
+ self._enable_access_control()
+ AccessControl.objects.create(team=self.team, resource="session_recording", access_level="none")
+ flow = HogFlow.objects.create(
+ team=self.team,
+ name="Rerun scan",
+ status="active",
+ trigger={"type": "event", "filters": {}},
+ actions=[_TRIGGER, self._VISION_STEP],
+ )
+
+ with patch("products.workflows.backend.presentation.views.hog_flow.rerun_hog_invocations") as rerun:
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/hog_flows/{flow.id}/rerun/",
+ {"filter": {"window_start": "2026-10-13T00:00:00Z", "window_end": "2026-10-14T00:00:00Z"}},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_403_FORBIDDEN, response.json()
+ assert "session recordings" in response.json()["detail"], response.json()
+ rerun.assert_not_called()
+
+ def test_a_variables_only_edit_is_checked_against_the_staged_draft_too(self) -> None:
+ self._enable_access_control()
+ AccessControl.objects.create(team=self.team, resource="session_recording", access_level="none")
+ flow = HogFlow.objects.create(
+ team=self.team,
+ name="Draft scan",
+ status="active",
+ trigger={"type": "event", "filters": {}},
+ actions=[_TRIGGER],
+ draft={"actions": [_TRIGGER, self._VISION_STEP]},
+ variables=[{"key": "session", "type": "string", "label": "Session", "default": "s1"}],
+ )
+
+ response = self.client.patch(
+ f"/api/projects/{self.team.id}/hog_flows/{flow.id}",
+ {"variables": [{"key": "session", "type": "string", "label": "Session", "default": "s2"}]},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()
+ assert response.json()["attr"] == "variables", response.json()
+
+ @parameterized.expand(
+ [("complete_setup", {"type": "monitor", "prompt": "p"}), ("incomplete_setup", {"type": "classifier"})]
+ )
+ def test_client_code_and_templating_never_reach_the_stored_setup(self, _name: str, value: dict) -> None:
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/hog_flows",
+ {
+ "name": "Draft",
+ "actions": [
+ _TRIGGER,
+ {
+ "id": "action_1",
+ "name": "action_1",
+ "type": "function",
+ "config": {
+ "template_id": "template-posthog-replay-vision",
+ "inputs": {
+ "analysis": {
+ "value": value,
+ "bytecode": ["_H", 1, 32, "other-scanner"],
+ "templating": "liquid",
+ }
+ },
+ },
+ },
+ ],
+ "edges": [],
+ },
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_201_CREATED, response.json()
+ stored = HogFlow.objects.get(id=response.json()["id"])
+ actions = (stored.draft or {}).get("actions") or stored.actions
+ analysis = next(a for a in actions if a["id"] == "action_1")["config"]["inputs"]["analysis"]
+ assert not {"bytecode", "templating"} & set(analysis)
+
+ def test_a_web_draft_with_a_malformed_setup_saves(self) -> None:
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/hog_flows",
+ {
+ "name": "Draft",
+ "actions": [
+ {
+ "id": "trigger_node",
+ "name": "trigger_1",
+ "type": "trigger",
+ "config": {"type": "event", "filters": {}},
+ },
+ {
+ "id": "action_1",
+ "name": "action_1",
+ "type": "function",
+ "config": {"template_id": "template-posthog-replay-vision", "inputs": {"analysis": "invalid"}},
+ },
+ ],
+ "edges": [],
+ },
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_201_CREATED, response.json()
+
+ def test_the_step_is_refused_in_a_child_environment(self) -> None:
+ child = Team.objects.create(organization=self.organization, name="child env", parent_team=self.team)
+
+ response = self._save_step({"type": "monitor", "prompt": "did they rage click?"}, team=child)
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()
+ assert "main environment" in str(response.json()), response.json()
+
+ def test_a_web_draft_can_hold_the_step_before_it_has_inputs(self) -> None:
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/hog_flows",
+ {
+ "name": "Draft",
+ "actions": [
+ {
+ "id": "trigger_node",
+ "name": "trigger_1",
+ "type": "trigger",
+ "config": {"type": "event", "filters": {}},
+ },
+ {
+ "id": "action_1",
+ "name": "action_1",
+ "type": "function",
+ "config": {"template_id": "template-posthog-replay-vision"},
+ },
+ ],
+ "edges": [],
+ },
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_201_CREATED, response.json()
+
+ @parameterized.expand([("editable", "editor", status.HTTP_201_CREATED), ("restricted", "none", 400)])
+ def test_the_step_needs_the_editors_own_access_to_the_scanner(
+ self, _name: str, scanner_access: str, expected: int
+ ) -> None:
+ self._enable_access_control()
+ scanner = ReplayScanner.objects.create(
+ team=self.team, name="checkout", scanner_type="monitor", scanner_config={"prompt": "checked out?"}
+ )
+ AccessControl.objects.create(
+ team=self.team, resource="replay_scanner", resource_id=str(scanner.id), access_level=scanner_access
+ )
+
+ response = self._save_step({"type": "scanner", "scanner_id": str(scanner.id)})
+
+ assert response.status_code == expected, response.json()
+
+ @parameterized.expand(
+ [
+ ("recording_and_scanner_scopes", ["hog_flow:write", "session_recording:read", "replay_scanner:write"], 201),
+ ("no_recording_scope", ["hog_flow:write", "replay_scanner:write"], 400),
+ ("scanner_read_only", ["hog_flow:write", "session_recording:read", "replay_scanner:read"], 400),
+ ]
+ )
+ def test_a_key_needs_the_scopes_for_what_the_step_reads(self, _name: str, scopes: list[str], expected: int) -> None:
+ key = generate_random_token_personal()
+ PersonalAPIKey.objects.create(
+ label="workflows", user=self.user, secure_value=hash_key_value(key), scopes=scopes
+ )
+ self.client.logout()
+
+ response = self._save_step(
+ {"type": "monitor", "prompt": "did they rage click?"}, HTTP_AUTHORIZATION=f"Bearer {key}"
+ )
+
+ assert response.status_code == expected, response.json()
+
+ @parameterized.expand([("can_view_recordings", "viewer", status.HTTP_200_OK), ("cannot", "none", 400)])
+ def test_changing_only_the_variables_of_a_step_needs_the_editors_recording_access(
+ self, _name: str, recording_access: str, expected: int
+ ) -> None:
+ self._enable_access_control()
+ flow = HogFlow.objects.create(
+ team=self.team,
+ name="Scan flow",
+ status="active",
+ created_by=self.user,
+ trigger={"type": "event", "filters": {}},
+ variables=[{"key": "session", "type": "string", "label": "Session", "default": "s1"}],
+ actions=[
+ {
+ "id": "trigger_node",
+ "name": "trigger_1",
+ "type": "trigger",
+ "config": {
+ "type": "event",
+ "filters": {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]},
+ },
+ },
+ {
+ "id": "action_1",
+ "name": "action_1",
+ "type": "function",
+ "config": {
+ "template_id": "template-posthog-replay-vision",
+ "inputs": {"session_id": {"value": "{variables.session}"}},
+ },
+ },
+ ],
+ )
+ AccessControl.objects.create(team=self.team, resource="session_recording", access_level=recording_access)
+
+ response = self.client.patch(
+ f"/api/projects/{self.team.id}/hog_flows/{flow.id}",
+ {"variables": [{"key": "session", "type": "string", "label": "Session", "default": "another-session"}]},
+ format="json",
+ )
+
+ assert response.status_code == expected, response.json()
+
+ @parameterized.expand([("live", False, status.HTTP_403_FORBIDDEN), ("mocked", True, status.HTTP_200_OK)])
+ def test_a_live_test_run_needs_the_testers_recording_access(
+ self, _name: str, mock_async_functions: bool, expected: int
+ ) -> None:
+ self.organization.available_product_features = [
+ {"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL}
+ ]
+ self.organization.save()
+ flow = HogFlow.objects.create(
+ team=self.team,
+ name="Scan flow",
+ created_by=self.user,
+ trigger={"type": "event", "filters": {}},
+ actions=[
+ {
+ "id": "action_1",
+ "name": "action_1",
+ "type": "function",
+ "config": {"template_id": "template-posthog-replay-vision", "inputs": {}},
+ }
+ ],
+ )
+ AccessControl.objects.create(team=self.team, resource="session_recording", access_level="none")
+
+ with patch(
+ "products.workflows.backend.presentation.views.hog_flow.create_hog_flow_invocation_test"
+ ) as mock_invoke:
+ mock_invoke.return_value = MagicMock(status_code=200, json=lambda: {"status": "success"})
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/hog_flows/{flow.id}/invocations/",
+ data={
+ "globals": {"event": {"event": "$pageview", "distinct_id": "d1"}},
+ "mock_async_functions": mock_async_functions,
+ "current_action_id": "action_1",
+ },
+ format="json",
+ )
+
+ assert response.status_code == expected, response.json()
+ assert mock_invoke.call_count == (1 if mock_async_functions else 0)
+
+
class TestRunScoutActionValidation(APIBaseTest):
"""Save-time check specific to the "Run scout" step: it used to fail only on the first run,
once per fire, in a child environment. This locks in that the same misconfiguration is now
diff --git a/products/workflows/backend/tests/api/test_workflow_vision_requests_api.py b/products/workflows/backend/tests/api/test_workflow_vision_requests_api.py
new file mode 100644
index 000000000000..ece01d48c16e
--- /dev/null
+++ b/products/workflows/backend/tests/api/test_workflow_vision_requests_api.py
@@ -0,0 +1,154 @@
+from datetime import timedelta
+from typing import Any
+from uuid import uuid4
+
+from posthog.test.base import APIBaseTest
+from unittest.mock import patch
+
+from django.test import override_settings
+
+from parameterized import parameterized
+from rest_framework import status
+
+from posthog.jwt import PosthogJwtAudience, encode_jwt
+from posthog.test.authentication_checks import covers_authentication
+
+from products.replay_vision.backend.facade.api import (
+ ObservationRequestRejected,
+ RejectionKind,
+ StartedObservationRequest,
+ WorkflowInlineScan,
+)
+from products.workflows.backend.models import HogFlow, TeamWorkflowsConfig
+from products.workflows.backend.presentation.views.workflow_vision_requests import (
+ WorkflowVisionRequestsJWTAuthentication,
+)
+
+SECRET = "test-workflow-vision-request-jwt"
+_START = "products.workflows.backend.presentation.views.workflow_vision_requests.start_workflow_observation_request"
+
+
+def _token(team_id: int, hog_flow_id: str, *, audience: PosthogJwtAudience) -> str:
+ return encode_jwt(
+ {"team_id": team_id, "hog_flow_id": hog_flow_id}, timedelta(minutes=5), audience, signing_key=SECRET
+ )
+
+
+# Both settings share a value so the audience is the only thing that differs in the wrong-audience case.
+@override_settings(WORKFLOW_VISION_REQUEST_JWT_SECRETS=[SECRET], WORKFLOW_SCOUT_RUN_JWT_SECRETS=[SECRET])
+class TestWorkflowVisionRequestsAPI(APIBaseTest):
+ def setUp(self) -> None:
+ super().setUp()
+ self.client.logout()
+ self.hog_flow = HogFlow.objects.create(
+ team=self.team, name="Churn review", created_by=self.user, trigger={"type": "manual"}
+ )
+ self.url = f"/api/projects/{self.team.id}/workflow_vision_requests/"
+
+ def _post(self, *, audience: PosthogJwtAudience = PosthogJwtAudience.WORKFLOW_VISION_REQUEST) -> Any:
+ return self.client.post(
+ self.url,
+ {
+ "session_id": "s1",
+ "setup": {"type": "scorer", "prompt": "p", "scale": {"min": 1, "max": 5}, "tags": ["ignored"]},
+ "idempotency_key": "run:step:1",
+ },
+ format="json",
+ HTTP_AUTHORIZATION=f"Bearer {_token(self.team.id, str(self.hog_flow.id), audience=audience)}",
+ )
+
+ @parameterized.expand(
+ [
+ ("new", True, None, status.HTTP_202_ACCEPTED),
+ ("replayed_key", False, None, status.HTTP_200_OK),
+ (
+ "already_settled",
+ True,
+ {"state": "succeeded", "output": {"score": 4}, "warnings": None},
+ status.HTTP_202_ACCEPTED,
+ ),
+ ]
+ )
+ def test_starts_a_scan_for_the_token_team(
+ self, _name: str, created: bool, result: dict[str, Any] | None, expected: int
+ ) -> None:
+ TeamWorkflowsConfig.objects.create(team=self.team, replay_vision_scan_rate_limit_per_day=7)
+ request_id = uuid4()
+ started = StartedObservationRequest(
+ request_id=request_id, status="completed" if result else "running", created=created, result=result
+ )
+ with patch(_START, return_value=started) as start:
+ response = self._post()
+
+ assert response.status_code == expected, response.json()
+ assert response.json() == {
+ **(result or {}),
+ "request_id": str(request_id),
+ "status": "completed" if result else "running",
+ }
+ start.assert_called_once_with(
+ team_id=self.team.id,
+ owner_id=self.user.id,
+ hog_flow_id=self.hog_flow.id,
+ session_id="s1",
+ scanner_id=None,
+ inline=WorkflowInlineScan(
+ scanner_type="scorer", scanner_config={"prompt": "p", "scale": {"min": 1, "max": 5}}
+ ),
+ idempotency_key="run:step:1",
+ wait_for_session_end=True,
+ per_workflow_daily_cap=7,
+ per_team_daily_cap=500,
+ )
+
+ @parameterized.expand(
+ [
+ ("not_found", status.HTTP_404_NOT_FOUND),
+ ("consent", status.HTTP_400_BAD_REQUEST),
+ ("invalid", status.HTTP_400_BAD_REQUEST),
+ ("forbidden", status.HTTP_403_FORBIDDEN),
+ ("rate_limited", status.HTTP_409_CONFLICT),
+ ]
+ )
+ def test_a_refused_scan_maps_onto_a_failing_status(self, kind: RejectionKind, expected: int) -> None:
+ with patch(_START, side_effect=ObservationRequestRejected(f"detail: {kind}", kind)):
+ response = self._post()
+
+ assert response.status_code == expected, response.json()
+ assert response.json() == {"detail": f"detail: {kind}"}
+
+ @covers_authentication(WorkflowVisionRequestsJWTAuthentication)
+ def test_an_incomplete_setup_fails_the_step_without_starting_a_scan(self) -> None:
+ with patch(_START) as start:
+ response = self.client.post(
+ self.url,
+ {"session_id": "s1", "setup": {"type": "classifier", "prompt": "p"}, "idempotency_key": "k"},
+ format="json",
+ HTTP_AUTHORIZATION=f"Bearer {_token(self.team.id, str(self.hog_flow.id), audience=PosthogJwtAudience.WORKFLOW_VISION_REQUEST)}",
+ )
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()
+ assert response.json() == {"detail": "Add at least one category."}
+ start.assert_not_called()
+
+ def test_rejects_a_scout_run_token(self) -> None:
+ with patch(_START) as start:
+ response = self._post(audience=PosthogJwtAudience.WORKFLOW_SCOUT_RUN)
+
+ assert response.status_code == status.HTTP_401_UNAUTHORIZED
+ start.assert_not_called()
+
+ def test_refuses_once_the_workflow_is_gone(self) -> None:
+ hog_flow_id = str(self.hog_flow.id)
+ self.hog_flow.delete()
+ token = _token(self.team.id, hog_flow_id, audience=PosthogJwtAudience.WORKFLOW_VISION_REQUEST)
+ with patch(_START) as start:
+ response = self.client.post(
+ self.url,
+ {"session_id": "s1", "setup": {"type": "scanner", "scanner_id": str(uuid4())}, "idempotency_key": "k"},
+ format="json",
+ HTTP_AUTHORIZATION=f"Bearer {token}",
+ )
+
+ assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY, response.json()
+ start.assert_not_called()
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index c7a955b4cead..bb16e0f9e481 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -55950,6 +55950,7 @@ export namespace Schemas {
* * `task_mcp_installations` - task_mcp_installations
* * `signals_scout` - signals_scout
* * `task_skills` - task_skills
+ * * `replay_vision_scan` - replay_vision_scan
*/
export type InputsSchemaItemTypeEnum = typeof InputsSchemaItemTypeEnum[keyof typeof InputsSchemaItemTypeEnum];
@@ -55977,6 +55978,7 @@ export namespace Schemas {
TaskMcpInstallations: 'task_mcp_installations',
SignalsScout: 'signals_scout',
TaskSkills: 'task_skills',
+ ReplayVisionScan: 'replay_vision_scan',
} as const;
export type InputsSchemaItemChoicesItem = { [key: string]: unknown };
@@ -83117,6 +83119,18 @@ export namespace Schemas {
* @nullable
*/
workflow_task_team_rate_limit_per_day?: number | null;
+ /**
+ * How many Replay Vision scans one workflow can request in a rolling 24 hours. Null uses the default of 100; zero pauses scans for every workflow in the project. Support raises the limit above 500.
+ * @minimum 0
+ * @nullable
+ */
+ replay_vision_scan_rate_limit_per_day?: number | null;
+ /**
+ * How many Replay Vision scans all workflows in the project request together in a rolling 24 hours. Null uses the default of 500; zero pauses scans for the project. Support raises the limit above 2500.
+ * @minimum 0
+ * @nullable
+ */
+ replay_vision_scan_team_rate_limit_per_day?: number | null;
/**
* ID of the verified email integration that new broadcasts and workflow email steps use as their sender. Null means no default. Set automatically when the project's first email sender is verified, and cleared when that integration is deleted.
* @nullable
diff --git a/services/mcp/src/generated/cdp_functions/api.ts b/services/mcp/src/generated/cdp_functions/api.ts
index f679bc77f57c..58328b0cd075 100644
--- a/services/mcp/src/generated/cdp_functions/api.ts
+++ b/services/mcp/src/generated/cdp_functions/api.ts
@@ -111,9 +111,10 @@ export const HogFunctionsCreateBody = () => zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -205,9 +206,10 @@ export const HogFunctionsCreateBody = () => zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -379,9 +381,10 @@ export const HogFunctionsPartialUpdateBody = () => zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -473,9 +476,10 @@ export const HogFunctionsPartialUpdateBody = () => zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -738,9 +742,10 @@ export const HogFunctionsInvocationsCreateBody = () => zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -859,9 +864,10 @@ export const HogFunctionsInvocationsCreateBody = () => zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
diff --git a/services/mcp/src/generated/core/api.ts b/services/mcp/src/generated/core/api.ts
index 94a26441cf17..d86a01eacc98 100644
--- a/services/mcp/src/generated/core/api.ts
+++ b/services/mcp/src/generated/core/api.ts
@@ -353,6 +353,10 @@ export const organizationsProjectsCreateBodyWorkflowsConfigWorkflowTaskRateLimit
export const organizationsProjectsCreateBodyWorkflowsConfigWorkflowTaskTeamRateLimitPerDayMin = 0
+export const organizationsProjectsCreateBodyWorkflowsConfigReplayVisionScanRateLimitPerDayMin = 0
+
+export const organizationsProjectsCreateBodyWorkflowsConfigReplayVisionScanTeamRateLimitPerDayMin = 0
+
export const organizationsProjectsCreateBodyWorkflowsConfigMarketingFrequencyCapMaxMessagesMax = 1000
export const organizationsProjectsCreateBodyWorkflowsConfigMarketingFrequencyCapWindowDaysMax = 30
@@ -2765,6 +2769,20 @@ export const OrganizationsProjectsCreateBody = () => zod
.describe(
'How many AI tasks all workflows in the project can create together in a rolling 24 hours. Null uses the default of 500; zero pauses task creation for the project. Support raises the limit above 2500.'
),
+ replay_vision_scan_rate_limit_per_day: zod
+ .number()
+ .min(organizationsProjectsCreateBodyWorkflowsConfigReplayVisionScanRateLimitPerDayMin)
+ .nullish()
+ .describe(
+ 'How many Replay Vision scans one workflow can request in a rolling 24 hours. Null uses the default of 100; zero pauses scans for every workflow in the project. Support raises the limit above 500.'
+ ),
+ replay_vision_scan_team_rate_limit_per_day: zod
+ .number()
+ .min(organizationsProjectsCreateBodyWorkflowsConfigReplayVisionScanTeamRateLimitPerDayMin)
+ .nullish()
+ .describe(
+ 'How many Replay Vision scans all workflows in the project request together in a rolling 24 hours. Null uses the default of 500; zero pauses scans for the project. Support raises the limit above 2500.'
+ ),
default_email_integration_id: zod
.number()
.nullish()
@@ -3084,6 +3102,10 @@ export const organizationsProjectsPartialUpdateBodyWorkflowsConfigWorkflowTaskRa
export const organizationsProjectsPartialUpdateBodyWorkflowsConfigWorkflowTaskTeamRateLimitPerDayMin = 0
+export const organizationsProjectsPartialUpdateBodyWorkflowsConfigReplayVisionScanRateLimitPerDayMin = 0
+
+export const organizationsProjectsPartialUpdateBodyWorkflowsConfigReplayVisionScanTeamRateLimitPerDayMin = 0
+
export const organizationsProjectsPartialUpdateBodyWorkflowsConfigMarketingFrequencyCapMaxMessagesMax = 1000
export const organizationsProjectsPartialUpdateBodyWorkflowsConfigMarketingFrequencyCapWindowDaysMax = 30
@@ -5504,6 +5526,20 @@ export const OrganizationsProjectsPartialUpdateBody = () => zod
.describe(
'How many AI tasks all workflows in the project can create together in a rolling 24 hours. Null uses the default of 500; zero pauses task creation for the project. Support raises the limit above 2500.'
),
+ replay_vision_scan_rate_limit_per_day: zod
+ .number()
+ .min(organizationsProjectsPartialUpdateBodyWorkflowsConfigReplayVisionScanRateLimitPerDayMin)
+ .nullish()
+ .describe(
+ 'How many Replay Vision scans one workflow can request in a rolling 24 hours. Null uses the default of 100; zero pauses scans for every workflow in the project. Support raises the limit above 500.'
+ ),
+ replay_vision_scan_team_rate_limit_per_day: zod
+ .number()
+ .min(organizationsProjectsPartialUpdateBodyWorkflowsConfigReplayVisionScanTeamRateLimitPerDayMin)
+ .nullish()
+ .describe(
+ 'How many Replay Vision scans all workflows in the project request together in a rolling 24 hours. Null uses the default of 500; zero pauses scans for the project. Support raises the limit above 2500.'
+ ),
default_email_integration_id: zod
.number()
.nullish()
diff --git a/services/mcp/src/generated/error_tracking_alerts/api.ts b/services/mcp/src/generated/error_tracking_alerts/api.ts
index 27acc12da7fa..3f016e900def 100644
--- a/services/mcp/src/generated/error_tracking_alerts/api.ts
+++ b/services/mcp/src/generated/error_tracking_alerts/api.ts
@@ -111,9 +111,10 @@ export const HogFunctionsCreateBody = () => zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -205,9 +206,10 @@ export const HogFunctionsCreateBody = () => zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -370,9 +372,10 @@ export const HogFunctionsPartialUpdateBody = () => zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
@@ -464,9 +467,10 @@ export const HogFunctionsPartialUpdateBody = () => zod.object({
'task_mcp_installations',
'signals_scout',
'task_skills',
+ 'replay_vision_scan',
])
.describe(
- '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills'
+ '\* `string` - string\n\* `number` - number\n\* `boolean` - boolean\n\* `dictionary` - dictionary\n\* `choice` - choice\n\* `json` - json\n\* `integration` - integration\n\* `integration_multi` - integration_multi\n\* `integration_field` - integration_field\n\* `email` - email\n\* `native_email` - native_email\n\* `posthog_assignee` - posthog_assignee\n\* `posthog_ticket_tags` - posthog_ticket_tags\n\* `posthog_business_hours` - posthog_business_hours\n\* `non_failure_status_codes` - non_failure_status_codes\n\* `customer_analytics_account_properties` - customer_analytics_account_properties\n\* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n\* `task_model` - task_model\n\* `task_repository` - task_repository\n\* `task_mcp_installations` - task_mcp_installations\n\* `signals_scout` - signals_scout\n\* `task_skills` - task_skills\n\* `replay_vision_scan` - replay_vision_scan'
),
key: zod.string(),
label: zod.string().optional(),
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json
index 957477a2dccb..390c5e0dad21 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-create.json
@@ -181,7 +181,7 @@
]
},
"type": {
- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills",
+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills\n* `replay_vision_scan` - replay_vision_scan",
"enum": [
"string",
"number",
@@ -204,7 +204,8 @@
"task_repository",
"task_mcp_installations",
"signals_scout",
- "task_skills"
+ "task_skills",
+ "replay_vision_scan"
],
"type": "string"
}
@@ -360,7 +361,7 @@
]
},
"type": {
- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills",
+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills\n* `replay_vision_scan` - replay_vision_scan",
"enum": [
"string",
"number",
@@ -383,7 +384,8 @@
"task_repository",
"task_mcp_installations",
"signals_scout",
- "task_skills"
+ "task_skills",
+ "replay_vision_scan"
],
"type": "string"
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json
index ef1dfd3232d3..9e5517f24ced 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-invocations-create.json
@@ -347,7 +347,7 @@
]
},
"type": {
- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills",
+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills\n* `replay_vision_scan` - replay_vision_scan",
"enum": [
"string",
"number",
@@ -370,7 +370,8 @@
"task_repository",
"task_mcp_installations",
"signals_scout",
- "task_skills"
+ "task_skills",
+ "replay_vision_scan"
],
"type": "string"
}
@@ -546,7 +547,7 @@
]
},
"type": {
- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills",
+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills\n* `replay_vision_scan` - replay_vision_scan",
"enum": [
"string",
"number",
@@ -569,7 +570,8 @@
"task_repository",
"task_mcp_installations",
"signals_scout",
- "task_skills"
+ "task_skills",
+ "replay_vision_scan"
],
"type": "string"
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json
index 7322f3e025c2..57a4d4ac51f3 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/cdp-functions-partial-update.json
@@ -191,7 +191,7 @@
]
},
"type": {
- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills",
+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills\n* `replay_vision_scan` - replay_vision_scan",
"enum": [
"string",
"number",
@@ -214,7 +214,8 @@
"task_repository",
"task_mcp_installations",
"signals_scout",
- "task_skills"
+ "task_skills",
+ "replay_vision_scan"
],
"type": "string"
}
@@ -370,7 +371,7 @@
]
},
"type": {
- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills",
+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills\n* `replay_vision_scan` - replay_vision_scan",
"enum": [
"string",
"number",
@@ -393,7 +394,8 @@
"task_repository",
"task_mcp_installations",
"signals_scout",
- "task_skills"
+ "task_skills",
+ "replay_vision_scan"
],
"type": "string"
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json
index 6dc32032ab78..90bcf05f4a11 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-create.json
@@ -181,7 +181,7 @@
]
},
"type": {
- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills",
+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills\n* `replay_vision_scan` - replay_vision_scan",
"enum": [
"string",
"number",
@@ -204,7 +204,8 @@
"task_repository",
"task_mcp_installations",
"signals_scout",
- "task_skills"
+ "task_skills",
+ "replay_vision_scan"
],
"type": "string"
}
@@ -360,7 +361,7 @@
]
},
"type": {
- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills",
+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills\n* `replay_vision_scan` - replay_vision_scan",
"enum": [
"string",
"number",
@@ -383,7 +384,8 @@
"task_repository",
"task_mcp_installations",
"signals_scout",
- "task_skills"
+ "task_skills",
+ "replay_vision_scan"
],
"type": "string"
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json
index 6a4de21cedde..fe32f1365795 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-alerts-partial-update.json
@@ -191,7 +191,7 @@
]
},
"type": {
- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills",
+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills\n* `replay_vision_scan` - replay_vision_scan",
"enum": [
"string",
"number",
@@ -214,7 +214,8 @@
"task_repository",
"task_mcp_installations",
"signals_scout",
- "task_skills"
+ "task_skills",
+ "replay_vision_scan"
],
"type": "string"
}
@@ -370,7 +371,7 @@
]
},
"type": {
- "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills",
+ "description": "* `string` - string\n* `number` - number\n* `boolean` - boolean\n* `dictionary` - dictionary\n* `choice` - choice\n* `json` - json\n* `integration` - integration\n* `integration_multi` - integration_multi\n* `integration_field` - integration_field\n* `email` - email\n* `native_email` - native_email\n* `posthog_assignee` - posthog_assignee\n* `posthog_ticket_tags` - posthog_ticket_tags\n* `posthog_business_hours` - posthog_business_hours\n* `non_failure_status_codes` - non_failure_status_codes\n* `customer_analytics_account_properties` - customer_analytics_account_properties\n* `customer_analytics_account_relationships` - customer_analytics_account_relationships\n* `task_model` - task_model\n* `task_repository` - task_repository\n* `task_mcp_installations` - task_mcp_installations\n* `signals_scout` - signals_scout\n* `task_skills` - task_skills\n* `replay_vision_scan` - replay_vision_scan",
"enum": [
"string",
"number",
@@ -393,7 +394,8 @@
"task_repository",
"task_mcp_installations",
"signals_scout",
- "task_skills"
+ "task_skills",
+ "replay_vision_scan"
],
"type": "string"
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json
index 6a645f72c6ba..2e5da7123935 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json
@@ -4326,6 +4326,30 @@
],
"description": "Length of the rolling frequency cap window in days. Set this together with marketing_frequency_cap_max_messages. Set both to null to turn the cap off."
},
+ "replay_vision_scan_rate_limit_per_day": {
+ "anyOf": [
+ {
+ "minimum": 0,
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "How many Replay Vision scans one workflow can request in a rolling 24 hours. Null uses the default of 100; zero pauses scans for every workflow in the project. Support raises the limit above 500."
+ },
+ "replay_vision_scan_team_rate_limit_per_day": {
+ "anyOf": [
+ {
+ "minimum": 0,
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "How many Replay Vision scans all workflows in the project request together in a rolling 24 hours. Null uses the default of 500; zero pauses scans for the project. Support raises the limit above 2500."
+ },
"workflow_task_rate_limit_per_day": {
"anyOf": [
{
diff --git a/tach.toml b/tach.toml
index f6e38660c67e..b40d870027e9 100644
--- a/tach.toml
+++ b/tach.toml
@@ -1125,6 +1125,9 @@ depends_on = [
# Facade-only: the Classify with AI action's endpoint asks the model through
# products.ml_inference.backend.facade.api.
"products.ml_inference",
+ # Facade-only: the Replay Vision step's endpoint starts a scan through
+ # products.replay_vision.backend.facade.api.
+ "products.replay_vision",
]
layer = "modules"