:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(ai-observability): gate taggers behind llm-analytics-tags end to end (#99438)
Radu Raicea1fdb260016a9
diff --git a/docs/internal/ai-observability-taggers.md b/docs/internal/ai-observability-taggers.mdnew file mode 100644index 000000000000..89e3a665312b--- /dev/null+++ b/docs/internal/ai-observability-taggers.md@@ -0,0 +1,17 @@+# AI observability taggers++Taggers automatically add custom tags to AI generations.+The Tags pages and tagger API require the `llm-analytics-tags` feature flag.+The pages load tagger data only after the feature flag resolves as enabled.++## Creating taggers++Opening the Tags page only loads existing taggers.+An empty project stays empty until someone with editor access selects **Create tagger** and saves a tagger.+There is no automatic or bulk creation of default taggers.++Removing default creation does not change taggers that already exist.++## Planned retirement++We plan to remove Taggers as soon as Evaluations support categorical output types.diff --git a/frontend/src/productScenes.tsx b/frontend/src/productScenes.tsxindex 21c6c634e5cc..21033318c606 100644--- a/frontend/src/productScenes.tsx+++ b/frontend/src/productScenes.tsx@@ -29,7 +29,7 @@ export const productScenes: Record<string, () => Promise<any>> = {AIObservabilityEvaluationTemplates: () =>import('../../products/ai_observability/frontend/evaluations/EvaluationTemplates'),AIObservabilityTags: () => import('../../products/ai_observability/frontend/tags/AIObservabilityTagsScene'),- AIObservabilityTag: () => import('../../products/ai_observability/frontend/tags/AIObservabilityTag'),+ AIObservabilityTag: () => import('../../products/ai_observability/frontend/tags/AIObservabilityTagScene'),AIObservabilityPrompts: () => import('../../products/ai_observability/frontend/prompts/LLMPromptsScene'),AIObservabilityPrompt: () => import('../../products/ai_observability/frontend/prompts/LLMPromptScene'),AIObservabilityClusters: () =>diff --git a/posthog/tasks/ai_observability_usage_report.py b/posthog/tasks/ai_observability_usage_report.pyindex e4168cc17bf4..5710404df57e 100644--- a/posthog/tasks/ai_observability_usage_report.py+++ b/posthog/tasks/ai_observability_usage_report.py@@ -106,6 +106,7 @@ class TeamMetrics:ai_metric_count: int = 0ai_feedback_count: int = 0ai_evaluation_count: int = 0+ ai_tag_count: int = 0ai_is_error_count: int = 0ai_llm_judge_evaluation_count: int = 0ai_hog_evaluation_count: int = 0@@ -319,7 +320,7 @@ def _combine_all_metrics_results(results_list: list) -> dict[int, TeamMetrics]:metrics = team_metrics[team_id]- # Event counts (indices 1-11)+ # Event counts (indices 1-12)metrics.ai_generation_count += row[1] or 0metrics.ai_embedding_count += row[2] or 0metrics.ai_span_count += row[3] or 0@@ -327,38 +328,39 @@ def _combine_all_metrics_results(results_list: list) -> dict[int, TeamMetrics]:metrics.ai_metric_count += row[5] or 0metrics.ai_feedback_count += row[6] or 0metrics.ai_evaluation_count += row[7] or 0- metrics.ai_trace_summary_count += row[8] or 0- metrics.ai_generation_summary_count += row[9] or 0- metrics.ai_trace_clusters_count += row[10] or 0- metrics.ai_generation_clusters_count += row[11] or 0-- # Cost metrics (indices 12-16)- metrics.total_cost += row[12] or 0.0- metrics.input_cost += row[13] or 0.0- metrics.output_cost += row[14] or 0.0- metrics.request_cost += row[15] or 0.0- metrics.web_search_cost += row[16] or 0.0-- # Token metrics (indices 17-22)- metrics.prompt_tokens += row[17] or 0- metrics.completion_tokens += row[18] or 0- metrics.total_tokens += row[19] or 0- metrics.reasoning_tokens += row[20] or 0- metrics.cache_read_tokens += row[21] or 0- metrics.cache_creation_tokens += row[22] or 0-- # Cost anomaly counts (indices 23-25)- metrics.total_cost_count += row[23] or 0- metrics.total_cost_negative_count += row[24] or 0- metrics.total_cost_zero_count += row[25] or 0-- # Error count (index 26)- metrics.ai_is_error_count += row[26] or 0-- # Evaluation runtime counts (indices 27-29)- metrics.ai_llm_judge_evaluation_count += row[27] or 0- metrics.ai_hog_evaluation_count += row[28] or 0- metrics.ai_sentiment_evaluation_count += row[29] or 0+ metrics.ai_tag_count += row[8] or 0+ metrics.ai_trace_summary_count += row[9] or 0+ metrics.ai_generation_summary_count += row[10] or 0+ metrics.ai_trace_clusters_count += row[11] or 0+ metrics.ai_generation_clusters_count += row[12] or 0++ # Cost metrics (indices 13-17)+ metrics.total_cost += row[13] or 0.0+ metrics.input_cost += row[14] or 0.0+ metrics.output_cost += row[15] or 0.0+ metrics.request_cost += row[16] or 0.0+ metrics.web_search_cost += row[17] or 0.0++ # Token metrics (indices 18-23)+ metrics.prompt_tokens += row[18] or 0+ metrics.completion_tokens += row[19] or 0+ metrics.total_tokens += row[20] or 0+ metrics.reasoning_tokens += row[21] or 0+ metrics.cache_read_tokens += row[22] or 0+ metrics.cache_creation_tokens += row[23] or 0++ # Cost anomaly counts (indices 24-26)+ metrics.total_cost_count += row[24] or 0+ metrics.total_cost_negative_count += row[25] or 0+ metrics.total_cost_zero_count += row[26] or 0++ # Error count (index 27)+ metrics.ai_is_error_count += row[27] or 0++ # Evaluation runtime counts (indices 28-30)+ metrics.ai_llm_judge_evaluation_count += row[28] or 0+ metrics.ai_hog_evaluation_count += row[29] or 0+ metrics.ai_sentiment_evaluation_count += row[30] or 0return team_metrics@@ -395,6 +397,7 @@ def get_all_ai_metrics(countIf(event = '$ai_metric') as ai_metric_count,countIf(event = '$ai_feedback') as ai_feedback_count,countIf(event = '$ai_evaluation') as ai_evaluation_count,+ countIf(event = '$ai_tag') as ai_tag_count,countIf(event = '$ai_trace_summary') as ai_trace_summary_count,countIf(event = '$ai_generation_summary') as ai_generation_summary_count,countIf(event = '$ai_trace_clusters') as ai_trace_clusters_count,@@ -1017,6 +1020,7 @@ def _get_all_ai_observability_reports("ai_metric_count": 0,"ai_feedback_count": 0,"ai_evaluation_count": 0,+ "ai_tag_count": 0,"ai_is_error_count": 0,"ai_llm_judge_evaluation_count": 0,"ai_hog_evaluation_count": 0,@@ -1064,6 +1068,7 @@ def _get_all_ai_observability_reports(report["ai_metric_count"] += metrics.ai_metric_countreport["ai_feedback_count"] += metrics.ai_feedback_countreport["ai_evaluation_count"] += metrics.ai_evaluation_count+ report["ai_tag_count"] += metrics.ai_tag_countreport["ai_is_error_count"] += metrics.ai_is_error_countreport["ai_llm_judge_evaluation_count"] += metrics.ai_llm_judge_evaluation_countreport["ai_hog_evaluation_count"] += metrics.ai_hog_evaluation_countdiff --git a/posthog/tasks/test/test_ai_observability_usage_report.py b/posthog/tasks/test/test_ai_observability_usage_report.pyindex 46e3225b3c09..1e6698deb3b1 100644--- a/posthog/tasks/test/test_ai_observability_usage_report.py+++ b/posthog/tasks/test/test_ai_observability_usage_report.py@@ -104,6 +104,7 @@ class TestAIObservabilityUsageReport(APIBaseTest, ClickhouseTestMixin, Clickhousself._create_ai_events(self.team, distinct_id, "$ai_evaluation", 1, properties={"$ai_evaluation_runtime": "sentiment"})+ self._create_ai_events(self.team, distinct_id, "$ai_tag", 9)self._create_ai_events(self.team, distinct_id, "$ai_trace_summary", 7)self._create_ai_events(self.team, distinct_id, "$ai_generation_summary", 12)self._create_ai_events(self.team, distinct_id, "$ai_trace_clusters", 2)@@ -150,6 +151,7 @@ class TestAIObservabilityUsageReport(APIBaseTest, ClickhouseTestMixin, Clickhousassert metrics.ai_llm_judge_evaluation_count == 3assert metrics.ai_hog_evaluation_count == 2assert metrics.ai_sentiment_evaluation_count == 1+ assert metrics.ai_tag_count == 9assert metrics.ai_trace_summary_count == 7assert metrics.ai_generation_summary_count == 12assert metrics.ai_trace_clusters_count == 2diff --git a/products/ai_observability/backend/api/taggers.py b/products/ai_observability/backend/api/taggers.pyindex 3132ce1e5582..e1c3a921faf4 100644--- a/products/ai_observability/backend/api/taggers.py+++ b/products/ai_observability/backend/api/taggers.py@@ -29,7 +29,7 @@ from posthog.clickhouse.query_tagging import (tag_queries,)from posthog.event_usage import report_user_action-from posthog.permissions import AccessControlPermission+from posthog.permissions import AccessControlPermission, PostHogFeatureFlagPermissionfrom posthog.temporal.ai_observability.message_utils import extract_text_from_messagesfrom posthog.temporal.ai_observability.run_evaluation import extract_event_iofrom posthog.temporal.ai_observability.run_tagger import run_hog_tagger@@ -391,7 +391,8 @@ class TestHogTaggerResponseSerializer(serializers.Serializer):class TaggerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, ForbidDestroyModel, viewsets.ModelViewSet):scope_object = "tagger"- permission_classes = [IsAuthenticated, AccessControlPermission]+ permission_classes = [IsAuthenticated, AccessControlPermission, PostHogFeatureFlagPermission]+ posthog_feature_flag = "llm-analytics-tags"serializer_class = TaggerSerializerqueryset = Tagger.objects.all()filter_backends = [DjangoFilterBackend]diff --git a/products/ai_observability/backend/api/test/test_taggers.py b/products/ai_observability/backend/api/test/test_taggers.pyindex d5a036f304b5..d28aef6ca983 100644--- a/products/ai_observability/backend/api/test/test_taggers.py+++ b/products/ai_observability/backend/api/test/test_taggers.py@@ -1,6 +1,7 @@from uuid import uuid4from posthog.test.base import APIBaseTest+from unittest.mock import patchfrom parameterized import parameterizedfrom rest_framework import status@@ -49,6 +50,21 @@ def _make_tagger_config(**overrides):class TestTaggersApi(APIBaseTest):+ def setUp(self) -> None:+ super().setUp()+ feature_flag_patch = patch(+ "posthog.permissions.posthog_feature_flag_enabled",+ return_value=True,+ )+ feature_flag_patch.start()+ self.addCleanup(feature_flag_patch.stop)++ def test_feature_flag_gates_the_api_server_side(self):+ with patch("posthog.permissions.posthog_feature_flag_enabled", return_value=False):+ response = self.client.get(f"/api/environments/{self.team.id}/taggers/")++ assert response.status_code == status.HTTP_403_FORBIDDEN+def test_unauthenticated_user_cannot_access_taggers(self):self.client.logout()response = self.client.get(f"/api/environments/{self.team.id}/taggers/")@@ -380,6 +396,12 @@ class TestTaggersAccessControl(APIBaseTest):# that Evaluations and Datasets inherit from.def setUp(self) -> None:super().setUp()+ feature_flag_patch = patch(+ "posthog.permissions.posthog_feature_flag_enabled",+ return_value=True,+ )+ feature_flag_patch.start()+ self.addCleanup(feature_flag_patch.stop)self.organization.available_product_features = [{"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL},{"key": AvailableFeature.ROLE_BASED_ACCESS, "name": AvailableFeature.ROLE_BASED_ACCESS},diff --git a/products/ai_observability/frontend/tags/AIObservabilityTag.tsx b/products/ai_observability/frontend/tags/AIObservabilityTag.tsxindex 9bd9b49632ad..9bf177d0c0cb 100644--- a/products/ai_observability/frontend/tags/AIObservabilityTag.tsx+++ b/products/ai_observability/frontend/tags/AIObservabilityTag.tsx@@ -25,12 +25,11 @@ import { TZLabel } from 'lib/components/TZLabel'import { LemonSlider } from 'lib/lemon-ui/LemonSlider'import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'import { CodeEditorResizeable } from 'lib/monaco/CodeEditorResizable'-import { SceneExport } from 'scenes/sceneTypes'import { urls } from 'scenes/urls'import { SceneContent } from '~/layout/scenes/components/SceneContent'import { Query } from '~/queries/Query/Query'-import { InsightVizNode, NodeKind, ProductKey } from '~/queries/schema/schema-general'+import { InsightVizNode, NodeKind } from '~/queries/schema/schema-general'import { AccessControlLevel, AccessControlResourceType } from '~/types'import { getModelPickerFooterLink, ModelPicker } from '../ModelPicker'@@ -54,13 +53,6 @@ if (output ilike '%billing%') {}return result`-export const scene: SceneExport = {- component: AIObservabilityTagScene,- logic: llmTaggerLogic,- paramsToProps: ({ params }): { id: string } => ({ id: params.id || 'new' }),- productKey: ProductKey.AI_OBSERVABILITY,-}-function TagDefinitionsEditor({ id }: { id: string }): JSX.Element {const { taggerForm } = useValues(llmTaggerLogic({ id }))const { addTag, removeTag, updateTag } = useActions(llmTaggerLogic({ id }))@@ -738,7 +730,7 @@ function getTaggerProviderKeyIssue(tagger: Tagger | null, providerKeys: LLMProvireturn getUnhealthyProviderKey(providerKeys, tagger.model_configuration?.provider_key_id)}-export function AIObservabilityTagScene({ id }: { id?: string }): JSX.Element {+export function AIObservabilityTag({ id }: { id?: string }): JSX.Element {const taggerId = id || 'new'const isNew = taggerId === 'new'const { tagger, taggerLoading, activeTab, providerKeys } = useValues(llmTaggerLogic({ id: taggerId }))diff --git a/products/ai_observability/frontend/tags/AIObservabilityTagScene.tsx b/products/ai_observability/frontend/tags/AIObservabilityTagScene.tsxnew file mode 100644index 000000000000..d902aa9c1bdf--- /dev/null+++ b/products/ai_observability/frontend/tags/AIObservabilityTagScene.tsx@@ -0,0 +1,40 @@+import { useValues } from 'kea'++import { LemonBanner, LemonSkeleton } from '@posthog/lemon-ui'++import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { SceneExport } from 'scenes/sceneTypes'++import { SceneContent } from '~/layout/scenes/components/SceneContent'+import { ProductKey } from '~/queries/schema/schema-general'++import { AIObservabilityTag } from './AIObservabilityTag'++export const scene: SceneExport = {+ component: AIObservabilityTagScene,+ paramsToProps: ({ params }): { id: string } => ({ id: params.id || 'new' }),+ productKey: ProductKey.AI_OBSERVABILITY,+}++export function AIObservabilityTagScene({ id }: { id?: string }): JSX.Element {+ const { featureFlags, receivedFeatureFlags } = useValues(featureFlagLogic)++ if (!receivedFeatureFlags) {+ return (+ <SceneContent>+ <LemonSkeleton className="w-full h-96" />+ </SceneContent>+ )+ }++ if (!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_TAGS]) {+ return (+ <SceneContent>+ <LemonBanner type="warning">Taggers are not enabled for this project.</LemonBanner>+ </SceneContent>+ )+ }++ return <AIObservabilityTag id={id} />+}diff --git a/products/ai_observability/frontend/tags/AIObservabilityTagScenes.test.tsx b/products/ai_observability/frontend/tags/AIObservabilityTagScenes.test.tsxnew file mode 100644index 000000000000..98e40d0aa94f--- /dev/null+++ b/products/ai_observability/frontend/tags/AIObservabilityTagScenes.test.tsx@@ -0,0 +1,118 @@+import '@testing-library/jest-dom'++let uuidCounter = 0+Object.defineProperty(globalThis.crypto, 'randomUUID', {+ value: () => `mock-uuid-${uuidCounter++}`,+ configurable: true,+})++import { act, cleanup, render, screen, waitFor } from '@testing-library/react'+import { Provider } from 'kea'++import api from 'lib/api'+import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'++import { useMocks } from '~/mocks/jest'+import { initKeaTests } from '~/test/init'++import { scene as tagScene } from './AIObservabilityTagScene'+import { scene as tagsScene } from './AIObservabilityTagsScene'+import { llmTaggerLogic } from './llmTaggerLogic'+import { llmTaggersLogic } from './llmTaggersLogic'+import { Tagger } from './types'++const tagger: Tagger = {+ id: 'tagger-1',+ name: 'Test tagger',+ enabled: false,+ tagger_type: 'hog',+ tagger_config: { source: 'return []', tags: [] },+ conditions: [],+ model_configuration: null,+ created_at: '2024-01-01T00:00:00Z',+ updated_at: '2024-01-01T00:00:00Z',+}++describe('tagger scene access', () => {+ beforeEach(() => {+ uuidCounter = 0+ useMocks({+ get: {+ '/api/environments/:teamId/taggers/': { results: [] },+ '/api/environments/:teamId/taggers/:id/': tagger,+ '/api/environments/:teamId/llm_analytics/provider_keys/': { results: [] },+ '/api/environments/:teamId/llm_analytics/evaluation_config/': { active_provider_key: null },+ },+ post: {+ '/api/environments/:teamId/query/:kind': { results: [] },+ },+ })+ initKeaTests()+ })++ afterEach(() => {+ cleanup()+ jest.restoreAllMocks()+ })++ it.each([+ { name: 'list', scene: tagsScene, buildLogic: () => llmTaggersLogic(), loadedText: 'No taggers found.' },+ {+ name: 'detail',+ scene: tagScene,+ buildLogic: () => llmTaggerLogic({ id: tagger.id }),+ loadedText: tagger.name,+ },+ ])(+ 'loads the $name page only while the resolved feature flag is enabled',+ async ({ scene, buildLogic, loadedText }) => {+ const getSpy = jest.spyOn(api, 'get')+ const dataRequests = (): string[] =>+ getSpy.mock.calls+ .map(([url]) => url)+ .filter((url) => url.includes('/taggers/') || url.includes('/llm_analytics/provider_keys/'))+ const props = scene.paramsToProps?.({ params: { id: tagger.id }, searchParams: {}, hashParams: {} }) || {}+ // The router mounts SceneExport.logic before rendering the component.+ const unmountSceneLogic = scene.logic?.(props).mount()+ const Component = scene.component!+ const logic = buildLogic()++ try {+ render(+ <Provider>+ <Component {...props} />+ </Provider>+ )++ expect(logic.isMounted()).toBe(false)+ expect(dataRequests()).toEqual([])+ expect(screen.queryByText('Taggers are not enabled for this project.')).not.toBeInTheDocument()++ act(() => featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.LLM_ANALYTICS_TAGS]: false }))++ expect(screen.getByText('Taggers are not enabled for this project.')).toBeInTheDocument()+ expect(logic.isMounted()).toBe(false)+ expect(dataRequests()).toEqual([])++ act(() =>+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.LLM_ANALYTICS_TAGS], {+ [FEATURE_FLAGS.LLM_ANALYTICS_TAGS]: true,+ })+ )++ await screen.findByText(loadedText)+ await waitFor(() => expect(dataRequests().some((url) => url.includes('/taggers/'))).toBe(true))+ expect(logic.isMounted()).toBe(true)+ expect(screen.queryByText('Taggers are not enabled for this project.')).not.toBeInTheDocument()++ act(() => featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.LLM_ANALYTICS_TAGS]: false }))++ expect(screen.getByText('Taggers are not enabled for this project.')).toBeInTheDocument()+ expect(logic.isMounted()).toBe(false)+ } finally {+ unmountSceneLogic?.()+ }+ }+ )+})diff --git a/products/ai_observability/frontend/tags/AIObservabilityTagsScene.tsx b/products/ai_observability/frontend/tags/AIObservabilityTagsScene.tsxindex 12b09ae49f36..e128656e4991 100644--- a/products/ai_observability/frontend/tags/AIObservabilityTagsScene.tsx+++ b/products/ai_observability/frontend/tags/AIObservabilityTagsScene.tsx@@ -3,6 +3,7 @@ import { combineUrl, router } from 'kea-router'import { IconPencil, IconPlus, IconSearch, IconTrash, IconWarning } from '@posthog/icons'import {+ LemonBanner,LemonButton,LemonInput,LemonSkeleton,@@ -15,7 +16,9 @@ import {import { AccessControlAction } from 'lib/components/AccessControlAction'import { DateFilter } from 'lib/components/DateFilter/DateFilter'+import { FEATURE_FLAGS } from 'lib/constants'import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { deleteWithUndo } from 'lib/utils/deleteWithUndo'import { SceneExport } from 'scenes/sceneTypes'import { teamLogic } from 'scenes/teamLogic'@@ -34,7 +37,6 @@ import { Tagger } from './types'export const scene: SceneExport = {component: AIObservabilityTagsScene,- logic: llmTaggersLogic,productKey: ProductKey.AI_OBSERVABILITY,}@@ -315,6 +317,24 @@ function AIObservabilityTagsContent(): JSX.Element {export function AIObservabilityTagsScene(): JSX.Element {const { searchParams } = useValues(router)+ const { featureFlags, receivedFeatureFlags } = useValues(featureFlagLogic)++ if (!receivedFeatureFlags) {+ return (+ <SceneContent>+ <LemonSkeleton className="w-full h-96" />+ </SceneContent>+ )+ }++ if (!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_TAGS]) {+ return (+ <SceneContent>+ <LemonBanner type="warning">Taggers are not enabled for this project.</LemonBanner>+ </SceneContent>+ )+ }+return (<SceneContent><SceneTitleSectiondiff --git a/products/ai_observability/frontend/tags/llmTaggersLogic.test.ts b/products/ai_observability/frontend/tags/llmTaggersLogic.test.tsindex 36c96845aab7..9ff58270c273 100644--- a/products/ai_observability/frontend/tags/llmTaggersLogic.test.ts+++ b/products/ai_observability/frontend/tags/llmTaggersLogic.test.ts@@ -4,7 +4,6 @@ import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'import { llmTaggersLogic } from './llmTaggersLogic'-import { defaultTaggerTemplates } from './templates'import { Tagger, TaggerType } from './types'const makeTagger = (overrides: Partial<Tagger> & { id: string; name: string }): Tagger => ({@@ -97,28 +96,20 @@ describe('llmTaggersLogic', () => {})})- describe('seeding defaults', () => {- let createCalls: Record<string, unknown>[]+ describe('loading an empty tagger list', () => {+ let createCalls: numberbeforeEach(() => {- createCalls = []- let firstGet = true+ createCalls = 0useMocks({get: {...providerKeyMocks,- '/api/environments/:team_id/taggers/': () => {- if (firstGet) {- firstGet = false- return [200, { results: [] }]- }- return [200, { results: mockTaggers }]- },+ '/api/environments/:team_id/taggers/': { results: [] },},post: {- '/api/environments/:team_id/taggers/': async ({ request }) => {- const body = (await request.json()) as Record<string, any>- createCalls.push(body)- return [200, { id: `new-${createCalls.length}`, ...body }]+ '/api/environments/:team_id/taggers/': () => {+ createCalls+++ return [201, {}]},},})@@ -131,13 +122,13 @@ describe('llmTaggersLogic', () => {logic?.unmount()})- it('seeds default taggers when none exist and creates them disabled', async () => {- await expectLogic(logic).toDispatchActions(['loadTaggersSuccess'])+ it('does not create taggers when the list is empty', async () => {+ await expectLogic(logic).toDispatchActions(['loadTaggersSuccess']).toMatchValues({+ taggers: [],+ taggersLoading: false,+ })- expect(createCalls).toHaveLength(defaultTaggerTemplates.length)- for (const call of createCalls) {- expect(call).toMatchObject({ enabled: false })- }+ expect(createCalls).toBe(0)})})diff --git a/products/ai_observability/frontend/tags/llmTaggersLogic.ts b/products/ai_observability/frontend/tags/llmTaggersLogic.tsindex 927f008a80b4..4796f4fe56e4 100644--- a/products/ai_observability/frontend/tags/llmTaggersLogic.ts+++ b/products/ai_observability/frontend/tags/llmTaggersLogic.ts@@ -12,7 +12,6 @@ import type { FeatureFlagsSet } from '../../../../frontend/src/lib/logic/featureimport type { ProductIntentProperties } from '../../../../frontend/src/lib/utils/product-intents'import { aiObservabilitySharedLogic } from '../aiObservabilitySharedLogic'import { llmProviderKeysLogic } from '../settings/llmProviderKeysLogic'-import { defaultTaggerTemplates } from './templates'import { getIntervalFromDateRange, Tagger } from './types'export type LLMTaggersLogicProps = Record<string, never>@@ -40,7 +39,6 @@ export interface llmTaggersLogicValues {featureFlags: FeatureFlagsSet // featureFlagLogicchartQuery: TrendsQuery | nullfilteredTaggers: Tagger[]- hasSeededDefaults: booleanrunStats: TaggerRunStats[]runStatsLoading: booleanrunStatsMap: Record<string, number>@@ -200,12 +198,6 @@ export const llmTaggersLogic = kea<llmTaggersLogicType>([setTaggersFilter: (_, { filter }) => filter,},],- hasSeededDefaults: [- false,- {- loadTaggersSuccess: () => true,- },- ],}),loaders(({ values }) => ({@@ -387,23 +379,7 @@ export const llmTaggersLogic = kea<llmTaggersLogicType>([loadTaggers: async () => {// nosemgrep: prefer-codegen-apiconst response = await api.get('api/environments/@current/taggers/')- if (response.results.length === 0 && !values.hasSeededDefaults) {- for (const template of defaultTaggerTemplates) {- // nosemgrep: prefer-codegen-api- await api.create('api/environments/@current/taggers/', {- name: template.name,- description: template.description,- enabled: false,- tagger_config: template.tagger_config,- conditions: [{ id: `cond-${Date.now()}`, rollout_percentage: 100, properties: [] }],- })- }- // nosemgrep: prefer-codegen-api- const seeded = await api.get('api/environments/@current/taggers/')- actions.loadTaggersSuccess(seeded.results)- } else {- actions.loadTaggersSuccess(response.results)- }+ actions.loadTaggersSuccess(response.results)},loadTaggersSuccess: () => {actions.loadRunStats()diff --git a/products/ai_observability/frontend/tags/templates.ts b/products/ai_observability/frontend/tags/templates.tsdeleted file mode 100644index 5926c01c7549..000000000000--- a/products/ai_observability/frontend/tags/templates.ts+++ /dev/null@@ -1,106 +0,0 @@-import { TaggerConfig } from './types'--export interface TaggerTemplate {- key: string- name: string- description: string- icon: 'tag' | 'message-circle' | 'shield' | 'zap' | 'users'- tagger_config: TaggerConfig-}--export const defaultTaggerTemplates: readonly TaggerTemplate[] = [- {- key: 'topic',- name: 'Topic tags',- description: 'Tag each generation with the topics or subject areas it covers',- icon: 'tag',- tagger_config: {- prompt: 'Tag this AI generation with the topics or subject areas it covers. Select all that substantively apply.',- tags: [- { name: 'technical-support', description: 'Troubleshooting, debugging, or fixing technical issues' },- { name: 'how-to', description: 'Step-by-step instructions or tutorials' },- { name: 'general-knowledge', description: 'Factual questions or explanations about concepts' },- { name: 'creative', description: 'Creative writing, brainstorming, or ideation' },- { name: 'data-analysis', description: 'Working with data, charts, queries, or analytics' },- { name: 'code-generation', description: 'Writing or modifying code' },- ],- min_tags: 0,- max_tags: null,- },- },- {- key: 'intent',- name: 'User intent',- description: 'Tag what the user is trying to accomplish',- icon: 'message-circle',- tagger_config: {- prompt: "Tag the primary intent behind the user's message in this generation. What is the user trying to accomplish?",- tags: [- { name: 'question', description: 'Asking a question or seeking information' },- { name: 'task', description: 'Requesting the AI to perform a specific task' },- { name: 'conversation', description: 'Casual conversation or chat' },- { name: 'feedback', description: 'Providing feedback or corrections to the AI' },- { name: 'follow-up', description: 'Following up on a previous response or asking for clarification' },- ],- min_tags: 0,- max_tags: null,- },- },- {- key: 'safety',- name: 'Safety flags',- description: 'Flag generations that may contain sensitive or risky content',- icon: 'shield',- tagger_config: {- prompt: 'Review this AI generation and flag any safety concerns. Only select tags that clearly apply — most generations should have no flags.',- tags: [- {- name: 'pii',- description: 'Contains personally identifiable information (names, emails, addresses, etc.)',- },- { name: 'medical-advice', description: 'Provides specific medical or health advice' },- { name: 'financial-advice', description: 'Provides specific financial or investment advice' },- { name: 'legal-advice', description: 'Provides specific legal advice' },- { name: 'controversial', description: 'Discusses politically sensitive or controversial topics' },- ],- min_tags: 0,- max_tags: null,- },- },- {- key: 'complexity',- name: 'Response complexity',- description: 'Tag the complexity level of each AI response',- icon: 'zap',- tagger_config: {- prompt: "Assess the complexity of the AI's response. Select the single best-fitting complexity level.",- tags: [- { name: 'simple', description: 'Short, straightforward answer with no technical depth' },- { name: 'moderate', description: 'Detailed explanation requiring some domain knowledge' },- { name: 'complex', description: 'In-depth technical or analytical response with multiple parts' },- { name: 'expert', description: 'Highly specialized response requiring deep expertise' },- ],- min_tags: 0,- max_tags: null,- },- },- {- key: 'sentiment',- name: 'User sentiment',- description: 'Tag the emotional tone of the user in each conversation',- icon: 'users',- tagger_config: {- prompt: "Analyze the emotional tone of the user's messages (not the AI's response) in this generation. What sentiment is the user expressing?",- tags: [- { name: 'satisfied', description: 'User seems happy or satisfied with the interaction' },- { name: 'neutral', description: 'User shows no strong emotion' },- { name: 'frustrated', description: 'User seems frustrated, confused, or dissatisfied' },- { name: 'urgent', description: 'User seems to need help urgently or is under time pressure' },- ],- min_tags: 0,- max_tags: null,- },- },-] as const--export type TaggerTemplateKey = (typeof defaultTaggerTemplates)[number]['key']diff --git a/products/ai_observability/manifest.tsx b/products/ai_observability/manifest.tsxindex 189eeaaf27a5..db21b284c8a5 100644--- a/products/ai_observability/manifest.tsx+++ b/products/ai_observability/manifest.tsx@@ -100,7 +100,7 @@ export const manifest: ProductManifest = {docsHref: 'https://posthog.com/docs/ai-evals/taggers',},AIObservabilityTag: {- import: () => import('./frontend/tags/AIObservabilityTag'),+ import: () => import('./frontend/tags/AIObservabilityTagScene'),projectBased: true,name: 'Tagger',activityScope: 'AIObservability',