:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(workflows): add replay vision workflow templates and agent docs (#118382)
Tue Haulundd98fb34e7247
diff --git a/products/conversations/backend/api/tests/test_events.py b/products/conversations/backend/api/tests/test_events.pyindex c349d6578757..f336fa0bd8fb 100644--- a/products/conversations/backend/api/tests/test_events.py+++ b/products/conversations/backend/api/tests/test_events.py@@ -45,8 +45,11 @@ class TestConversationEvents(BaseTest):anonymous_traits={"name": "Test Customer", "email": "[email protected]"},)+ @parameterized.expand([("with_session", "session-abc"), ("without_session", None)])@patch("products.conversations.backend.events.capture_internal")- def test_capture_ticket_created_uses_team_token(self, mock_capture):+ def test_capture_ticket_created_uses_team_token(self, _name, session_id, mock_capture):+ self.ticket.session_id = session_id+ self.ticket.save(update_fields=["session_id"])capture_ticket_created(self.ticket)mock_capture.assert_called_once()@@ -58,9 +61,12 @@ class TestConversationEvents(BaseTest):assert call_kwargs["properties"]["ticket_id"] == str(self.ticket.id)assert call_kwargs["properties"]["customer_name"] == "Test Customer"assert call_kwargs["properties"]["customer_email"] == "[email protected]"+ assert call_kwargs["properties"].get("$session_id") == session_id@patch("products.conversations.backend.events.capture_internal")def test_capture_ticket_status_changed_uses_team_token(self, mock_capture):+ self.ticket.session_id = "session-abc"+ self.ticket.save(update_fields=["session_id"])capture_ticket_status_changed(self.ticket, "new", "pending", actor=self.user, actor_type="user")mock_capture.assert_called_once()@@ -79,6 +85,7 @@ class TestConversationEvents(BaseTest):assert call_kwargs["properties"]["customer_name"] == "Test Customer"assert call_kwargs["properties"]["customer_email"] == "[email protected]"assert call_kwargs["properties"]["customer_distinct_id"] == self.ticket.distinct_id+ assert "$session_id" not in call_kwargs["properties"]@patch("products.conversations.backend.events.capture_internal")def test_capture_ticket_priority_changed_uses_team_token(self, mock_capture):diff --git a/products/conversations/backend/events.py b/products/conversations/backend/events.pyindex cc906a14a096..1998618b5c16 100644--- a/products/conversations/backend/events.py+++ b/products/conversations/backend/events.py@@ -476,6 +476,9 @@ def _get_sla_properties(ticket: Ticket, now: datetime) -> dict:def capture_ticket_created(ticket: Ticket) -> None:properties = _get_ticket_base_properties(ticket)properties.update(_get_customer_properties(ticket))+ # Only the customer's own event joins their session; later ticket events come from staff, hours after it.+ if ticket.session_id:+ properties["$session_id"] = ticket.session_idteam = ticket.teamteam_id = team.iddiff --git a/products/workflows/backend/services/hog_flow_templates.py b/products/workflows/backend/services/hog_flow_templates.pyindex 7a2b679016bf..1776a4a4cdef 100644--- a/products/workflows/backend/services/hog_flow_templates.py+++ b/products/workflows/backend/services/hog_flow_templates.py@@ -171,6 +171,7 @@ _BUILT_IN_STEP_TEMPLATE_IDS = frozenset("template-posthog-create-task","template-posthog-run-scout","template-posthog-classify",+ "template-posthog-replay-vision","template-posthog-capture","template-posthog-update-person-properties","template-posthog-group-identify",diff --git a/products/workflows/backend/templates/__init__.py b/products/workflows/backend/templates/__init__.pyindex 7aa3d3415bb6..2dbea0c3dfa0 100644--- a/products/workflows/backend/templates/__init__.py+++ b/products/workflows/backend/templates/__init__.py@@ -18,6 +18,9 @@ TEMPLATE_FILES = ["ai-support-first-responder.json","ai-scheduled-report.json","ai-slack-alert-responder.json",+ "replay-vision-survey-context.json",+ "replay-vision-support-ticket-context.json",+ "replay-vision-onboarding-friction.json",]_TEMPLATE_CACHE: Optional[list[dict]] = Nonediff --git a/products/workflows/backend/templates/replay-vision-onboarding-friction.json b/products/workflows/backend/templates/replay-vision-onboarding-friction.jsonnew file mode 100644index 000000000000..fe5557e9f10c--- /dev/null+++ b/products/workflows/backend/templates/replay-vision-onboarding-friction.json@@ -0,0 +1,261 @@+{+ "id": "718d609b-4802-4ee4-8784-7a62af5057e8",+ "name": "Onboarding friction alerts",+ "description": "After someone signs up, Replay Vision scores how smoothly they got started. Low scores go to Slack, so your team can reach out while it matters.",+ "version": 1,+ "created_at": "2026-10-16T00:00:00Z",+ "created_by": null,+ "updated_at": "2026-10-16T00:00:00Z",+ "image_url": "https://res.cloudinary.com/dmukukwp6/image/upload/f_webp,h_270,w_480,c_fill,g_auto,q_auto/growth_think_905cd0fa65?_a=AXAH4nI0",+ "trigger": {+ "type": "event",+ "filters": {+ "events": [+ {+ "id": "user signed up",+ "name": "user signed up",+ "type": "events",+ "uuid": "1c11a280-b175-4066-a467-21a9df23c047",+ "order": 0+ }+ ],+ "source": "events",+ "actions": [],+ "properties": [+ {+ "key": "$session_id",+ "type": "event",+ "operator": "is_set"+ }+ ],+ "filter_test_accounts": true+ }+ },+ "trigger_masking": null,+ "conversion": {+ "filters": [],+ "window_minutes": null+ },+ "exit_condition": "exit_only_at_end",+ "edges": [+ {+ "from": "trigger_node",+ "to": "action_function_17427d8c-fceb-4bc1-9e17-ccc26cb6e57f",+ "type": "continue"+ },+ {+ "from": "action_function_17427d8c-fceb-4bc1-9e17-ccc26cb6e57f",+ "to": "action_conditional_branch_fdda13ee-acd4-4be4-a8d7-e6e9ed8e6e9f",+ "type": "continue"+ },+ {+ "from": "action_conditional_branch_fdda13ee-acd4-4be4-a8d7-e6e9ed8e6e9f",+ "to": "exit_node",+ "type": "continue"+ },+ {+ "from": "action_conditional_branch_fdda13ee-acd4-4be4-a8d7-e6e9ed8e6e9f",+ "to": "action_function_edb5e71c-cd74-4a00-a0d0-70af4fc7d4f0",+ "type": "branch",+ "index": 0+ },+ {+ "from": "action_function_edb5e71c-cd74-4a00-a0d0-70af4fc7d4f0",+ "to": "exit_node",+ "type": "continue"+ }+ ],+ "actions": [+ {+ "id": "trigger_node",+ "name": "User signed up",+ "description": "Runs when someone signs up. Change the event to the one your product sends.",+ "on_error": null,+ "created_at": 0,+ "updated_at": 0,+ "filters": null,+ "type": "trigger",+ "output_variable": null,+ "config": {+ "type": "event",+ "filters": {+ "events": [+ {+ "id": "user signed up",+ "name": "user signed up",+ "type": "events",+ "uuid": "1c11a280-b175-4066-a467-21a9df23c047",+ "order": 0+ }+ ],+ "source": "events",+ "actions": [],+ "properties": [+ {+ "key": "$session_id",+ "type": "event",+ "operator": "is_set"+ }+ ],+ "filter_test_accounts": true+ }+ }+ },+ {+ "id": "action_function_17427d8c-fceb-4bc1-9e17-ccc26cb6e57f",+ "name": "Score onboarding",+ "description": "Replay Vision watches the signup session and scores how smoothly the person got started, from 1 to 5.",+ "on_error": "continue",+ "created_at": 1791763200000,+ "updated_at": 1791763200000,+ "filters": null,+ "type": "function",+ "output_variable": [+ {+ "key": "vision_score",+ "result_path": "output.score"+ },+ {+ "key": "vision_reasoning",+ "result_path": "output.reasoning"+ }+ ],+ "config": {+ "template_id": "template-posthog-replay-vision",+ "inputs": {+ "analysis": {+ "value": {+ "type": "scorer",+ "prompt": "This person just signed up. Score how smoothly they got started in this session, so the team can reach out to people who struggled.\n\nLook at what happened after signup: whether they reached the product's main setup steps, how long that took, and what got in the way. Signs of friction are errors, failed requests, empty or broken pages, rage clicks, repeated attempts, long pauses on one screen, going back and forth, or leaving partway through setup.\n\nUse this scale:\n5: Got set up without trouble.\n4: Got set up, with a small hiccup.\n3: Got set up, but slowly or with clear confusion.\n2: Hit real problems and only partly got set up.\n1: Got stuck, hit blocking errors, or gave up.\n\nIn your reasoning, name the moment that most affected the score.",+ "scale": {+ "min": 1,+ "max": 5+ }+ }+ },+ "non_failure_status_codes": {+ "value": [409]+ }+ }+ }+ },+ {+ "id": "action_conditional_branch_fdda13ee-acd4-4be4-a8d7-e6e9ed8e6e9f",+ "name": "Low score?",+ "description": "Matches a score of 2 or lower. Change the number to alert on more or fewer signups.",+ "on_error": null,+ "created_at": 1791763200000,+ "updated_at": 1791763200000,+ "filters": null,+ "type": "conditional_branch",+ "config": {+ "conditions": [+ {+ "name": "Score of 2 or lower",+ "filters": {+ "source": "events",+ "properties": [+ {+ "key": "vision_score",+ "type": "workflow_variable",+ "operator": "lte",+ "value": 2+ }+ ]+ }+ }+ ]+ },+ "output_variable": null+ },+ {+ "id": "action_function_edb5e71c-cd74-4a00-a0d0-70af4fc7d4f0",+ "name": "Alert in Slack",+ "description": "Posts the score and Replay Vision's reasoning to a Slack channel.",+ "on_error": null,+ "created_at": 1791763200000,+ "updated_at": 1791763200000,+ "filters": null,+ "type": "function",+ "config": {+ "inputs": {+ "slack_workspace": {+ "templating": "hog"+ },+ "channel": {+ "templating": "hog"+ },+ "icon_emoji": {+ "value": ":hedgehog:",+ "templating": "hog"+ },+ "username": {+ "value": "PostHog",+ "templating": "hog"+ },+ "blocks": {+ "value": [+ {+ "type": "section",+ "text": {+ "type": "mrkdwn",+ "text": "*{person.name}* had a rough start after signing up\n\n*Onboarding score:* {variables.vision_score} out of 5\n\n*Why:*\n{substring(variables.vision_reasoning, 1, 2500)}"+ }+ },+ {+ "type": "actions",+ "elements": [+ {+ "type": "button",+ "text": {+ "type": "plain_text",+ "text": "View person in PostHog"+ },+ "url": "{person.url}"+ }+ ]+ }+ ],+ "templating": "hog"+ },+ "text": {+ "value": "*{person.name}* had a rough start after signing up",+ "templating": "hog"+ }+ },+ "template_id": "template-slack"+ },+ "output_variable": null+ },+ {+ "id": "exit_node",+ "name": "Exit",+ "description": "User moved through the workflow without errors.",+ "on_error": null,+ "created_at": 0,+ "updated_at": 0,+ "filters": null,+ "type": "exit",+ "config": {+ "reason": "Default exit"+ },+ "output_variable": null+ }+ ],+ "abort_action": null,+ "variables": [+ {+ "key": "vision_score",+ "type": "number",+ "default": ""+ },+ {+ "key": "vision_reasoning",+ "type": "string",+ "default": ""+ }+ ],+ "billable_action_types": ["function"],+ "tags": ["ai", "replay vision", "onboarding", "slack"],+ "scope": "global"+}diff --git a/products/workflows/backend/templates/replay-vision-support-ticket-context.json b/products/workflows/backend/templates/replay-vision-support-ticket-context.jsonnew file mode 100644index 000000000000..fa6e6102e022--- /dev/null+++ b/products/workflows/backend/templates/replay-vision-support-ticket-context.json@@ -0,0 +1,200 @@+{+ "id": "f041bc74-fedd-4438-8455-ac97031b98a7",+ "name": "Support tickets with session context",+ "description": "When a customer creates a support ticket, Replay Vision summarizes their session and posts it to Slack, so whoever picks up the ticket knows what happened.",+ "version": 1,+ "created_at": "2026-10-16T00:00:00Z",+ "created_by": null,+ "updated_at": "2026-10-16T00:00:00Z",+ "image_url": "https://res.cloudinary.com/dmukukwp6/image/upload/Template_cover_9_cc52152691.jpg",+ "trigger": {+ "type": "event",+ "filters": {+ "source": "events",+ "events": [+ {+ "id": "$conversation_ticket_created",+ "name": "New ticket created",+ "type": "events"+ }+ ],+ "properties": [+ {+ "key": "$session_id",+ "type": "event",+ "operator": "is_set"+ }+ ]+ }+ },+ "trigger_masking": null,+ "conversion": {+ "filters": [],+ "window_minutes": null+ },+ "exit_condition": "exit_only_at_end",+ "edges": [+ {+ "from": "trigger_node",+ "to": "action_function_02a1b96f-f091-48f8-906c-172af4e01060",+ "type": "continue"+ },+ {+ "from": "action_function_02a1b96f-f091-48f8-906c-172af4e01060",+ "to": "action_function_dd61516d-e5ac-477e-887d-3a23a5e95725",+ "type": "continue"+ },+ {+ "from": "action_function_dd61516d-e5ac-477e-887d-3a23a5e95725",+ "to": "exit_node",+ "type": "continue"+ }+ ],+ "actions": [+ {+ "id": "trigger_node",+ "name": "Support ticket created",+ "description": "Runs when a customer creates a support ticket from a session PostHog recorded.",+ "on_error": null,+ "created_at": 0,+ "updated_at": 0,+ "filters": null,+ "type": "trigger",+ "output_variable": null,+ "config": {+ "type": "event",+ "filters": {+ "source": "events",+ "events": [+ {+ "id": "$conversation_ticket_created",+ "name": "New ticket created",+ "type": "events"+ }+ ],+ "properties": [+ {+ "key": "$session_id",+ "type": "event",+ "operator": "is_set"+ }+ ]+ }+ }+ },+ {+ "id": "action_function_02a1b96f-f091-48f8-906c-172af4e01060",+ "name": "Summarize the session",+ "description": "Replay Vision watches the session where the ticket was created and summarizes what the customer did before asking for help.",+ "on_error": "continue",+ "created_at": 1791763200000,+ "updated_at": 1791763200000,+ "filters": null,+ "type": "function",+ "output_variable": [+ {+ "key": "vision_summary",+ "result_path": "output.summary"+ }+ ],+ "config": {+ "template_id": "template-posthog-replay-vision",+ "inputs": {+ "analysis": {+ "value": {+ "type": "summarizer",+ "prompt": "This customer just created a support ticket. Whoever picks up the ticket will read your summary first, so they understand the problem before replying.\n\nSummarize the session with a focus on the moments before the ticket:\n1. What the customer was trying to do, and the steps they took.\n2. The page or feature they were on when they asked for help.\n3. Any errors, failed requests, error messages on screen, or broken or slow pages, with when they happened.\n4. Where they got stuck or confused, for example repeated attempts, rage clicks, or going back and forth between pages.\n5. Anything they tried to fix it themselves, such as reloading or searching the docs.\n\nKeep it short and factual. If the session shows no clear problem, say so."+ }+ },+ "non_failure_status_codes": {+ "value": [409]+ }+ }+ }+ },+ {+ "id": "action_function_dd61516d-e5ac-477e-887d-3a23a5e95725",+ "name": "Notify in Slack",+ "description": "Posts the new ticket and the session summary to a Slack channel.",+ "on_error": null,+ "created_at": 1791763200000,+ "updated_at": 1791763200000,+ "filters": null,+ "type": "function",+ "config": {+ "inputs": {+ "slack_workspace": {+ "templating": "hog"+ },+ "channel": {+ "templating": "hog"+ },+ "icon_emoji": {+ "value": ":hedgehog:",+ "templating": "hog"+ },+ "username": {+ "value": "PostHog",+ "templating": "hog"+ },+ "blocks": {+ "value": [+ {+ "type": "section",+ "text": {+ "type": "mrkdwn",+ "text": "*New support ticket from {person.name}*\n*Email:* {person.email}\n\n*What happened in the session:*\n{substring(variables.vision_summary, 1, 2500)}"+ }+ },+ {+ "type": "actions",+ "elements": [+ {+ "type": "button",+ "text": {+ "type": "plain_text",+ "text": "View person in PostHog"+ },+ "url": "{person.url}"+ }+ ]+ }+ ],+ "templating": "hog"+ },+ "text": {+ "value": "*{person.name}* created a support ticket",+ "templating": "hog"+ }+ },+ "template_id": "template-slack"+ },+ "output_variable": null+ },+ {+ "id": "exit_node",+ "name": "Exit",+ "description": "User moved through the workflow without errors.",+ "on_error": null,+ "created_at": 0,+ "updated_at": 0,+ "filters": null,+ "type": "exit",+ "config": {+ "reason": "Default exit"+ },+ "output_variable": null+ }+ ],+ "abort_action": null,+ "variables": [+ {+ "key": "vision_summary",+ "type": "string",+ "default": ""+ }+ ],+ "billable_action_types": ["function"],+ "tags": ["ai", "replay vision", "support", "support ticket", "slack"],+ "scope": "global"+}diff --git a/products/workflows/backend/templates/replay-vision-survey-context.json b/products/workflows/backend/templates/replay-vision-survey-context.jsonnew file mode 100644index 000000000000..b8baf4d7f362--- /dev/null+++ b/products/workflows/backend/templates/replay-vision-survey-context.json@@ -0,0 +1,263 @@+{+ "id": "36022328-1e1c-45bc-849d-e521e7c00d2e",+ "name": "Negative survey feedback with session context",+ "description": "When someone leaves a low survey rating, Replay Vision summarizes their session and posts it to Slack with the feedback, so your team sees what led to it.",+ "version": 1,+ "created_at": "2026-10-16T00:00:00Z",+ "created_by": null,+ "updated_at": "2026-10-16T00:00:00Z",+ "image_url": "https://res.cloudinary.com/dmukukwp6/image/upload/Template_cover_2_c54cc98bea.jpg",+ "trigger": {+ "type": "event",+ "filters": {+ "events": [+ {+ "id": "survey sent",+ "name": "Survey sent",+ "type": "events"+ }+ ],+ "source": "events",+ "properties": [+ {+ "key": "$survey_id",+ "type": "event",+ "operator": "is_set"+ },+ {+ "key": "$survey_completed",+ "type": "event",+ "value": true,+ "operator": "exact"+ },+ {+ "key": "$session_id",+ "type": "event",+ "operator": "is_set"+ }+ ],+ "filter_test_accounts": false+ }+ },+ "trigger_masking": null,+ "conversion": {+ "filters": [],+ "window_minutes": null+ },+ "exit_condition": "exit_only_at_end",+ "edges": [+ {+ "from": "trigger_node",+ "to": "action_conditional_branch_d2a41def-3023-4776-9441-bd5d6b379b2b",+ "type": "continue"+ },+ {+ "from": "action_conditional_branch_d2a41def-3023-4776-9441-bd5d6b379b2b",+ "to": "exit_node",+ "type": "continue"+ },+ {+ "from": "action_conditional_branch_d2a41def-3023-4776-9441-bd5d6b379b2b",+ "to": "action_function_ac627245-3a85-4acd-8c8e-127a76b31bb9",+ "type": "branch",+ "index": 0+ },+ {+ "from": "action_function_ac627245-3a85-4acd-8c8e-127a76b31bb9",+ "to": "action_function_2e097608-aa1b-4e41-b676-77edfe9bc0a9",+ "type": "continue"+ },+ {+ "from": "action_function_2e097608-aa1b-4e41-b676-77edfe9bc0a9",+ "to": "exit_node",+ "type": "continue"+ }+ ],+ "actions": [+ {+ "id": "trigger_node",+ "name": "Survey completed",+ "description": "Runs when someone completes a survey.",+ "on_error": null,+ "created_at": 0,+ "updated_at": 0,+ "filters": null,+ "type": "trigger",+ "output_variable": null,+ "config": {+ "type": "event",+ "filters": {+ "events": [+ {+ "id": "survey sent",+ "name": "Survey sent",+ "type": "events"+ }+ ],+ "source": "events",+ "properties": [+ {+ "key": "$survey_id",+ "type": "event",+ "operator": "is_set"+ },+ {+ "key": "$survey_completed",+ "type": "event",+ "value": true,+ "operator": "exact"+ },+ {+ "key": "$session_id",+ "type": "event",+ "operator": "is_set"+ }+ ],+ "filter_test_accounts": false+ }+ }+ },+ {+ "id": "action_conditional_branch_d2a41def-3023-4776-9441-bd5d6b379b2b",+ "name": "Low rating?",+ "description": "Matches a rating of 2 or lower on the survey's first question. Change the number to fit your rating scale.",+ "on_error": null,+ "created_at": 1772805521677,+ "updated_at": 1772805521677,+ "filters": null,+ "type": "conditional_branch",+ "config": {+ "conditions": [+ {+ "name": "Rating of 2 or lower",+ "filters": {+ "source": "events",+ "properties": [+ {+ "key": "toFloat(coalesce(properties[concat('$survey_response_', properties.$survey_questions[1].id)], properties.$survey_response)) <= 2",+ "type": "hogql",+ "value": null+ }+ ]+ }+ }+ ]+ },+ "output_variable": null+ },+ {+ "id": "action_function_ac627245-3a85-4acd-8c8e-127a76b31bb9",+ "name": "Summarize the session",+ "description": "Replay Vision watches the session where the feedback was given and summarizes what the person did.",+ "on_error": "continue",+ "created_at": 1791763200000,+ "updated_at": 1791763200000,+ "filters": null,+ "type": "function",+ "output_variable": [+ {+ "key": "vision_summary",+ "result_path": "output.summary"+ }+ ],+ "config": {+ "template_id": "template-posthog-replay-vision",+ "inputs": {+ "analysis": {+ "value": {+ "type": "summarizer",+ "prompt": "This person just completed a survey and gave a low rating. The team will read your summary next to their feedback to understand what led to it.\n\nSummarize the session with a focus on the moments before the survey:\n1. What they were trying to do, and whether they managed it.\n2. Where they had trouble: errors, failed requests, slow or broken pages, rage clicks, repeated attempts, or moments where they seemed lost.\n3. The page or feature they were on when the survey appeared.\n4. Anything else that may explain the low rating, such as a missing feature they looked for or a confusing flow.\n\nIf the session shows no clear problem, say so. Don't guess at a cause the recording doesn't show."+ }+ },+ "non_failure_status_codes": {+ "value": [409]+ }+ }+ }+ },+ {+ "id": "action_function_2e097608-aa1b-4e41-b676-77edfe9bc0a9",+ "name": "Alert in Slack",+ "description": "Posts the feedback and the session summary to a Slack channel.",+ "on_error": null,+ "created_at": 1791763200000,+ "updated_at": 1791763200000,+ "filters": null,+ "type": "function",+ "config": {+ "inputs": {+ "slack_workspace": {+ "templating": "hog"+ },+ "channel": {+ "templating": "hog"+ },+ "icon_emoji": {+ "value": ":hedgehog:",+ "templating": "hog"+ },+ "username": {+ "value": "PostHog",+ "templating": "hog"+ },+ "blocks": {+ "value": [+ {+ "type": "section",+ "text": {+ "type": "mrkdwn",+ "text": "*{person.name}* left negative survey feedback\n\n*Rating:* {event.properties[concat('$survey_response_', event.properties.$survey_questions[1].id)] ?? event.properties.$survey_response}\n\n*What happened in the session:*\n{substring(variables.vision_summary, 1, 2500)}"+ }+ },+ {+ "type": "actions",+ "elements": [+ {+ "type": "button",+ "text": {+ "type": "plain_text",+ "text": "View person in PostHog"+ },+ "url": "{person.url}"+ }+ ]+ }+ ],+ "templating": "hog"+ },+ "text": {+ "value": "*{person.name}* left negative survey feedback",+ "templating": "hog"+ }+ },+ "template_id": "template-slack"+ },+ "output_variable": null+ },+ {+ "id": "exit_node",+ "name": "Exit",+ "description": "User moved through the workflow without errors.",+ "on_error": null,+ "created_at": 0,+ "updated_at": 0,+ "filters": null,+ "type": "exit",+ "config": {+ "reason": "Default exit"+ },+ "output_variable": null+ }+ ],+ "abort_action": null,+ "variables": [+ {+ "key": "vision_summary",+ "type": "string",+ "default": ""+ }+ ],+ "billable_action_types": ["function"],+ "tags": ["ai", "replay vision", "survey", "slack"],+ "scope": "global"+}diff --git a/products/workflows/skills/building-workflows/references/graph-schema.md b/products/workflows/skills/building-workflows/references/graph-schema.mdindex 3bda790e8a44..7938153d3ab0 100644--- a/products/workflows/skills/building-workflows/references/graph-schema.md+++ b/products/workflows/skills/building-workflows/references/graph-schema.md@@ -159,6 +159,45 @@ Retrieve `template-native-push` with `cdp-function-templates-retrieve` for the f- Required: `distinctId`, `channels`, `title`. Optional: `body`, `image`, `data`, `ttlSeconds`, `android_*`, `ios_*` (retrieve the `inputs_schema` for the full set).- Never hand-author `bytecode` — the server compiles it from `value`. Omit `order` too: the editor lays fields out in the template's `inputs_schema` order (fixed and consistent), not by the `order` on your inputs, so leaving it off doesn't change the form. Push has no delivered/opened/clicked signal (FCM/APNs respond synchronously), so a successful send means "accepted for delivery", nothing more.+### Replay Vision step++Replay Vision is PostHog's AI that watches session recordings. It replays a session as video, together with its events, and answers a question about it. Each scan uses credits from the project's Replay Vision quota.++A `function` node with `template_id: "template-posthog-replay-vision"` scans the trigger event's session and waits for the answer. Use it when the next step depends on what happened in the session, which event properties alone can't tell, for example to add session context to a Slack alert or to branch on whether the user struggled. The project must record sessions, and the trigger event must carry a `$session_id`.++```json+{+ "id": "vision_1",+ "name": "Did checkout fail?",+ "type": "function",+ "config": {+ "template_id": "template-posthog-replay-vision",+ "inputs": {+ "analysis": { "value": { "type": "monitor", "prompt": "Did the user hit an error during checkout?" } }+ }+ },+ "output_variable": { "key": "replay_vision" }+}+```++- **`analysis` is a literal object, not a template.** Never set `"templating"` on it, and never put `{...}` expressions in it. Its `value` takes one of these shapes:++ | `type` | Required keys | What the step answers |+ | ------------ | ----------------------------------------------- | --------------------------------------------------------- |+ | `monitor` | `prompt` | A yes/no verdict on the question in `prompt`. |+ | `classifier` | `prompt`, `tags` (1 to 100 category strings) | Which of the categories in `tags` fit the session. |+ | `scorer` | `prompt`, `scale: {"min": <num>, "max": <num>}` | A score on the scale. `max` must be greater than `min`. |+ | `summarizer` | `prompt` | A title, a summary, and chapters. |+ | `scanner` | `scanner_id` (a saved scanner's UUID) | The saved scanner's answer, with its own type and prompt. |++- The inline types take the same optional settings as a saved scanner of that type. See the `creating-replay-vision-scanners` skill. Find saved scanners with the `vision-scanners` tools.+- `session_id` defaults to `{event.properties.$session_id}`. Leave it unset unless the session ID is in another property.+- `wait_for_session_end` defaults to `true`, which scans the recording after the session has been quiet for 35 minutes. Set it to `false` only when the trigger event comes after the session ended.+- The step result is `{"state", "output", "warnings"}`. `state` is `succeeded`, `failed`, `skipped`, `ineligible` or `lost`. `output` is the scanner's answer: `verdict`, `tags` or `score` with `reasoning` for a monitor, classifier or scorer, and `title`, `summary` and `chapters` for a summarizer. Every type also returns `confidence`. Use `output_variable` to keep the result, then branch on it.+- **Main environment only.** The server refuses the step in a child environment of a project.+- **Daily caps.** Each workflow can start 100 scans a day, and the project 500, unless the project settings change `replay_vision_scan_rate_limit_per_day` and `replay_vision_scan_team_rate_limit_per_day`. Past a cap the step returns `state: "skipped"` and the workflow continues.+- **Access.** The token needs `session_recording:read` (or `:write`) and `replay_scanner:write`, and the user needs access to recordings and to the saved scanner. Without them, the save fails with a message that names what is missing.+## Duration strings (`delay_duration`, `max_wait_duration`)Must match `^\d*\.?\d+[dhms]$` — a number plus unit `s` | `m` | `h` | `d`. Examples: `30s`, `30m`, `2h`, `1d`, `1.5d` (=36h).@@ -216,3 +255,4 @@ A `delay` waits either a fixed span or until a date carried by the person or the- [ ] All durations match `^\d*\.?\d+[dhms]$` and dodge the silent per-unit clamp.- [ ] Every `delay` sets exactly one of `delay_duration` and `delay_until`, and no `delay_until` carries hand-written `bytecode`.- [ ] Function inputs are `{key: {value: ...}}`; no hand-written `bytecode` anywhere; no top-level `trigger` field set.+- [ ] A Replay Vision step's `analysis` value is a literal object of one of the five shapes, with no `templating`.