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.

chore(mcp): prefer typed analytics and clarify query rendering (#111756)

Daniel Parkerfe41b51441bb
diff --git a/docs/published/handbook/engineering/ai/writing-skills.md b/docs/published/handbook/engineering/ai/writing-skills.md
index 6812b27ce6e0..4434a13fce48 100644
--- a/docs/published/handbook/engineering/ai/writing-skills.md
+++ b/docs/published/handbook/engineering/ai/writing-skills.md
@@ -78,15 +78,17 @@ but need guidance on _which_ tools to use, in _what order_, with _what constrain
Query skills should choose methods from the requested calculation and output, not require typed queries or SQL for every task.
Reuse matching approved metrics or saved queries when they define the requested measure.
-Use typed queries when standard PostHog calculation rules or native insight controls matter.
+Default to typed runners for new product analytics and dashboard insights when their schemas support the requested calculation, including simple event counts, unique users, property sums, breakdowns, and time series.
Use SQL for record inspection, custom calculations, joins, existing SQL, or requests for SQL.
-For a new event-analytics query, prefer a typed query when both methods preserve the requested calculation and output, including simple aggregates.
+When both methods fit a new event-analytics query, use the typed runner. SQL examples and SQL discovery calls do not determine the final analysis method. Save supported dashboard analyses as native query nodes.
Keep valid existing SQL when it fits the task. A task that needs SQL does not require a failed typed-query attempt first.
Reassess when the task changes. Neither the previous tool call nor a request for a chart determines the next method.
Tool descriptions should state capabilities and limits. Skill examples should show direct inputs for the method they teach.
Keep SQL examples for SQL tasks rather than requiring agents to reconstruct typed inputs from generated SQL.
+Rendering guidance must account for the harness: direct tools and some exec hosts display query apps inline, while other exec hosts need the separate top-level `render-ui` tool. Skip duplicate rendering only when the harness or response indicates that the view is already displayed. Otherwise, if `render-ui` is available and its enum includes the query tool, render with the same tool name and validated input after the query succeeds. If no UI path is available, summarize or follow the harness's presentation instructions; do not change a supported typed query to SQL just to display a chart.
+
### When to write a skill
The decision flow:
diff --git a/products/dashboards/skills/building-a-dashboard/SKILL.md b/products/dashboards/skills/building-a-dashboard/SKILL.md
index 6e81612e890b..8fbfd8f29d49 100644
--- a/products/dashboards/skills/building-a-dashboard/SKILL.md
+++ b/products/dashboards/skills/building-a-dashboard/SKILL.md
@@ -52,7 +52,15 @@ Prefer reusing existing insights over recreating them.
- Search with `insights-list` and read promising ones with `insight-get` to check they match the user's intent and
actually have data. Full-text search misses things named differently, so list broadly before concluding an insight
doesn't exist.
-- For anything missing, create it with `insight-create` (see the product-analytics insight skills for query shape).
+- For anything missing, read `querying-posthog-data` before choosing its query method. After Data Catalog routing,
+ default to typed runners for each supported product-analytics tile: trends (including simple counts, unique users,
+ sums, and breakdowns), funnels, retention, stickiness, paths, and lifecycle. Run the query to verify it, then save its
+ native query node with `insight-create`. Use SQL-backed insights for explicit SQL requests or calculations the typed
+ schemas cannot express, such as custom joins. SQL used to discover events or existing insights does not determine
+ the query type of new tiles. Keep valid existing insights rather than rebuilding them.
+- Follow `querying-posthog-data` for presenting verified query results: some harnesses show charts inline, while
+ others need a separate top-level `render-ui` call with the same query tool and input. Rendering support does not
+ determine the saved insight's query type.
- Keep the set minimal — only the insights the request needs. A focused dashboard is more useful than an exhaustive one.
## Use Data Catalog for reusable metrics
diff --git a/products/posthog_ai/skills/querying-posthog-data/SKILL.md b/products/posthog_ai/skills/querying-posthog-data/SKILL.md
index f6cac49d9ab7..0b03cb533443 100644
--- a/products/posthog_ai/skills/querying-posthog-data/SKILL.md
+++ b/products/posthog_ai/skills/querying-posthog-data/SKILL.md
@@ -1,7 +1,7 @@
---
name: querying-posthog-data
description: >
- Explains how to choose typed queries or SQL for PostHog data.
+ Explains how to query PostHog data, defaulting to typed runners for supported product analytics.
Read it before you write HogQL/SQL.
Also read it before you call execute-sql against PostHog.
Use it to find or aggregate PostHog entities.
@@ -22,13 +22,13 @@ The [guidelines](./references/guidelines.md) explain SQL syntax and schema disco
## Choose the query path
-Choose the method from the requested calculation and output. Do not choose a method from the tool name. No method fits all tasks.
+Default to typed query tools for new product-analytics questions and dashboard insights when their schemas support the requested calculation. This includes simple event counts, unique users, property sums, breakdowns, and time series. Choose SQL only when the task needs SQL capabilities or explicitly requests SQL.
For governed measures, follow the semantic-layer workflow below before deriving a query. Reuse a matching approved metric or saved query when it defines the requested measure.
### Typed query tools
-Use a typed query when the task needs standard PostHog calculation rules or native insight controls:
+Use the matching typed query tool for supported product analytics:
- `posthog:query-trends` for native trends with series, breakdowns, formulas, and period comparisons.
- `posthog:query-funnel` for conversion rates, drop-off, and step completion.
@@ -46,19 +46,23 @@ Use `posthog:execute-sql` when:
- The request searches `system.*` tables for PostHog entities.
- The user requests SQL, record inspection, or changes to an existing SQL query.
- The analysis needs custom joins, CTEs, window functions, or warehouse SQL.
-- SQL results must inform how you construct a later typed query. Typed query tools cannot accept SQL results as input.
+- You need to inspect records or discover entities before constructing a later typed query. Use those findings to select events, properties, and filters; typed query tools cannot accept SQL result rows as input.
### When either method fits
-For a new event-analytics query, prefer a typed query when both methods preserve the requested calculation and output. This includes simple counts, sums, and other supported aggregates. Use SQL directly when the task calls for it. You do not need to try a typed query first.
+When both methods fit a new event-analytics query, use the typed runner. SQL being familiar, an example being written in SQL, or an earlier discovery call using SQL is not a reason to choose SQL for the final analysis. Use SQL directly when the task needs its capabilities; a failed typed-query attempt is not required.
-Keep a valid existing query when it fits the task. Choose the method again when the task changes. The previous tool call does not determine the method. Do not choose a method only because the user requests a chart or table. Both methods can support saved visualizations.
+Keep a valid existing query when it fits the task. Choose the method again when the task changes. For each new dashboard tile, run the matching typed query and save its native query node (such as `TrendsQuery` or `FunnelsQuery`) with `insight-create`; do not wrap an equivalent SQL query in `HogQLQuery`. Use SQL-backed insights only for tiles that need SQL. Both methods support visualizations, so a chart or table request alone does not justify SQL.
## Render query results
-Use the UI resource returned by the selected query tool. For example, `posthog:query-trends` returns the `query-results` UI resource. Do not call `posthog:render-ui` for the same result.
+Choose the presentation path from the harness's capabilities, independently of the query method. A query tool having a UI resource does not mean every harness displays it, especially when the call runs inside `exec`.
-Keep a written summary with the visualization. If the query tool does not return a UI, follow the client's rendering instructions.
+- **Already displayed:** direct tool calls and some exec harnesses render query results inline. When the harness says the interactive view is visible (for example, the response says "The user already sees this result as an interactive view"), summarize the conclusion without rendering the same chart again.
+- **Exec returned data without a chart:** if the harness exposes the top-level `posthog:render-ui` tool and the query tool is in its `tool_name` enum, call it after the query succeeds. Pass the same tool name and validated input (for example, `tool_name: "query-trends"` with the successful trends input as `tool_input`). Call `render-ui` directly, not through `exec`. The widget fetches its own data; pass query inputs, not result rows or a new SQL query.
+- **No supported UI tool:** follow the harness's rendering instructions or provide a written summary. Keep the typed query; lack of an inline chart is not a reason to switch to SQL.
+
+Keep a concise written conclusion alongside the visualization.
## When to use this skill
diff --git a/products/posthog_ai/skills/querying-posthog-data/references/example-trends-unique-users.md.j2 b/products/posthog_ai/skills/querying-posthog-data/references/example-trends-unique-users.md.j2
index d9d7133b2857..b15d77ae9844 100644
--- a/products/posthog_ai/skills/querying-posthog-data/references/example-trends-unique-users.md.j2
+++ b/products/posthog_ai/skills/querying-posthog-data/references/example-trends-unique-users.md.j2
@@ -17,6 +17,22 @@ The omitted `filterTestAccounts` field follows the project's "Filter out interna
Use the native insight controls for breakdowns or period comparisons. Do not generate SQL only to render this insight.
+If the harness displays the interactive chart inline, summarize it without rendering again. If a successful exec call returns data without a chart and the top-level `render-ui` tool includes `query-trends` in its enum, call it directly with the same input:
+
+```json
+{
+ "tool_name": "query-trends",
+ "tool_input": {
+ "kind": "TrendsQuery",
+ "series": [{ "kind": "EventsNode", "event": "chat with ai", "math": "dau" }],
+ "dateRange": { "date_from": "-30d" },
+ "interval": "day"
+ }
+}
+```
+
+If there is no supported UI tool, follow the harness's presentation instructions or summarize the result. Keep the typed query.
+
## SQL representation
This build-time SQL represents the same aggregation and time range. It cannot inherit the project's test-account setting. Before running or adapting it, apply the project's test-account filters when "Filter out internal and test users" is enabled.
@@ -25,10 +41,10 @@ This build-time SQL represents the same aggregation and time range. It cannot in
{{ render_hogql_example({"kind": "TrendsQuery", "series": [{"kind": "EventsNode", "event": "chat with ai", "math": "dau"}], "dateRange": {"date_from": "-30d"}, "interval": "day"}) }}
```
-## Simple aggregate: prefer a typed query when both fit
+## Simple aggregate: default to a typed query
For "Count `chat with ai` events in the last seven days", either a typed total or SQL can answer the question.
-Prefer the typed query for a new analysis when both methods preserve the requested calculation and output.
+Use the typed query for a new analysis when both methods preserve the requested calculation and output.
Use `posthog:query-trends` with `math: "total"`, `compareFilter.compare: true`, `trendsFilter.display: "Metric"`, `trendsFilter.metricSummary: "total"`, and the requested time bounds.
Resolve both rolling bounds to ISO 8601 timestamps and pass them as `date_from` and `date_to` when matching the SQL window below.
diff --git a/services/mcp/src/templates/execute-sql-prompt.md b/services/mcp/src/templates/execute-sql-prompt.md
index bdce5bfa2153..57d87efcf238 100644
--- a/services/mcp/src/templates/execute-sql-prompt.md
+++ b/services/mcp/src/templates/execute-sql-prompt.md
@@ -10,11 +10,11 @@ Use SQL for record inspection, custom calculations, joins, existing SQL, or requ
For governed measures, check for a matching approved metric before deriving a new calculation.
-Use typed queries when standard PostHog calculation rules or native insight controls matter. Do not approximate standard funnels or retention with SQL.
+Default to typed runners for new product analytics and dashboard insights whenever their schemas support the requested calculation, including simple event counts, unique users, property sums, breakdowns, and time series (`query-trends`). Use the matching typed runner for funnels, retention, stickiness, paths, and lifecycle; do not approximate their standard calculation rules with SQL.
-For a new event-analytics query, prefer a typed query when both methods preserve the requested calculation and output, including simple aggregates. Use SQL directly when the task calls for it, without requiring a failed typed-query attempt. Keep valid existing SQL when it fits the task, and reassess when the task changes.
+When both methods fit, use the typed runner. SQL familiarity, SQL examples, or an earlier SQL discovery call do not justify SQL for the final analysis. Use SQL directly for the SQL-specific tasks above, without requiring a failed typed-query attempt. Keep valid existing SQL when it fits the task, and reassess when the task changes.
-Both typed queries and SQL can support saved visualizations. A chart or table alone does not determine the method.
+Both typed queries and SQL support visualizations. Save supported dashboard analyses as native query nodes. A chart or table request, or a harness needing a separate rendering call, does not justify SQL.
{guidelines}
diff --git a/services/mcp/src/templates/render-ui-prompt.md b/services/mcp/src/templates/render-ui-prompt.md
index adc4d72a1753..793cee496a45 100644
--- a/services/mcp/src/templates/render-ui-prompt.md
+++ b/services/mcp/src/templates/render-ui-prompt.md
@@ -1,5 +1,7 @@
Render an interactive, explorable PostHog visualization for the user. Strongly prefer rendering whenever your answer centers on an analytics query, specific entity, or list that has a UI app — a trends or funnel result, experiment (or its results), survey (or its stats), cohort, action, error-tracking issue, session recording, trace, or workflow, plus the list view for most — so the user can see and verify it, not just read a text summary. Render in addition to your written summary, not instead of it, and not only when the user explicitly asks to "see" something.
+If the query result or harness explicitly says the user already sees an interactive view, keep your written conclusion and do not render the same result again. A UI resource on a query tool does not by itself establish that an exec call displayed the chart. Rendering is independent of query selection: keep typed runners for supported analytics, even when this separate presentation step is needed.
+
ALWAYS run `exec` first — `render-ui` is the final presentation step, never a discovery step. Use `exec` (`search` → `info` → `schema` → `call`) to resolve the entity (look up its real ID), confirm the data exists, and gather what you need for your written summary; only then render. Never render with a guessed `tool_input`.
`tool_name` must be a tool from the enum; `tool_input` is the same input you would `call` it with — which you already know from your exec work. The widget fetches its own data, so you may skip a *redundant* `call` of that same UI-app tool purely to populate the widget — but that is the only `call` you may skip, never the discovery/verification workflow. Never invent a `tool_name`.
@@ -10,7 +12,7 @@ When to render (always after exec, alongside your written answer):
- Status, "how is X going" → `render-ui({ "tool_name": "experiment-get", "tool_input": { "id": 2 } })`
- Lists / inventory, "what do we have" → the `*-list` tool, e.g. `render-ui({ "tool_name": "experiment-list", "tool_input": {} })`
- Results / stats, "is it significant", "response rate" → the results tool, e.g. `render-ui({ "tool_name": "survey-stats", "tool_input": { "survey_id": "abc123" } })`
-- Analytics queries → run the query with `exec` for your analysis, then render the same tool with the same input, e.g. `render-ui({ "tool_name": "query-trends", "tool_input": { ... } })`
+- Analytics queries without an inline chart → run the query with `exec` for your analysis, then render the same tool with the same validated input (not result rows), e.g. `render-ui({ "tool_name": "query-trends", "tool_input": { ... } })`
- After a mutation (create/launch/pause/end/resolve) → the entity's detail tool, to confirm the change landed
- Evidence mid-investigation (a recording, error issue, trace) → render it inline, e.g. `render-ui({ "tool_name": "query-error-tracking-issue", "tool_input": { "issueId": "0190-..." } })`
@@ -43,6 +45,6 @@ WRONG — the answer centers on a single experiment that has a UI app (`experime
<bad-example>
User: Show me a trends chart of weekly signups
-Assistant: [Runs query-trends through exec, then replies with a text-only summary]
+Assistant: [Runs query-trends through exec, receives data without an inline chart, then replies with a text-only summary]
WRONG — after running the query for analysis, render `query-trends` with the same validated input so the user can explore the chart.
</bad-example>
diff --git a/services/mcp/src/templates/sections/cli-rendering.md b/services/mcp/src/templates/sections/cli-rendering.md
index 18ac4c42a3cd..1c8687627ec4 100644
--- a/services/mcp/src/templates/sections/cli-rendering.md
+++ b/services/mcp/src/templates/sections/cli-rendering.md
@@ -1,6 +1,8 @@
### Rendering visualizations
-`render-ui` is a separate tool (not an `exec` command) — see its own description for the full enum and worked examples. When your answer centers on an entity or list whose tool is in `render-ui`'s `tool_name` enum, strongly prefer rendering it **in addition to** your written summary (not instead of it), so the user can verify the result instead of trusting a text dump — not only when they explicitly ask to "see" something. Reach for it on: status/health, lists/inventory, results/stats, post-mutation verification, and evidence surfaced mid-investigation. Pass the same `tool_input` you would `call` the tool with; it fetches its own data. Never invent a `tool_name`. (Results from `query-*` tools render through their own app automatically — do not route those through `render-ui`.)
+`render-ui` is a separate tool (not an `exec` command) — see its own description for the full enum and worked examples. When your answer centers on an entity or list whose tool is in `render-ui`'s `tool_name` enum, strongly prefer rendering it **in addition to** your written summary (not instead of it), so the user can verify the result instead of trusting a text dump — not only when they explicitly ask to "see" something. Reach for it on: status/health, lists/inventory, results/stats, post-mutation verification, and evidence surfaced mid-investigation. Pass the same `tool_input` you would `call` the tool with; it fetches its own data. Never invent a `tool_name`.
+
+For analytics, run the matching typed query through `exec` first. If the result or harness explicitly says the user already sees an interactive view, summarize it without a duplicate render. Otherwise, when the query tool is in `render-ui`'s enum, call the top-level `render-ui` with that tool name and the exact successful input. For example, a `query-trends` call through `exec` may return data without displaying its chart; `render-ui` presents that chart. Pass query inputs, not result rows. Do not switch to SQL to get a visualization.
ALWAYS run `exec` first. `render-ui` is the final presentation step, never a discovery step — use `exec` (`search`/`info`/`schema`/`call`) to resolve the entity's real ID and confirm the data, then render. Never render before exec, and never with a guessed `tool_input`.
diff --git a/services/mcp/src/templates/sections/retrieving-data.md b/services/mcp/src/templates/sections/retrieving-data.md
index e474d6809b36..8f6fb4b13701 100644
--- a/services/mcp/src/templates/sections/retrieving-data.md
+++ b/services/mcp/src/templates/sections/retrieving-data.md
@@ -2,11 +2,11 @@
Choose the query method from the requested result and calculation rules, after any metric-routing rules above. Reuse a matching approved metric or saved query when it defines the requested measure.
-- Use a typed query when standard PostHog calculation rules or native insight controls matter. Do not replace standard funnels or retention with approximate SQL.
+- Default to typed runners for new product analytics and dashboard insights whenever their schemas support the requested calculation: event counts, unique users, property sums, breakdowns, time series, funnels, retention, stickiness, paths, and lifecycle. Preserve PostHog's standard calculation rules rather than approximating them with SQL.
- Use `execute-sql` for record inspection, custom calculations, joins, existing SQL, or requests for SQL. It also supports entity search through `system.*` tables.
-- For a new event-analytics query, prefer a typed query when both methods preserve the requested calculation and output, including simple aggregates.
+- When both methods fit a new event-analytics query, use the typed runner. SQL familiarity or a SQL example is not a reason to choose SQL.
-SQL results can inform how you construct a later typed query. Typed query tools cannot accept SQL results as input. Reassess the method when the task changes, regardless of the previous tool call. A chart or table alone does not determine the method: both typed queries and SQL can support saved visualizations.
+SQL discovery can inform the events, properties, and filters for a later typed query; typed tools cannot accept SQL result rows as input. Reassess the method when the task changes, regardless of the previous tool call. Save supported dashboard analyses as native query nodes rather than equivalent `HogQLQuery` nodes. Both methods support visualizations; a chart request or missing inline UI does not justify switching to SQL.
Read the selected tool's description and schema when they are not already in context. You do not need to inspect every alternative before using SQL.
diff --git a/services/mcp/tests/unit/__snapshots__/instructions/exec-command-reference-full.txt b/services/mcp/tests/unit/__snapshots__/instructions/exec-command-reference-full.txt
index efd04ab706f6..402f5e0b63df 100644
--- a/services/mcp/tests/unit/__snapshots__/instructions/exec-command-reference-full.txt
+++ b/services/mcp/tests/unit/__snapshots__/instructions/exec-command-reference-full.txt
@@ -115,7 +115,9 @@ WRONG — skipped `call read-data-schema {"query": {"kind": "events"}}`. Never q
### Rendering visualizations
-`render-ui` is a separate tool (not an `exec` command) — see its own description for the full enum and worked examples. When your answer centers on an entity or list whose tool is in `render-ui`'s `tool_name` enum, strongly prefer rendering it **in addition to** your written summary (not instead of it), so the user can verify the result instead of trusting a text dump — not only when they explicitly ask to "see" something. Reach for it on: status/health, lists/inventory, results/stats, post-mutation verification, and evidence surfaced mid-investigation. Pass the same `tool_input` you would `call` the tool with; it fetches its own data. Never invent a `tool_name`. (Results from `query-*` tools render through their own app automatically — do not route those through `render-ui`.)
+`render-ui` is a separate tool (not an `exec` command) — see its own description for the full enum and worked examples. When your answer centers on an entity or list whose tool is in `render-ui`'s `tool_name` enum, strongly prefer rendering it **in addition to** your written summary (not instead of it), so the user can verify the result instead of trusting a text dump — not only when they explicitly ask to "see" something. Reach for it on: status/health, lists/inventory, results/stats, post-mutation verification, and evidence surfaced mid-investigation. Pass the same `tool_input` you would `call` the tool with; it fetches its own data. Never invent a `tool_name`.
+
+For analytics, run the matching typed query through `exec` first. If the result or harness explicitly says the user already sees an interactive view, summarize it without a duplicate render. Otherwise, when the query tool is in `render-ui`'s enum, call the top-level `render-ui` with that tool name and the exact successful input. For example, a `query-trends` call through `exec` may return data without displaying its chart; `render-ui` presents that chart. Pass query inputs, not result rows. Do not switch to SQL to get a visualization.
ALWAYS run `exec` first. `render-ui` is the final presentation step, never a discovery step — use `exec` (`search`/`info`/`schema`/`call`) to resolve the entity's real ID and confirm the data, then render. Never render before exec, and never with a guessed `tool_input`.
@@ -173,11 +175,11 @@ Example tool names: execute-sql, experiment-create, feature-flag-get-all.
Choose the query method from the requested result and calculation rules, after any metric-routing rules above. Reuse a matching approved metric or saved query when it defines the requested measure.
-- Use a typed query when standard PostHog calculation rules or native insight controls matter. Do not replace standard funnels or retention with approximate SQL.
+- Default to typed runners for new product analytics and dashboard insights whenever their schemas support the requested calculation: event counts, unique users, property sums, breakdowns, time series, funnels, retention, stickiness, paths, and lifecycle. Preserve PostHog's standard calculation rules rather than approximating them with SQL.
- Use `execute-sql` for record inspection, custom calculations, joins, existing SQL, or requests for SQL. It also supports entity search through `system.*` tables.
-- For a new event-analytics query, prefer a typed query when both methods preserve the requested calculation and output, including simple aggregates.
+- When both methods fit a new event-analytics query, use the typed runner. SQL familiarity or a SQL example is not a reason to choose SQL.
-SQL results can inform how you construct a later typed query. Typed query tools cannot accept SQL results as input. Reassess the method when the task changes, regardless of the previous tool call. A chart or table alone does not determine the method: both typed queries and SQL can support saved visualizations.
+SQL discovery can inform the events, properties, and filters for a later typed query; typed tools cannot accept SQL result rows as input. Reassess the method when the task changes, regardless of the previous tool call. Save supported dashboard analyses as native query nodes rather than equivalent `HogQLQuery` nodes. Both methods support visualizations; a chart request or missing inline UI does not justify switching to SQL.
Read the selected tool's description and schema when they are not already in context. You do not need to inspect every alternative before using SQL.
diff --git a/services/mcp/tests/unit/__snapshots__/instructions/tools-instructions.txt b/services/mcp/tests/unit/__snapshots__/instructions/tools-instructions.txt
index 4bbe92eec54e..7271c9a4b3db 100644
--- a/services/mcp/tests/unit/__snapshots__/instructions/tools-instructions.txt
+++ b/services/mcp/tests/unit/__snapshots__/instructions/tools-instructions.txt
@@ -74,11 +74,11 @@ The first call for that shape is `metric-list`; `read-data-schema`, `info query-
Choose the query method from the requested result and calculation rules, after any metric-routing rules above. Reuse a matching approved metric or saved query when it defines the requested measure.
-- Use a typed query when standard PostHog calculation rules or native insight controls matter. Do not replace standard funnels or retention with approximate SQL.
+- Default to typed runners for new product analytics and dashboard insights whenever their schemas support the requested calculation: event counts, unique users, property sums, breakdowns, time series, funnels, retention, stickiness, paths, and lifecycle. Preserve PostHog's standard calculation rules rather than approximating them with SQL.
- Use `execute-sql` for record inspection, custom calculations, joins, existing SQL, or requests for SQL. It also supports entity search through `system.*` tables.
-- For a new event-analytics query, prefer a typed query when both methods preserve the requested calculation and output, including simple aggregates.
+- When both methods fit a new event-analytics query, use the typed runner. SQL familiarity or a SQL example is not a reason to choose SQL.
-SQL results can inform how you construct a later typed query. Typed query tools cannot accept SQL results as input. Reassess the method when the task changes, regardless of the previous tool call. A chart or table alone does not determine the method: both typed queries and SQL can support saved visualizations.
+SQL discovery can inform the events, properties, and filters for a later typed query; typed tools cannot accept SQL result rows as input. Reassess the method when the task changes, regardless of the previous tool call. Save supported dashboard analyses as native query nodes rather than equivalent `HogQLQuery` nodes. Both methods support visualizations; a chart request or missing inline UI does not justify switching to SQL.
Read the selected tool's description and schema when they are not already in context. You do not need to inspect every alternative before using SQL.