: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
refactor(llma): drive team discovery from flag payload, trim hardcoded allowlist (#66358)
Carlos Marchaldfa84a1ebfac
diff --git a/posthog/temporal/ai_observability/evaluation_clustering/coordinator.py b/posthog/temporal/ai_observability/evaluation_clustering/coordinator.pyindex 64e4f34fb73f..23b349fd1cae 100644--- a/posthog/temporal/ai_observability/evaluation_clustering/coordinator.py+++ b/posthog/temporal/ai_observability/evaluation_clustering/coordinator.py@@ -46,7 +46,6 @@ with temporalio.workflow.unsafe.imports_passed_through():DISCOVERY_ACTIVITY_RETRY_POLICY,DISCOVERY_ACTIVITY_TIMEOUT,GUARANTEED_TEAM_IDS,- SAMPLE_PERCENTAGE,TeamDiscoveryInput,get_team_ids_for_ai_observability,)@@ -94,7 +93,7 @@ async def _discover_teams_and_jobs() -> tuple[list[int], dict[int, list[JobConfitry:team_ids = await workflow.execute_activity(get_team_ids_for_ai_observability,- TeamDiscoveryInput(sample_percentage=SAMPLE_PERCENTAGE),+ TeamDiscoveryInput(),start_to_close_timeout=DISCOVERY_ACTIVITY_TIMEOUT,retry_policy=DISCOVERY_ACTIVITY_RETRY_POLICY,)diff --git a/posthog/temporal/ai_observability/team_discovery.py b/posthog/temporal/ai_observability/team_discovery.pyindex 65f6531e0fef..a905366f494f 100644--- a/posthog/temporal/ai_observability/team_discovery.py+++ b/posthog/temporal/ai_observability/team_discovery.py@@ -26,37 +26,23 @@ logger = structlog.get_logger(__name__)FEATURE_FLAG_KEY = "llm-analytics-clustering-workflows"-# Default fallbacks — used when the feature flag payload is missing or invalid.+# Dev/test floor — only used when the feature flag payload is missing or invalid,+# which in practice means local development or CI, where the posthoganalytics SDK+# has no flag definitions loaded and returns None. The live allowlist of dogfooding+# and customer teams lives in the `llm-analytics-clustering-workflows` flag payload,+# which is the single source of truth; keep this list to bootstrap teams only.DEFAULT_GUARANTEED_TEAM_IDS: list[int] = [1, # Local development2, # Internal PostHog project- # Dogfooding projects- 112495,- 148051,- 140227,- 237906,- 294356,- 21999,- # External dogfooders- 117964,- 153418,- 109521,- 287645,- 306898,- 39143,- 240730,]# Default sample percentage for gradual rollout.# 0.0 = only guaranteed teams, 0.5 = 50% of remaining, 1.0 = all teams with AI events.DEFAULT_SAMPLE_PERCENTAGE: float = 0.5DEFAULT_DISCOVERY_LOOKBACK_DAYS: int = 7-# Backward-compatible aliases for coordinator imports.-# Coordinators use these only in the last-resort fallback path (when the-# activity itself fails), so pointing at defaults is fine.+# Used by coordinators only in the last-resort fallback path (when the discovery+# activity itself fails), so pointing at the dev/test default is fine.GUARANTEED_TEAM_IDS = DEFAULT_GUARANTEED_TEAM_IDS-SAMPLE_PERCENTAGE = DEFAULT_SAMPLE_PERCENTAGE-DISCOVERY_LOOKBACK_DAYS = DEFAULT_DISCOVERY_LOOKBACK_DAYS@dataclasses.dataclass@@ -64,6 +50,7 @@ class AIObservabilityWorkflowConfig:guaranteed_team_ids: list[int]skip_team_ids: list[int]sample_percentage: float+ discovery_lookback_days: intdef _get_ai_observability_workflow_config() -> AIObservabilityWorkflowConfig:@@ -79,6 +66,7 @@ def _get_ai_observability_workflow_config() -> AIObservabilityWorkflowConfig:guaranteed_team_ids=DEFAULT_GUARANTEED_TEAM_IDS,skip_team_ids=[],sample_percentage=DEFAULT_SAMPLE_PERCENTAGE,+ discovery_lookback_days=DEFAULT_DISCOVERY_LOOKBACK_DAYS,)guaranteed = payload.get("guaranteed_team_ids", DEFAULT_GUARANTEED_TEAM_IDS)@@ -93,17 +81,23 @@ def _get_ai_observability_workflow_config() -> AIObservabilityWorkflowConfig:if not isinstance(sample_pct, (int, float)) or not (0.0 <= float(sample_pct) <= 1.0):sample_pct = DEFAULT_SAMPLE_PERCENTAGE+ lookback_days = payload.get("discovery_lookback_days", DEFAULT_DISCOVERY_LOOKBACK_DAYS)+ if not isinstance(lookback_days, int) or isinstance(lookback_days, bool) or lookback_days <= 0:+ lookback_days = DEFAULT_DISCOVERY_LOOKBACK_DAYS+logger.info("Loaded AI observability config from feature flag",guaranteed_count=len(guaranteed),skip_count=len(skip),sample_percentage=sample_pct,+ discovery_lookback_days=lookback_days,)return AIObservabilityWorkflowConfig(guaranteed_team_ids=guaranteed,skip_team_ids=skip,sample_percentage=float(sample_pct),+ discovery_lookback_days=lookback_days,)except Exception:logger.warning("Failed to read AI observability config from feature flag, using defaults", exc_info=True)@@ -111,9 +105,34 @@ def _get_ai_observability_workflow_config() -> AIObservabilityWorkflowConfig:guaranteed_team_ids=DEFAULT_GUARANTEED_TEAM_IDS,skip_team_ids=[],sample_percentage=DEFAULT_SAMPLE_PERCENTAGE,+ discovery_lookback_days=DEFAULT_DISCOVERY_LOOKBACK_DAYS,)+def get_min_traces_override(team_id: int) -> int | None:+ """Per-team override for the clustering minimum-item threshold, from the flag payload.++ Lets low-volume teams (e.g. staging projects) opt into clustering below the global+ minimum. Returns None when the team has no override, so callers keep the default.+ """+ try:+ payload: dict | None = posthoganalytics.get_feature_flag_payload( # type: ignore[assignment] # ty: ignore[invalid-assignment]+ FEATURE_FLAG_KEY, "internal_llma_team_discovery"+ )+ if not isinstance(payload, dict):+ return None+ overrides = payload.get("min_traces_overrides", {})+ if not isinstance(overrides, dict):+ return None+ override = overrides.get(str(team_id))+ if not isinstance(override, int) or isinstance(override, bool) or override <= 0:+ return None+ return override+ except Exception:+ logger.warning("Failed to read min_traces override from feature flag", exc_info=True)+ return None++# Activity timeout for team discovery. Must exceed the underlying ClickHouse# query's max_execution_time (5 min in CH_AI_OBSERVABILITY_SETTINGS) plus retry# overhead so the activity doesn't get killed before the fallback path runs.@@ -123,15 +142,17 @@ DISCOVERY_ACTIVITY_RETRY_POLICY = RetryPolicy(maximum_attempts=2)@dataclasses.dataclassclass TeamDiscoveryInput:- lookback_days: int = DEFAULT_DISCOVERY_LOOKBACK_DAYS- sample_percentage: float = DEFAULT_SAMPLE_PERCENTAGE+ # Empty: discovery config is read from the flag payload inside the activity.+ pass+# TODO: drop `inputs`/TeamDiscoveryInput next release; kept so pre-rollout activity tasks still deserialize.@temporalio.activity.defn(name="get_team_ids_for_llm_analytics")-async def get_team_ids_for_ai_observability(inputs: TeamDiscoveryInput) -> list[int]:+async def get_team_ids_for_ai_observability(inputs: TeamDiscoveryInput | None = None) -> list[int]:"""Discover teams for AI observability workflows.+ Config (guaranteed/skip/sample/lookback) is read from the feature flag payload.Returns guaranteed allowlist teams + a random sample of other teams with AI events.On failure, falls back to guaranteed teams only."""@@ -141,7 +162,7 @@ async def get_team_ids_for_ai_observability(inputs: TeamDiscoveryInput) -> list[skip = set(config.skip_team_ids)sample_percentage = config.sample_percentage- lookback_days = inputs.lookback_days+ lookback_days = config.discovery_lookback_daystry:end = datetime.now(UTC)diff --git a/posthog/temporal/ai_observability/test_team_discovery.py b/posthog/temporal/ai_observability/test_team_discovery.pyindex 110462f227e8..da9a2f3f0fbe 100644--- a/posthog/temporal/ai_observability/test_team_discovery.py+++ b/posthog/temporal/ai_observability/test_team_discovery.py@@ -7,10 +7,12 @@ from unittest.mock import patchfrom parameterized import parameterizedfrom posthog.temporal.ai_observability.team_discovery import (+ DEFAULT_DISCOVERY_LOOKBACK_DAYS,DEFAULT_GUARANTEED_TEAM_IDS,DEFAULT_SAMPLE_PERCENTAGE,TeamDiscoveryInput,_get_ai_observability_workflow_config,+ get_min_traces_override,get_team_ids_for_ai_observability,)@@ -41,6 +43,7 @@ class TestGetLlmaWorkflowConfig:assert config.guaranteed_team_ids == DEFAULT_GUARANTEED_TEAM_IDSassert config.skip_team_ids == []assert config.sample_percentage == DEFAULT_SAMPLE_PERCENTAGE+ assert config.discovery_lookback_days == DEFAULT_DISCOVERY_LOOKBACK_DAYS@patch(FF_PAYLOAD_PATH)def test_valid_payload(self, mock_ff):@@ -48,6 +51,7 @@ class TestGetLlmaWorkflowConfig:"guaranteed_team_ids": [100, 200],"skip_team_ids": [300, 400],"sample_percentage": 0.5,+ "discovery_lookback_days": 14,}config = _get_ai_observability_workflow_config()@@ -55,6 +59,7 @@ class TestGetLlmaWorkflowConfig:assert config.guaranteed_team_ids == [100, 200]assert config.skip_team_ids == [300, 400]assert config.sample_percentage == 0.5+ assert config.discovery_lookback_days == 14@patch(FF_PAYLOAD_PATH)def test_partial_payload_fills_missing_with_defaults(self, mock_ff):@@ -65,6 +70,7 @@ class TestGetLlmaWorkflowConfig:assert config.guaranteed_team_ids == [42]assert config.skip_team_ids == []assert config.sample_percentage == DEFAULT_SAMPLE_PERCENTAGE+ assert config.discovery_lookback_days == DEFAULT_DISCOVERY_LOOKBACK_DAYS@parameterized.expand([@@ -77,6 +83,11 @@ class TestGetLlmaWorkflowConfig:("pct_above_one", {"sample_percentage": 1.5}, "sample_percentage"),("nan_pct", {"sample_percentage": float("nan")}, "sample_percentage"),("inf_pct", {"sample_percentage": float("inf")}, "sample_percentage"),+ ("string_lookback", {"discovery_lookback_days": "30"}, "discovery_lookback_days"),+ ("float_lookback", {"discovery_lookback_days": 3.5}, "discovery_lookback_days"),+ ("zero_lookback", {"discovery_lookback_days": 0}, "discovery_lookback_days"),+ ("negative_lookback", {"discovery_lookback_days": -5}, "discovery_lookback_days"),+ ("bool_lookback", {"discovery_lookback_days": True}, "discovery_lookback_days"),])@patch(FF_PAYLOAD_PATH)@@ -91,6 +102,8 @@ class TestGetLlmaWorkflowConfig:assert config.skip_team_ids == []if bad_field == "sample_percentage":assert config.sample_percentage == DEFAULT_SAMPLE_PERCENTAGE+ if bad_field == "discovery_lookback_days":+ assert config.discovery_lookback_days == DEFAULT_DISCOVERY_LOOKBACK_DAYS@patch(FF_PAYLOAD_PATH)def test_exception_returns_defaults(self, mock_ff):@@ -112,6 +125,34 @@ class TestGetLlmaWorkflowConfig:assert isinstance(config.sample_percentage, float)+class TestGetMinTracesOverride:+ @parameterized.expand(+ [+ ("no_payload", None, None),+ ("non_dict_payload", "nope", None),+ ("no_overrides_key", {"guaranteed_team_ids": [1]}, None),+ ("overrides_not_dict", {"min_traces_overrides": [1, 2]}, None),+ ("team_present", {"min_traces_overrides": {"370629": 20}}, 20),+ ("team_absent", {"min_traces_overrides": {"111": 20}}, None),+ ("zero_value", {"min_traces_overrides": {"370629": 0}}, None),+ ("negative_value", {"min_traces_overrides": {"370629": -5}}, None),+ ("bool_value", {"min_traces_overrides": {"370629": True}}, None),+ ("string_value", {"min_traces_overrides": {"370629": "20"}}, None),+ ]+ )+ @patch(FF_PAYLOAD_PATH)+ def test_override_resolution(self, _name, payload, expected, mock_ff):+ mock_ff.return_value = payload++ assert get_min_traces_override(370629) == expected++ @patch(FF_PAYLOAD_PATH)+ def test_exception_returns_none(self, mock_ff):+ mock_ff.side_effect = Exception("network error")++ assert get_min_traces_override(370629) is None++@patch(FF_PAYLOAD_PATH, return_value=None)@patch("posthog.temporal.ai_observability.team_discovery.Heartbeater", _noop_heartbeater)@pytest.mark.asyncio@@ -286,16 +327,14 @@ class TestGetTeamIdsForAIObservability:assert set(passed_trigger_events) < set(AI_OBSERVABILITY_REPORT_TRIGGER_EVENTS)@patch("posthog.tasks.ai_observability_usage_report.get_teams_with_ai_events")- async def test_lookback_uses_inputs_value(self, mock_get_teams, _mock_ff):- """The discovery activity scopes its eligibility query to the caller's- TeamDiscoveryInput.lookback_days (passed by the coordinator from the- downstream workflow's own lookback) so discovery matches what the- workflow will actually analyze.+ async def test_lookback_uses_ff_payload_value(self, mock_get_teams, mock_ff):+ """The discovery activity scopes its eligibility query to the+ discovery_lookback_days from the feature flag payload."""+ mock_ff.return_value = {"discovery_lookback_days": 3}mock_get_teams.return_value = []- inputs = TeamDiscoveryInput(lookback_days=3)- await get_team_ids_for_ai_observability(inputs)+ await get_team_ids_for_ai_observability(TeamDiscoveryInput())begin, end = mock_get_teams.call_args.args[0], mock_get_teams.call_args.args[1]delta_days = (end - begin).total_seconds() / 86400diff --git a/posthog/temporal/ai_observability/trace_clustering/README.md b/posthog/temporal/ai_observability/trace_clustering/README.mdindex af775122e11f..f56df9f351e0 100644--- a/posthog/temporal/ai_observability/trace_clustering/README.md+++ b/posthog/temporal/ai_observability/trace_clustering/README.md@@ -320,40 +320,46 @@ The coordinator workflow (`llma-trace-clustering-coordinator`) runs on a schedul2. Spawns clustering workflow for each team in parallel3. Handles failures gracefully (individual team failures don't affect others)-Team discovery is configured in `team_discovery.py`:+Team discovery is configured at runtime from the `llm-analytics-clustering-workflows`+feature flag payload (distinct ID `internal_llma_team_discovery`), so it can change+without a deploy. The payload carries:-- `GUARANTEED_TEAM_IDS` — always included (development, internal, dogfooding teams)-- `SAMPLE_PERCENTAGE` — fraction of remaining teams to sample (default 10%)-- `DISCOVERY_LOOKBACK_DAYS` — how far back to look for AI events (default 30 days)+- `guaranteed_team_ids` — teams always included (dogfooding and customer teams). This+ is the source of truth for the allowlist.+- `skip_team_ids` — teams always excluded, even if guaranteed or sampled.+- `sample_percentage` — fraction of remaining teams (with AI events) to sample.-If discovery fails, the coordinator falls back to guaranteed teams only.+`team_discovery.py` holds only the dev/test fallbacks (`DEFAULT_GUARANTEED_TEAM_IDS`,+`DEFAULT_SAMPLE_PERCENTAGE`), used when the flag payload is missing or invalid — i.e.+local development and CI. If discovery fails entirely, the coordinator falls back to+those guaranteed teams only.## ConfigurationKey constants in `constants.py`:-| Constant | Default | Description |-| ----------------------------------- | --------------------------------- | --------------------------------------------- |-| `WORKFLOW_NAME` | llma-trace-clustering | Temporal workflow name |-| `COORDINATOR_WORKFLOW_NAME` | llma-trace-clustering-coordinator | Temporal coordinator workflow name |-| `DEFAULT_LOOKBACK_DAYS` | 7 | Days of trace history to analyze |-| `DEFAULT_MAX_SAMPLES` | 1500 | Maximum traces to sample |-| `MIN_TRACES_FOR_CLUSTERING` | 1000 | Minimum items per level required for workflow |-| `COMPUTE_ACTIVITY_TIMEOUT` | 120s | Clustering compute timeout |-| `EMIT_ACTIVITY_TIMEOUT` | 60s | Event emission timeout |-| `LABELING_AGENT_MODEL` | gpt-5.4 | OpenAI model for labeling agent |-| `LABELING_AGENT_MAX_ITERATIONS` | 50 | Max agent iterations before finalization |-| `LABELING_AGENT_RECURSION_LIMIT` | 150 | LangGraph recursion limit |-| `LABELING_AGENT_TIMEOUT` | 600.0 | Full agent run timeout (seconds) |-| `DEFAULT_HDBSCAN_MIN_SAMPLES` | 5 | Min samples for HDBSCAN core points |-| `DEFAULT_MIN_CLUSTER_SIZE_FRACTION` | 0.02 | Min cluster size as fraction of total samples |-| `DEFAULT_UMAP_N_COMPONENTS` | 100 | UMAP dimensions for clustering |-| `DEFAULT_UMAP_N_NEIGHBORS` | 15 | UMAP neighborhood size |-| `DEFAULT_UMAP_MIN_DIST` | 0.0 | UMAP min distance (tighter for clustering) |-| `NOISE_CLUSTER_ID` | -1 | HDBSCAN noise/outlier cluster ID |-| `LLMA_TRACE_DOCUMENT_TYPE` | llm-trace-summary-detailed | Document type filter for embeddings |-| `GUARANTEED_TEAM_IDS` | [1, 2, 112495, ...] | Teams always included (in team_discovery.py) |-| `SAMPLE_PERCENTAGE` | 0.1 | Fraction of discovered teams to sample |+| Constant | Default | Description |+| ----------------------------------- | --------------------------------- | -------------------------------------------------------------------- |+| `WORKFLOW_NAME` | llma-trace-clustering | Temporal workflow name |+| `COORDINATOR_WORKFLOW_NAME` | llma-trace-clustering-coordinator | Temporal coordinator workflow name |+| `DEFAULT_LOOKBACK_DAYS` | 7 | Days of trace history to analyze |+| `DEFAULT_MAX_SAMPLES` | 1500 | Maximum traces to sample |+| `MIN_TRACES_FOR_CLUSTERING` | 1000 | Minimum items per level required for workflow |+| `COMPUTE_ACTIVITY_TIMEOUT` | 120s | Clustering compute timeout |+| `EMIT_ACTIVITY_TIMEOUT` | 60s | Event emission timeout |+| `LABELING_AGENT_MODEL` | gpt-5.4 | OpenAI model for labeling agent |+| `LABELING_AGENT_MAX_ITERATIONS` | 50 | Max agent iterations before finalization |+| `LABELING_AGENT_RECURSION_LIMIT` | 150 | LangGraph recursion limit |+| `LABELING_AGENT_TIMEOUT` | 600.0 | Full agent run timeout (seconds) |+| `DEFAULT_HDBSCAN_MIN_SAMPLES` | 5 | Min samples for HDBSCAN core points |+| `DEFAULT_MIN_CLUSTER_SIZE_FRACTION` | 0.02 | Min cluster size as fraction of total samples |+| `DEFAULT_UMAP_N_COMPONENTS` | 100 | UMAP dimensions for clustering |+| `DEFAULT_UMAP_N_NEIGHBORS` | 15 | UMAP neighborhood size |+| `DEFAULT_UMAP_MIN_DIST` | 0.0 | UMAP min distance (tighter for clustering) |+| `NOISE_CLUSTER_ID` | -1 | HDBSCAN noise/outlier cluster ID |+| `LLMA_TRACE_DOCUMENT_TYPE` | llm-trace-summary-detailed | Document type filter for embeddings |+| `DEFAULT_GUARANTEED_TEAM_IDS` | [1, 2] | Dev/test fallback only; live list is in the flag payload (see above) |+| `DEFAULT_SAMPLE_PERCENTAGE` | 0.5 | Sample fraction fallback; live value is in the flag payload |## Processing Flowdiff --git a/posthog/temporal/ai_observability/trace_clustering/activities.py b/posthog/temporal/ai_observability/trace_clustering/activities.pyindex 0b42657d8386..054cda8df48d 100644--- a/posthog/temporal/ai_observability/trace_clustering/activities.py+++ b/posthog/temporal/ai_observability/trace_clustering/activities.py@@ -16,6 +16,7 @@ import structlogfrom temporalio import activityfrom posthog.models.team import Team+from posthog.temporal.ai_observability.team_discovery import get_min_traces_overridefrom posthog.temporal.ai_observability.trace_clustering import constantsfrom posthog.temporal.ai_observability.trace_clustering.clustering import (calculate_distances_to_cluster_means,@@ -86,11 +87,14 @@ def _perform_clustering_compute(inputs: ClusteringActivityInputs) -> ClusteringCanalysis_level=inputs.analysis_level,)- # Need enough items for UMAP (n_neighbors default=15) and meaningful clusters- if len(item_ids) < constants.MIN_TRACES_FOR_CLUSTERING:+ # Need enough items for UMAP (n_neighbors default=15) and meaningful clusters.+ # A per-team override lets low-volume teams opt below the global minimum.+ min_traces = get_min_traces_override(inputs.team_id) or constants.MIN_TRACES_FOR_CLUSTERING+ if len(item_ids) < min_traces:logger.warning("Not enough items for clustering",item_count=len(item_ids),+ min_required=min_traces,team_id=inputs.team_id,analysis_level=inputs.analysis_level,)diff --git a/posthog/temporal/ai_observability/trace_clustering/coordinator.py b/posthog/temporal/ai_observability/trace_clustering/coordinator.pyindex 29e3f49d8887..9d2fb30bb575 100644--- a/posthog/temporal/ai_observability/trace_clustering/coordinator.py+++ b/posthog/temporal/ai_observability/trace_clustering/coordinator.py@@ -52,7 +52,6 @@ with temporalio.workflow.unsafe.imports_passed_through():DISCOVERY_ACTIVITY_RETRY_POLICY,DISCOVERY_ACTIVITY_TIMEOUT,GUARANTEED_TEAM_IDS,- SAMPLE_PERCENTAGE,TeamDiscoveryInput,get_team_ids_for_ai_observability,)@@ -146,10 +145,7 @@ class TraceClusteringCoordinatorWorkflow(PostHogWorkflow):try:team_ids = await temporalio.workflow.execute_activity(get_team_ids_for_ai_observability,- TeamDiscoveryInput(- sample_percentage=SAMPLE_PERCENTAGE,- lookback_days=inputs.lookback_days,- ),+ TeamDiscoveryInput(),start_to_close_timeout=DISCOVERY_ACTIVITY_TIMEOUT,retry_policy=DISCOVERY_ACTIVITY_RETRY_POLICY,)diff --git a/posthog/temporal/ai_observability/trace_summarization/coordinator.py b/posthog/temporal/ai_observability/trace_summarization/coordinator.pyindex 6852201b0454..703ea20ab74f 100644--- a/posthog/temporal/ai_observability/trace_summarization/coordinator.py+++ b/posthog/temporal/ai_observability/trace_summarization/coordinator.py@@ -65,7 +65,6 @@ with temporalio.workflow.unsafe.imports_passed_through():DISCOVERY_ACTIVITY_RETRY_POLICY,DISCOVERY_ACTIVITY_TIMEOUT,GUARANTEED_TEAM_IDS,- SAMPLE_PERCENTAGE,TeamDiscoveryInput,get_team_ids_for_ai_observability,)@@ -160,7 +159,7 @@ class BatchTraceSummarizationCoordinatorWorkflow(PostHogWorkflow):try:team_ids = await temporalio.workflow.execute_activity(get_team_ids_for_ai_observability,- TeamDiscoveryInput(sample_percentage=SAMPLE_PERCENTAGE),+ TeamDiscoveryInput(),start_to_close_timeout=DISCOVERY_ACTIVITY_TIMEOUT,retry_policy=DISCOVERY_ACTIVITY_RETRY_POLICY,)