Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(signals): tag scouts and filter the fleet by tag (#77817)

Radu Raiceaa8c563964d73
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 5e1c2bd18353..61257246d612 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7466,6 +7466,10 @@ snapshots:
hash: v1.k794b7964.4985b07e9f0062954fa68380bc57ba975141f437e96ac938c8025540aae5d92b.Pae87mHyCuaDYoeU92NuOV9zJx0hqar1R0vunkOZUN0
scenes-app-web-analytics-achievements--weekly-only-arm--light:
hash: v1.k794b7964.eb042d165752cd9ff0145ee3b49f0769671244ca00e931c8ece93ec0d01a9a6f.YlQzVwE6qBKZs4cKyA1-lYowaxlhGEGt_K4jt076OSE
+ scenes-inbox-scout-tags--editor-and-filter--dark:
+ hash: v1.k794b7964.a6c6018c279d1c7b6dc6cfe7ade21997d71bc5a3f970a76ca68f4bd374b1def6.wiY4XKEvSpFFtmciViAMFvc_yZLC5SeA5L6TmAYaNqQ
+ scenes-inbox-scout-tags--editor-and-filter--light:
+ hash: v1.k794b7964.6bb5712bac81268d6d2ca1fbc4b1583d1314cbf80ee574c1f7900f9dc546a6a7.6xHwc2B6VA6cqOdko_N3mpWURaTG7p4hPrv68Zq-Qj0
scenes-other-account-connected--github-integration-connected--dark:
hash: v1.k794b7964.fcae9b65af8160ba40bf82664dd9b5a6b9f5a1ddbdedee05bf15ec453eb7aa64.3616s9KNJancKVe-j4dQsJdo3W1CVcwWxRMA24QgU6Q
scenes-other-account-connected--github-integration-connected--light:
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx
index 8a01c0fb271e..38c5f6c2cba3 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutBadges.tsx
@@ -85,3 +85,11 @@ export function ScoutOriginBadge({ origin }: { origin: ScoutOriginEnumApi }): JS
</Tooltip>
)
}
+
+export function ScoutTagBadge({ tag }: { tag: string }): JSX.Element {
+ return (
+ <LemonTag type="highlight" size="small">
+ {tag}
+ </LemonTag>
+ )
+}
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsx
index 53b3867c3b83..0581ee2067a6 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.test.tsx
@@ -25,6 +25,7 @@ const config: SignalScoutConfigApi = {
status_changed_at: null,
auto_pause_exempt: false,
network_access: 'trusted',
+ tags: [],
created_at: '2026-07-21T12:00:00Z',
}
@@ -68,4 +69,18 @@ describe('ScoutConfigForm', () => {
expect(getByText('Custom (0 9 * * 1-5)')).toBeTruthy()
unmount()
})
+
+ it('adds normalized tags as a full replacement set', () => {
+ const onUpdate = jest.fn()
+ const { getByLabelText, unmount } = render(
+ <ScoutConfigForm config={{ ...config, tags: ['on-call'] }} onUpdate={onUpdate} />
+ )
+ const input = getByLabelText(`${config.skill_name} tags`)
+
+ fireEvent.change(input, { target: { value: 'Revenue' } })
+ fireEvent.keyDown(input, { key: 'Enter' })
+
+ expect(onUpdate).toHaveBeenCalledWith('config-1', { tags: ['on-call', 'revenue'] })
+ unmount()
+ })
})
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx
index c31fb515cb42..276e67a7a2ad 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutConfigControls.tsx
@@ -22,6 +22,7 @@ import {
timeToDailyCron,
} from '../../../utils/scoutRunsWindow'
import { ScoutSlackDestination } from './ScoutSlackDestination'
+import { ScoutTagsEditor } from './ScoutTagsEditor'
interface ScoutConfigControlsProps {
config: SignalScoutConfig
@@ -179,6 +180,13 @@ export function ScoutConfigForm({
aria-label={`${config.skill_name} opt out of auto-pause`}
/>
</div>
+ <div className="flex flex-col gap-1">
+ <div className="flex flex-col min-w-0">
+ <span className="text-xs text-default">Tags</span>
+ <span className="text-[11.5px] text-muted">Use tags to group scouts and filter the list.</span>
+ </div>
+ <ScoutTagsEditor config={config} onUpdate={onUpdate} updating={updating} />
+ </div>
<ScoutSlackDestination
destination={config.output_destinations?.slack}
onChange={(outputDestinations) => onUpdate(config.id, { output_destinations: outputDestinations })}
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutCreateModal.test.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutCreateModal.test.tsx
index 8e994ee82583..27637e008596 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutCreateModal.test.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutCreateModal.test.tsx
@@ -17,7 +17,7 @@ describe('ScoutCreateModal', () => {
afterEach(cleanup)
- it('includes a Slack destination in the create form', async () => {
+ it('includes tags and a Slack destination in the create form', async () => {
const { findByText } = render(
<ScoutCreateModal
isOpen
@@ -32,5 +32,6 @@ describe('ScoutCreateModal', () => {
expect(await findByText('Slack destination')).toBeTruthy()
expect(await findByText('Connect a Slack workspace')).toBeTruthy()
+ expect(await findByText('Tags')).toBeTruthy()
})
})
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutCreateModal.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutCreateModal.tsx
index 6bd6c33712b7..0db26ae98709 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutCreateModal.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutCreateModal.tsx
@@ -2,7 +2,15 @@ import { useActions, useValues } from 'kea'
import { Form } from 'kea-forms'
import { useId } from 'react'
-import { LemonButton, LemonInput, LemonModal, LemonSelect, LemonSwitch, LemonTextArea } from '@posthog/lemon-ui'
+import {
+ LemonButton,
+ LemonInput,
+ LemonInputSelect,
+ LemonModal,
+ LemonSelect,
+ LemonSwitch,
+ LemonTextArea,
+} from '@posthog/lemon-ui'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { teamLogic } from 'scenes/teamLogic'
@@ -21,6 +29,7 @@ import {
SCOUT_DAILY_AT_SCHEDULE_MODE,
SIGNALS_SCOUT_SKILL_PREFIX,
} from '../../../utils/scoutRunsWindow'
+import { MAX_SCOUT_TAGS, normalizeScoutTags } from '../../../utils/scoutTags'
import { ScoutSlackDestination } from './ScoutSlackDestination'
export interface ScoutCreateModalProps {
@@ -49,12 +58,16 @@ export function ScoutCreateModal({ isOpen, onClose, initialValues, onCreated }:
onClose()
}
+ const tagsValidationError = scoutCreateFormValidationErrors.config?.tags?.find(
+ (error): error is string => typeof error === 'string'
+ )
const firstError = [
scoutCreateFormValidationErrors.name,
scoutCreateFormValidationErrors.description,
scoutCreateFormValidationErrors.body,
scoutCreateFormValidationErrors.dailyTime,
scoutCreateFormValidationErrors.config?.run_interval_minutes,
+ tagsValidationError,
].find((error): error is string => typeof error === 'string')
return (
@@ -126,6 +139,30 @@ export function ScoutCreateModal({ isOpen, onClose, initialValues, onCreated }:
/>
</LemonField>
+ <LemonField
+ name="config.tags"
+ label="Tags"
+ help={`Add up to ${MAX_SCOUT_TAGS} tags to group scouts in the fleet.`}
+ >
+ {({ value, onChange }) => (
+ <div className="flex flex-col gap-2">
+ <LemonInputSelect
+ mode="multiple"
+ allowCustomValues
+ limit={MAX_SCOUT_TAGS}
+ value={value}
+ onChange={(tags) => onChange(normalizeScoutTags(tags))}
+ placeholder="Add tag"
+ fullWidth
+ status={tagsValidationError ? 'danger' : 'default'}
+ disabledReason={isScoutCreateFormSubmitting ? 'Creating the scout' : undefined}
+ data-attr="scout-create-tags"
+ />
+ {tagsValidationError ? <LemonField.Error error={tagsValidationError} /> : null}
+ </div>
+ )}
+ </LemonField>
+
<LemonField name="body" label="Instructions" help="This markdown prompt is executed on every run.">
<LemonTextArea
minRows={8}
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
index b850e4365263..8dfb91cfe44d 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutRowCard.tsx
@@ -20,8 +20,9 @@ import {
prettifyScoutSkillName,
ScoutRollup,
} from '../../../utils/scoutRunsWindow'
+import { scoutTags } from '../../../utils/scoutTags'
import { agentSetupModalLogic } from '../../shell/agentSetupModalLogic'
-import { ScoutLifecycleBadge, ScoutOriginBadge } from './ScoutBadges'
+import { ScoutLifecycleBadge, ScoutOriginBadge, ScoutTagBadge } from './ScoutBadges'
import { ScoutConfigForm, ScoutEnabledSwitch } from './ScoutConfigControls'
import { ScoutRunBoxes } from './ScoutRunBoxes'
@@ -132,7 +133,7 @@ export function ScoutRowCard({
<ScoutLifecycleBadge config={config} />
</div>
</div>
- <div className="flex items-center gap-1 whitespace-nowrap text-[11px] text-muted">
+ <div className="flex flex-wrap items-center gap-1 text-[11px] text-muted">
{/* A cron schedule overrides the rolling interval, so the badge shows it instead. */}
<span>
{config.run_cron_schedule
@@ -144,6 +145,9 @@ export function ScoutRowCard({
{rollup && rollup.emittedCount > 0 ? (
<span>· {pluralize(rollup.emittedCount, 'signal')} emitted</span>
) : null}
+ {scoutTags(config).map((tag) => (
+ <ScoutTagBadge key={tag} tag={tag} />
+ ))}
</div>
</div>
{/* The sparkline is the flexible region: it shrinks and clips the oldest runs
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutTags.stories.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutTags.stories.tsx
new file mode 100644
index 000000000000..e2ae52450c3f
--- /dev/null
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutTags.stories.tsx
@@ -0,0 +1,93 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import { useState } from 'react'
+
+import type {
+ PatchedSignalScoutConfigUpdateApi,
+ SignalScoutConfigApi,
+} from 'products/signals/frontend/generated/api.schemas'
+
+import { ScoutTagBadge } from './ScoutBadges'
+import { ScoutTagsEditor } from './ScoutTagsEditor'
+import { ScoutTagsFilter } from './ScoutTagsFilter'
+
+const config: SignalScoutConfigApi = {
+ id: 'config-1',
+ skill_name: 'signals-scout-revenue-watch',
+ description: 'Watches revenue changes.',
+ scout_origin: 'custom',
+ enabled: true,
+ status: 'active',
+ pause_reason: null,
+ emit: true,
+ run_interval_minutes: 1440,
+ run_cron_schedule: null,
+ output_destinations: {},
+ structured_output_schema: null,
+ network_access: 'trusted',
+ last_run_at: null,
+ consecutive_failure_count: 0,
+ status_changed_at: null,
+ auto_pause_exempt: false,
+ tags: ['on-call', 'revenue'],
+ created_at: '2026-08-05T00:00:00Z',
+}
+
+function ScoutTagsPreview(): JSX.Element {
+ const [tags, setTags] = useState(config.tags ?? [])
+ const [selected, setSelected] = useState<string[]>(['revenue'])
+ const updateConfig = (_configId: string, updates: PatchedSignalScoutConfigUpdateApi): void => {
+ if (updates.tags) {
+ setTags(updates.tags)
+ }
+ }
+ const options = [
+ { tag: 'revenue', count: 4 },
+ { tag: 'on-call', count: 2 },
+ { tag: 'security', count: 1 },
+ ]
+
+ return (
+ <div className="flex w-[32rem] flex-col gap-6 rounded border border-primary bg-bg-light p-4">
+ <div className="flex flex-col gap-2">
+ <span className="text-xs font-medium text-default">Scout badges</span>
+ <div className="flex flex-wrap gap-1">
+ {tags.map((tag) => (
+ <ScoutTagBadge key={tag} tag={tag} />
+ ))}
+ </div>
+ </div>
+ <div className="flex flex-col gap-2">
+ <span className="text-xs font-medium text-default">Tags</span>
+ <ScoutTagsEditor config={{ ...config, tags }} onUpdate={updateConfig} />
+ </div>
+ <div className="flex items-center gap-2">
+ <span className="text-xs text-muted">Tagged</span>
+ <ScoutTagsFilter
+ options={options}
+ selected={selected}
+ onToggle={(tag) =>
+ setSelected(
+ selected.includes(tag)
+ ? selected.filter((candidate) => candidate !== tag)
+ : [...selected, tag]
+ )
+ }
+ onClear={() => setSelected([])}
+ />
+ </div>
+ </div>
+ )
+}
+
+const meta: Meta = {
+ title: 'Scenes-Inbox/Scout tags',
+ parameters: { layout: 'centered' },
+}
+
+export default meta
+
+type Story = StoryObj
+
+export const EditorAndFilter: Story = {
+ render: () => <ScoutTagsPreview />,
+}
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutTagsEditor.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutTagsEditor.tsx
new file mode 100644
index 000000000000..d48366fe69bd
--- /dev/null
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutTagsEditor.tsx
@@ -0,0 +1,112 @@
+import { useState } from 'react'
+
+import { LemonInput, LemonTag } from '@posthog/lemon-ui'
+
+import type {
+ PatchedSignalScoutConfigUpdateApi as SignalScoutConfigUpdate,
+ SignalScoutConfigApi as SignalScoutConfig,
+} from 'products/signals/frontend/generated/api.schemas'
+
+import {
+ MAX_SCOUT_TAG_LENGTH,
+ MAX_SCOUT_TAGS,
+ parseScoutTagsInput,
+ scoutTags,
+ withScoutTagRemoved,
+ withScoutTagsAdded,
+} from '../../../utils/scoutTags'
+
+export function ScoutTagsEditor({
+ config,
+ onUpdate,
+ updating = false,
+}: {
+ config: SignalScoutConfig
+ onUpdate: (configId: string, updates: SignalScoutConfigUpdate) => void
+ updating?: boolean
+}): JSX.Element {
+ const [draft, setDraft] = useState('')
+ const [error, setError] = useState<string | null>(null)
+ const tags = scoutTags(config)
+ const atCap = tags.length >= MAX_SCOUT_TAGS
+
+ const commitDraft = (): void => {
+ const parsed = parseScoutTagsInput(draft)
+ if (parsed.tooLong.length > 0) {
+ setError(`Tags can be up to ${MAX_SCOUT_TAG_LENGTH} characters.`)
+ return
+ }
+ const added = withScoutTagsAdded(tags, parsed.tags)
+ if (added.overCap) {
+ setError(`A scout can have up to ${MAX_SCOUT_TAGS} tags.`)
+ return
+ }
+ setError(null)
+ setDraft('')
+ if (added.tags) {
+ onUpdate(config.id, { tags: added.tags })
+ }
+ }
+
+ const removeTag = (tag: string): void => {
+ if (updating) {
+ return
+ }
+ const nextTags = withScoutTagRemoved(tags, tag)
+ if (nextTags) {
+ onUpdate(config.id, { tags: nextTags })
+ }
+ }
+
+ return (
+ <div className="flex flex-col gap-1">
+ <div className="flex flex-wrap items-center gap-1">
+ {tags.map((tag) => (
+ <LemonTag
+ key={tag}
+ type="highlight"
+ size="small"
+ closable={!updating}
+ onClose={() => removeTag(tag)}
+ >
+ {tag}
+ </LemonTag>
+ ))}
+ <LemonInput
+ value={draft}
+ onChange={(value) => {
+ setDraft(value)
+ setError(null)
+ }}
+ onBlur={commitDraft}
+ onKeyDown={(event) => {
+ if (event.key === 'Enter' || event.key === ',') {
+ event.preventDefault()
+ commitDraft()
+ } else if (event.key === 'Backspace' && draft === '' && tags.length > 0) {
+ event.preventDefault()
+ removeTag(tags[tags.length - 1])
+ }
+ }}
+ size="xsmall"
+ placeholder={atCap ? `${MAX_SCOUT_TAGS} tag limit` : 'Add tag'}
+ aria-label={`${config.skill_name} tags`}
+ disabledReason={
+ updating
+ ? 'Saving scout settings'
+ : atCap
+ ? `A scout can have up to ${MAX_SCOUT_TAGS} tags`
+ : undefined
+ }
+ status={error ? 'danger' : 'default'}
+ className="w-40"
+ />
+ </div>
+ {error ? (
+ <span role="alert" className="text-xs text-danger">
+ {error}
+ </span>
+ ) : null}
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutTagsFilter.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutTagsFilter.tsx
new file mode 100644
index 000000000000..df7672f368eb
--- /dev/null
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutTagsFilter.tsx
@@ -0,0 +1,52 @@
+import { IconChevronDown } from '@posthog/icons'
+import { LemonButton, LemonCheckbox, LemonMenu, LemonMenuItems } from '@posthog/lemon-ui'
+
+import type { ScoutTagOption } from '../../../utils/scoutTags'
+
+export function ScoutTagsFilter({
+ options,
+ selected,
+ onToggle,
+ onClear,
+}: {
+ options: ScoutTagOption[]
+ selected: string[]
+ onToggle: (tag: string) => void
+ onClear: () => void
+}): JSX.Element {
+ const label = selected.length === 0 ? 'Any tag' : selected.length === 1 ? selected[0] : `${selected.length} tags`
+ const items: LemonMenuItems = [
+ {
+ title: 'Tagged',
+ items: options.map((option) => ({
+ icon: <LemonCheckbox checked={selected.includes(option.tag)} className="pointer-events-none" />,
+ label: (
+ <span className="flex min-w-40 items-center justify-between gap-3">
+ <span className="truncate">{option.tag}</span>
+ <span className="text-muted tabular-nums">{option.count}</span>
+ </span>
+ ),
+ onClick: () => onToggle(option.tag),
+ })),
+ footer:
+ selected.length > 0 ? (
+ <LemonButton type="tertiary" size="xsmall" fullWidth onClick={onClear}>
+ Clear tags
+ </LemonButton>
+ ) : undefined,
+ },
+ ]
+
+ return (
+ <LemonMenu items={items} closeOnClickInside={false} placement="bottom-end">
+ <LemonButton
+ type="secondary"
+ size="xsmall"
+ sideIcon={<IconChevronDown />}
+ aria-label="Filter scouts by tag"
+ >
+ {label}
+ </LemonButton>
+ </LemonMenu>
+ )
+}
diff --git a/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx b/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx
index 3c3d4da68c32..d094a17037ad 100644
--- a/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx
+++ b/frontend/src/scenes/inbox/components/config/scouts/ScoutsFleetSection.tsx
@@ -27,6 +27,7 @@ import { ScoutCreateButton } from './ScoutCreateButton'
import { ScoutHelperSkillLinks } from './ScoutHelperSkillLinks'
import { ScoutRowCard } from './ScoutRowCard'
import { ScoutSuggestButton } from './ScoutSuggestButton'
+import { ScoutTagsFilter } from './ScoutTagsFilter'
/**
* Scout troop manager, hosted in the Scout troop setup modal (and the Agents settings tab). Both
@@ -193,8 +194,17 @@ function FleetStatsHeader(): JSX.Element {
}
function ScoutsFleetList(): JSX.Element {
- const { visibleConfigs, rollups, hideDisabled, deletingScoutIds, updatingScoutIds } = useValues(scoutFleetLogic)
- const { setHideDisabled, updateScoutConfig, deleteScout, loadScoutConfigs } = useActions(scoutFleetLogic)
+ const {
+ visibleConfigs,
+ rollups,
+ hideDisabled,
+ deletingScoutIds,
+ updatingScoutIds,
+ activeScoutTags,
+ scoutTagOptions,
+ } = useValues(scoutFleetLogic)
+ const { setHideDisabled, setScoutTagFilter, updateScoutConfig, deleteScout, loadScoutConfigs } =
+ useActions(scoutFleetLogic)
return (
<div className="flex flex-col gap-3">
@@ -204,6 +214,23 @@ function ScoutsFleetList(): JSX.Element {
<ScoutChatCta label="How is my scout troop performing?" prompt={SCOUT_FLEET_OVERVIEW_PROMPT} />
<ScoutChatCta label="What signals were emitted recently?" prompt={SCOUT_RECENT_SIGNALS_PROMPT} />
<span className="flex-1" />
+ {scoutTagOptions.length > 0 ? (
+ <div className="flex items-center gap-2">
+ <span className="text-xs text-muted">Tagged</span>
+ <ScoutTagsFilter
+ options={scoutTagOptions}
+ selected={activeScoutTags}
+ onToggle={(tag) =>
+ setScoutTagFilter(
+ activeScoutTags.includes(tag)
+ ? activeScoutTags.filter((candidate) => candidate !== tag)
+ : [...activeScoutTags, tag]
+ )
+ }
+ onClear={() => setScoutTagFilter([])}
+ />
+ </div>
+ ) : null}
<LemonButton
size="xsmall"
type="tertiary"
@@ -223,17 +250,21 @@ function ScoutsFleetList(): JSX.Element {
{/* The enclosing modal owns the scroll, so the list stays flat here — a nested
overflow container would create a scroll-area-within-a-scroll-area. */}
<div className="flex flex-col gap-2">
- {visibleConfigs.map((config: SignalScoutConfig) => (
- <ScoutRowCard
- key={config.id}
- config={config}
- rollup={rollups.get(config.skill_name)}
- onUpdate={updateScoutConfig}
- onDelete={deleteScout}
- deleting={deletingScoutIds.includes(config.id)}
- updating={updatingScoutIds.includes(config.id)}
- />
- ))}
+ {visibleConfigs.length === 0 ? (
+ <span className="px-1 py-2 text-xs text-muted">No scouts match the current filters.</span>
+ ) : (
+ visibleConfigs.map((config: SignalScoutConfig) => (
+ <ScoutRowCard
+ key={config.id}
+ config={config}
+ rollup={rollups.get(config.skill_name)}
+ onUpdate={updateScoutConfig}
+ onDelete={deleteScout}
+ deleting={deletingScoutIds.includes(config.id)}
+ updating={updatingScoutIds.includes(config.id)}
+ />
+ ))
+ )}
</div>
<div className="flex flex-col gap-1">
diff --git a/frontend/src/scenes/inbox/inboxAnalytics.ts b/frontend/src/scenes/inbox/inboxAnalytics.ts
index 92a52f9227d0..0f1c147d48ff 100644
--- a/frontend/src/scenes/inbox/inboxAnalytics.ts
+++ b/frontend/src/scenes/inbox/inboxAnalytics.ts
@@ -98,6 +98,7 @@ export type ScoutActionType =
| 'open_helper_skill'
| 'open_findings'
| 'toggle_hide_disabled'
+ | 'filter_tags'
| 'expand_run'
| 'collapse_run'
| 'filter_runs'
diff --git a/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.test.ts b/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.test.ts
index 5bbd0cd16d5e..d44a180eae30 100644
--- a/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.test.ts
+++ b/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.test.ts
@@ -83,6 +83,7 @@ describe('scoutCreateModalLogic', () => {
channel: 'C123|#ai-observability',
},
},
+ tags: ['on-call', 'revenue'],
},
},
onClose,
@@ -106,6 +107,7 @@ describe('scoutCreateModalLogic', () => {
channel: 'C123|#ai-observability',
},
},
+ tags: ['on-call', 'revenue'],
},
})
@@ -126,6 +128,7 @@ describe('scoutCreateModalLogic', () => {
channel: 'C123|#ai-observability',
},
},
+ tags: ['on-call', 'revenue'],
},
})
expect(onCreated).toHaveBeenCalledWith(CREATED_SCOUT)
@@ -157,6 +160,7 @@ describe('scoutCreateModalLogic', () => {
emit: true,
run_interval_minutes: 1440,
run_cron_schedule: '45 14 * * *',
+ tags: [],
},
}),
})
@@ -170,6 +174,7 @@ describe('scoutCreateModalLogic', () => {
emit: true,
run_interval_minutes: 1440,
run_cron_schedule: '45 14 * * *',
+ tags: [],
},
})
)
diff --git a/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.ts b/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.ts
index 01f4e9540fbb..787b32624ec0 100644
--- a/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.ts
+++ b/frontend/src/scenes/inbox/logics/scoutCreateModalLogic.ts
@@ -23,9 +23,10 @@ import {
SIGNALS_SCOUT_SKILL_PREFIX,
timeToDailyCron,
} from '../utils/scoutRunsWindow'
+import { MAX_SCOUT_TAG_LENGTH, MAX_SCOUT_TAGS, normalizeScoutTag } from '../utils/scoutTags'
type ScoutCreateConfigFormValues = Required<
- Pick<SignalScoutConfigOptionsApi, 'enabled' | 'emit' | 'run_interval_minutes' | 'run_cron_schedule'>
+ Pick<SignalScoutConfigOptionsApi, 'enabled' | 'emit' | 'run_interval_minutes' | 'run_cron_schedule' | 'tags'>
> &
Pick<SignalScoutConfigOptionsApi, 'output_destinations'>
@@ -55,6 +56,7 @@ export const DEFAULT_SCOUT_CREATE_FORM_VALUES: ScoutCreateFormValues = {
emit: true,
run_interval_minutes: 1440,
run_cron_schedule: null,
+ tags: [],
},
}
@@ -87,6 +89,16 @@ function scoutNameError(name: string): string | undefined {
return undefined
}
+function scoutTagsError(tags: string[]): string | undefined {
+ if (tags.length > MAX_SCOUT_TAGS) {
+ return `A scout can have up to ${MAX_SCOUT_TAGS} tags`
+ }
+ if (tags.some((tag) => normalizeScoutTag(tag).length > MAX_SCOUT_TAG_LENGTH)) {
+ return `Tags can be up to ${MAX_SCOUT_TAG_LENGTH} characters`
+ }
+ return undefined
+}
+
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface scoutCreateModalLogicValues {
currentTeamId: number | null // teamLogic
@@ -175,25 +187,33 @@ export const scoutCreateModalLogic: LogicWrapper<scoutCreateModalLogicType> = ke
forms(({ props: logicProps, actions, values }) => ({
scoutCreateForm: {
defaults: getScoutCreateFormValues(logicProps.initialValues),
- errors: ({ name, description, body, config, dailyTime }) => ({
- name: scoutNameError(name),
- description: !description.trim()
- ? 'Description is required'
- : description.length > SKILL_DESCRIPTION_MAX_LENGTH
- ? `Description must be ${SKILL_DESCRIPTION_MAX_LENGTH} characters or fewer`
- : undefined,
- body: !body.trim() ? 'Instructions are required' : undefined,
- dailyTime:
- dailyCronToTime(config.run_cron_schedule) !== null && !isValidScoutDailyTime(dailyTime)
- ? 'Run time is required'
- : undefined,
- config:
+ errors: ({ name, description, body, config, dailyTime }) => {
+ const runIntervalError =
!Number.isFinite(config.run_interval_minutes) ||
config.run_interval_minutes < 30 ||
config.run_interval_minutes > 43200
- ? { run_interval_minutes: 'Schedule must be between 30 minutes and 30 days' }
- : undefined,
- }),
+ ? 'Schedule must be between 30 minutes and 30 days'
+ : undefined
+ const tagsError = scoutTagsError(config.tags)
+
+ return {
+ name: scoutNameError(name),
+ description: !description.trim()
+ ? 'Description is required'
+ : description.length > SKILL_DESCRIPTION_MAX_LENGTH
+ ? `Description must be ${SKILL_DESCRIPTION_MAX_LENGTH} characters or fewer`
+ : undefined,
+ body: !body.trim() ? 'Instructions are required' : undefined,
+ dailyTime:
+ dailyCronToTime(config.run_cron_schedule) !== null && !isValidScoutDailyTime(dailyTime)
+ ? 'Run time is required'
+ : undefined,
+ config:
+ runIntervalError || tagsError
+ ? { run_interval_minutes: runIntervalError, tags: tagsError ? [tagsError] : undefined }
+ : undefined,
+ }
+ },
submit: async (formValues) => {
if (values.currentTeamId === null) {
lemonToast.error('Select a project before creating a scout')
diff --git a/frontend/src/scenes/inbox/logics/scoutFleetLogic.test.ts b/frontend/src/scenes/inbox/logics/scoutFleetLogic.test.ts
index c4a734389594..0e1cc82c2960 100644
--- a/frontend/src/scenes/inbox/logics/scoutFleetLogic.test.ts
+++ b/frontend/src/scenes/inbox/logics/scoutFleetLogic.test.ts
@@ -129,6 +129,35 @@ describe('scoutFleetLogic', () => {
expect(logic.values.updatingScoutIds).toEqual([])
})
+ it('filters scouts by any selected tag and stops applying tags that are no longer in use', () => {
+ const revenueScout = { ...BASE_CONFIG, tags: ['revenue'] }
+ const onCallScout = {
+ ...BASE_CONFIG,
+ id: 'config-2',
+ skill_name: 'signals-scout-on-call',
+ tags: ['on-call'],
+ }
+ const untaggedScout = {
+ ...BASE_CONFIG,
+ id: 'config-3',
+ skill_name: 'signals-scout-product',
+ tags: [],
+ }
+ logic.actions.loadScoutConfigsSuccess([revenueScout, onCallScout, untaggedScout])
+
+ logic.actions.setScoutTagFilter(['revenue', 'on-call'])
+
+ expect(logic.values.activeScoutTags).toEqual(['revenue', 'on-call'])
+ expect(logic.values.visibleConfigs.map((config) => config.id)).toEqual(['config-1', 'config-2'])
+
+ logic.actions.patchScoutConfigLocally(revenueScout.id, { tags: [] })
+ logic.actions.patchScoutConfigLocally(onCallScout.id, { tags: [] })
+
+ expect(logic.values.selectedScoutTags).toEqual(['revenue', 'on-call'])
+ expect(logic.values.activeScoutTags).toEqual([])
+ expect(logic.values.visibleConfigs).toHaveLength(3)
+ })
+
it('keeps configs unresolved until the current team is available', async () => {
logic.unmount()
teamLogic.actions.loadCurrentTeamSuccess(null)
diff --git a/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts b/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts
index 29f21d9c2e20..62d0457edda8 100644
--- a/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts
+++ b/frontend/src/scenes/inbox/logics/scoutFleetLogic.ts
@@ -50,6 +50,8 @@ import {
ScoutRollup,
sortConfigsForDisplay,
} from '../utils/scoutRunsWindow'
+import { configMatchesScoutTags, listScoutTagOptions } from '../utils/scoutTags'
+import type { ScoutTagOption } from '../utils/scoutTags'
type SignalScoutConfig = SignalScoutConfigApi
type SignalScoutConfigUpdate = PatchedSignalScoutConfigUpdateApi
@@ -97,6 +99,7 @@ const MAX_RUNS_PAGES = 15
export interface scoutFleetLogicValues {
dataProcessingAccepted: boolean // aiConsentLogic
dataProcessingApprovalDisabledReason: string | null // aiConsentLogic
+ activeScoutTags: string[]
aiConsentDisabledReason: string | null
customScoutCount: number
deletingScoutIds: string[]
@@ -129,6 +132,8 @@ export interface scoutFleetLogicValues {
scoutConfigsLoading: boolean
scoutMetadata: ScoutMetadataApi | null
scoutMetadataLoading: boolean
+ scoutTagOptions: ScoutTagOption[]
+ selectedScoutTags: string[]
updatingScoutIds: string[]
visibleConfigs: SignalScoutConfig[]
}
@@ -223,6 +228,9 @@ export interface scoutFleetLogicActions {
setHideDisabled: (hideDisabled: boolean) => {
hideDisabled: boolean
}
+ setScoutTagFilter: (tags: string[]) => {
+ tags: string[]
+ }
startRunsPolling: () => {
value: true
}
@@ -271,7 +279,13 @@ export interface scoutFleetLogicMeta {
) => FleetSummary | null
enabledCount: (scoutConfigs: SignalScoutConfigApi[] | null) => number
lastRunAt: (scoutConfigs: SignalScoutConfigApi[] | null) => string | null
- visibleConfigs: (scoutConfigs: SignalScoutConfigApi[] | null, hideDisabled: boolean) => SignalScoutConfig[]
+ scoutTagOptions: (scoutConfigs: SignalScoutConfigApi[] | null) => ScoutTagOption[]
+ activeScoutTags: (selectedScoutTags: string[], scoutTagOptions: ScoutTagOption[]) => string[]
+ visibleConfigs: (
+ scoutConfigs: SignalScoutConfigApi[] | null,
+ hideDisabled: boolean,
+ activeScoutTags: string[]
+ ) => SignalScoutConfig[]
runsWindowComplete: (runsWindow: { complete: boolean; runs: SignalScoutRunSummary[] }) => boolean
emittedFindingsSummary: (fleetFindingsSummary: FleetFindingsSummaryApi | null) => {
authoredReportCount: number
@@ -314,6 +328,7 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
deleteScoutFinished: (configId: string) => ({ configId }),
removeScoutConfigLocally: (configId: string) => ({ configId }),
setHideDisabled: (hideDisabled: boolean) => ({ hideDisabled }),
+ setScoutTagFilter: (tags: string[]) => ({ tags }),
setExpanded: (expanded: boolean) => ({ expanded }),
// Started/stopped by the fleet-list component so the always-mounted setup widget
// (which only reads configs) doesn't trigger the paginated runs-window polling.
@@ -459,6 +474,12 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
setHideDisabled: (_, { hideDisabled }) => hideDisabled,
},
],
+ selectedScoutTags: [
+ [] as string[],
+ {
+ setScoutTagFilter: (_, { tags }) => tags,
+ },
+ ],
scoutConfigs: [
null as SignalScoutConfig[] | null,
{
@@ -546,11 +567,27 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
return latest
},
],
+ scoutTagOptions: [
+ (s) => [s.scoutConfigs],
+ (scoutConfigs: SignalScoutConfig[] | null): ScoutTagOption[] => listScoutTagOptions(scoutConfigs ?? []),
+ ],
+ activeScoutTags: [
+ (s) => [s.selectedScoutTags, s.scoutTagOptions],
+ (selectedScoutTags: string[], scoutTagOptions: ScoutTagOption[]): string[] =>
+ selectedScoutTags.filter((tag) => scoutTagOptions.some((option) => option.tag === tag)),
+ ],
visibleConfigs: [
- (s) => [s.scoutConfigs, s.hideDisabled],
- (scoutConfigs: SignalScoutConfig[] | null, hideDisabled: boolean): SignalScoutConfig[] => {
- const sorted = sortConfigsForDisplay(scoutConfigs ?? [])
- return hideDisabled ? sorted.filter((config) => config.enabled) : sorted
+ (s) => [s.scoutConfigs, s.hideDisabled, s.activeScoutTags],
+ (
+ scoutConfigs: SignalScoutConfig[] | null,
+ hideDisabled: boolean,
+ activeScoutTags: string[]
+ ): SignalScoutConfig[] => {
+ let sorted = sortConfigsForDisplay(scoutConfigs ?? [])
+ if (hideDisabled) {
+ sorted = sorted.filter((config) => config.enabled)
+ }
+ return sorted.filter((config) => configMatchesScoutTags(config, activeScoutTags))
},
],
runsWindowComplete: [
@@ -588,6 +625,18 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([
}),
listeners(({ actions, values, cache }) => ({
+ setScoutTagFilter: ({ tags }) => {
+ captureScoutAction({
+ actionType: 'filter_tags',
+ surface: 'fleet_list',
+ extra: {
+ tags,
+ filter_match_count: tags.length
+ ? (values.scoutConfigs ?? []).filter((config) => configMatchesScoutTags(config, tags)).length
+ : undefined,
+ },
+ })
+ },
updateScoutConfig: async ({ configId, updates }) => {
const inFlight: Set<string> = (cache.updatingScoutIds ??= new Set())
const pendingUpdates: Map<string, SignalScoutConfigUpdate> = (cache.pendingScoutConfigUpdates ??= new Map())
diff --git a/frontend/src/scenes/inbox/utils/scoutTags.test.ts b/frontend/src/scenes/inbox/utils/scoutTags.test.ts
new file mode 100644
index 000000000000..59e11d873cc8
--- /dev/null
+++ b/frontend/src/scenes/inbox/utils/scoutTags.test.ts
@@ -0,0 +1,43 @@
+import type { SignalScoutConfigApi } from 'products/signals/frontend/generated/api.schemas'
+
+import {
+ configMatchesScoutTags,
+ MAX_SCOUT_TAGS,
+ normalizeScoutTag,
+ normalizeScoutTags,
+ withScoutTagsAdded,
+} from './scoutTags'
+
+const config = (tags: string[]): SignalScoutConfigApi =>
+ ({
+ id: 'config-1',
+ tags,
+ }) as SignalScoutConfigApi
+
+describe('scoutTags', () => {
+ it.each([
+ ['Revenue', 'revenue'],
+ ['on call', 'on-call'],
+ ['cost_spike', 'cost-spike'],
+ ['billing/usage', 'billingusage'],
+ ['--dashes--', 'dashes'],
+ ['a---b', 'a-b'],
+ ])('normalizes %s to %s', (input, expected) => {
+ expect(normalizeScoutTag(input)).toBe(expected)
+ })
+
+ it('normalizes and deduplicates tags before submission', () => {
+ expect(normalizeScoutTags(['On Call', 'revenue', 'on_call', ''])).toEqual(['on-call', 'revenue'])
+ })
+
+ it('refuses the entire addition when it would exceed the tag limit', () => {
+ const existing = Array.from({ length: MAX_SCOUT_TAGS - 1 }, (_, index) => `tag-${index}`)
+
+ expect(withScoutTagsAdded(existing, ['one-more', 'too-many'])).toEqual({ tags: null, overCap: true })
+ })
+
+ it('matches any selected tag', () => {
+ expect(configMatchesScoutTags(config(['revenue']), ['revenue', 'on-call'])).toBe(true)
+ expect(configMatchesScoutTags(config(['security']), ['revenue', 'on-call'])).toBe(false)
+ })
+})
diff --git a/frontend/src/scenes/inbox/utils/scoutTags.ts b/frontend/src/scenes/inbox/utils/scoutTags.ts
new file mode 100644
index 000000000000..0d5deb7e51f6
--- /dev/null
+++ b/frontend/src/scenes/inbox/utils/scoutTags.ts
@@ -0,0 +1,94 @@
+import type { SignalScoutConfigApi } from 'products/signals/frontend/generated/api.schemas'
+
+export const MAX_SCOUT_TAGS = 10
+export const MAX_SCOUT_TAG_LENGTH = 50
+
+export function normalizeScoutTag(raw: string): string {
+ return raw
+ .trim()
+ .toLowerCase()
+ .replace(/[\s_]+/g, '-')
+ .replace(/[^a-z0-9-]+/g, '')
+ .replace(/-{2,}/g, '-')
+ .replace(/^-+|-+$/g, '')
+}
+
+export function normalizeScoutTags(tags: string[]): string[] {
+ return [...new Set(tags.map(normalizeScoutTag).filter(Boolean))].sort()
+}
+
+export interface ParsedScoutTags {
+ tags: string[]
+ tooLong: string[]
+}
+
+export function parseScoutTagsInput(input: string): ParsedScoutTags {
+ const tags: string[] = []
+ const tooLong: string[] = []
+
+ for (const candidate of input.split(',')) {
+ const tag = normalizeScoutTag(candidate)
+ if (!tag) {
+ continue
+ }
+ if (tag.length > MAX_SCOUT_TAG_LENGTH) {
+ tooLong.push(tag)
+ } else if (!tags.includes(tag)) {
+ tags.push(tag)
+ }
+ }
+
+ return { tags, tooLong }
+}
+
+export function scoutTags(config: Pick<SignalScoutConfigApi, 'tags'>): string[] {
+ return config.tags ?? []
+}
+
+export interface ScoutTagsAddition {
+ tags: string[] | null
+ overCap: boolean
+}
+
+export function withScoutTagsAdded(existing: string[], additions: string[]): ScoutTagsAddition {
+ const next = new Set([...existing, ...additions])
+ if (next.size > MAX_SCOUT_TAGS) {
+ return { tags: null, overCap: true }
+ }
+ if (next.size === existing.length) {
+ return { tags: null, overCap: false }
+ }
+ return { tags: [...next].sort(), overCap: false }
+}
+
+export function withScoutTagRemoved(existing: string[], tag: string): string[] | null {
+ if (!existing.includes(tag)) {
+ return null
+ }
+ return existing.filter((candidate) => candidate !== tag).sort()
+}
+
+export interface ScoutTagOption {
+ tag: string
+ count: number
+}
+
+export function listScoutTagOptions(configs: SignalScoutConfigApi[]): ScoutTagOption[] {
+ const counts = new Map<string, number>()
+ for (const config of configs) {
+ for (const tag of scoutTags(config)) {
+ counts.set(tag, (counts.get(tag) ?? 0) + 1)
+ }
+ }
+ return [...counts.entries()]
+ .map(([tag, count]) => ({ tag, count }))
+ .sort((first, second) => second.count - first.count || first.tag.localeCompare(second.tag))
+}
+
+export function configMatchesScoutTags(config: SignalScoutConfigApi, selected: string[]): boolean {
+ if (selected.length === 0) {
+ return true
+ }
+ const tags = scoutTags(config)
+ return selected.some((tag) => tags.includes(tag))
+}
diff --git a/products/signals/backend/migrations/0087_signalscoutconfig_tags.py b/products/signals/backend/migrations/0087_signalscoutconfig_tags.py
new file mode 100644
index 000000000000..2b263873a737
--- /dev/null
+++ b/products/signals/backend/migrations/0087_signalscoutconfig_tags.py
@@ -0,0 +1,22 @@
+import django.contrib.postgres.fields
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("signals", "0086_signalscoutconfig_structured_output_schema"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="signalscoutconfig",
+ name="tags",
+ field=django.contrib.postgres.fields.ArrayField(
+ base_field=models.CharField(max_length=50),
+ blank=True,
+ default=list,
+ null=True,
+ size=None,
+ ),
+ ),
+ ]
diff --git a/products/signals/backend/migrations/max_migration.txt b/products/signals/backend/migrations/max_migration.txt
index 5c6ce8ba1544..0e3b6cb0ab7d 100644
--- a/products/signals/backend/migrations/max_migration.txt
+++ b/products/signals/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0086_signalscoutconfig_structured_output_schema
+0087_signalscoutconfig_tags
diff --git a/products/signals/backend/models.py b/products/signals/backend/models.py
index a754cbcc72c7..1167d86d2817 100644
--- a/products/signals/backend/models.py
+++ b/products/signals/backend/models.py
@@ -1161,6 +1161,11 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):
# which system writers should leave it alone (`in_cold_start_grace`).
COLD_START_GRACE = timedelta(days=14)
+ # Bounds on `tags`. Tags are a grouping aid over a fleet an org can only grow so far, not a
+ # taxonomy — the caps keep the column small and the fleet filter's option list scannable.
+ MAX_TAGS = 10
+ MAX_TAG_LENGTH = 50
+
# `objects` (TeamScopedManager) inherited from TeamScopedRootMixin stays fail-closed for
# explicit user code. `all_teams` is the unscoped sibling for Django framework internals
# (admin changelist queryset, related-object access, prefetch_related) that must not
@@ -1269,6 +1274,20 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):
# config columns. A Slack destination is active only when both its integration and channel
# are present; the UI may persist the integration first while the user chooses a channel.
output_destinations = models.JSONField(default=dict, db_default={})
+ # Free-form labels for grouping the fleet ("revenue", "on-call", "experimental"). Normalized
+ # to lowercase and deduped at the API boundary, so a tag means the same thing whoever typed
+ # it. No GIN index: every read is already scoped to one team, and a team holds at most a
+ # couple of dozen scouts, so `tags && ARRAY[...]` runs over a handful of rows.
+ # `null=True` only so the AddField could land without a NOT NULL rewrite — the migration
+ # backfilled existing rows with `{}` and every write path sends a list, so NULL carries no
+ # meaning. Read through `tag_list` rather than this column so that stays an implementation
+ # detail instead of leaking a nullable `tags` into the API and its generated clients.
+ tags = ArrayField(
+ models.CharField(max_length=MAX_TAG_LENGTH),
+ default=list,
+ null=True,
+ blank=True,
+ )
# Optional JSON Schema (draft 2020-12, object-rooted) describing one structured record this
# scout produces via `scout-record-output`. Null = the channel is off: the record endpoint
# fails closed and the run prompt renders no structured-output section. Records land solely
@@ -1498,6 +1517,18 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):
anchor = max(anchor, self.status_changed_at)
return timezone.now() < anchor + self.COLD_START_GRACE
+ @property
+ def tag_list(self) -> list[str]:
+ """`tags` with the nullable column's NULL folded away, for readers.
+
+ The API serializes this rather than the column so `tags` is a plain non-null list
+ everywhere downstream. Serializing the column directly would surface `null` in the
+ OpenAPI schema and, through the generated clients, force every consumer to tell "no
+ tags" apart from "not set" — a distinction the column does not actually carry, since
+ the AddField backfilled existing rows and every write path sends a list.
+ """
+ return self.tags or []
+
def _get_before_update(self, **kwargs: Any) -> "SignalScoutConfig | None":
# ModelActivityMixin's prior-state lookup goes through `objects` (the fail-closed
# TeamScopedManager). Edits from Django admin / the coordinator / a shell run with no
diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.py
index 13c75af2c97d..a83f4b3ad0ca 100644
--- a/products/signals/backend/scout_harness/serializers.py
+++ b/products/signals/backend/scout_harness/serializers.py
@@ -31,6 +31,7 @@ from products.signals.backend.models import SignalScoutConfig, SignalScoutEmissi
from products.signals.backend.report_charts import MAX_REPORT_CHARTS
from products.signals.backend.scout_harness.derived_metadata import DERIVED_FLAG_KEYS, DERIVED_METADATA_KEY
from products.signals.backend.scout_harness.skill_loader import SIGNALS_SCOUT_SKILL_PREFIX
+from products.signals.backend.scout_harness.tags import slugify_tag
from products.signals.backend.scout_harness.tools.emit import (
MAX_FINDING_ID_LENGTH,
MAX_TAG_LENGTH,
@@ -1959,6 +1960,79 @@ def _validate_output_destinations(value: dict, context: dict) -> dict:
return {"slack": slack}
+_SCOUT_TAGS_HELP_TEXT = (
+ 'Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to '
+ "lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored "
+ f"sorted; at most {SignalScoutConfig.MAX_TAGS} tags, each at most "
+ f"{SignalScoutConfig.MAX_TAG_LENGTH} characters once normalized. Pass the full desired set — "
+ "a write replaces the existing tags rather than merging into them. Filter the config list "
+ "with the `tags` query parameter."
+)
+
+
+def _scout_tags_field() -> serializers.ListField:
+ """Writable `tags` field shared by the update and create paths.
+
+ Deliberately no `max_length` on the child: DRF would apply it to the raw string, before
+ `slugify_tag` strips punctuation and collapses hyphen runs, so `"revenue!!!…"` would 400
+ even though it stores as the 7-character `revenue`. The cap describes what is stored, so
+ `_validate_scout_tags` enforces it after normalization — which is also the only way it can
+ agree with the desktop editor, which shows the normalized tag as you type. Unbounded raw
+ input is bounded by `DATA_UPLOAD_MAX_MEMORY_SIZE`, and the slug regexes are linear.
+ """
+ return serializers.ListField(
+ child=serializers.CharField(),
+ required=False,
+ allow_empty=True,
+ max_length=SignalScoutConfig.MAX_TAGS,
+ help_text=_SCOUT_TAGS_HELP_TEXT,
+ )
+
+
+def _validate_scout_tags(value: list[str]) -> list[str]:
+ """Normalize a caller-supplied tag list into the stored form.
+
+ Unlike the emit path — which normalizes agent near-misses rather than spending a turn on a
+ formatting 400 — a tag that survives normalization as nothing is an error here: a person who
+ typed `!!!` into the tag box should be told it didn't take. Stored sorted and deduped so
+ re-sending the same set in a different order is not a change, which keeps a no-op write out
+ of the activity log.
+ """
+ normalized: set[str] = set()
+ for raw in value:
+ tag = slugify_tag(raw)
+ if not tag:
+ raise serializers.ValidationError(f"Tag {raw!r} is empty once normalized to a lowercase slug.")
+ # Measured on the slug, not the raw input: what lands in the column is what the cap is
+ # about, and the desktop editor checks the same thing.
+ if len(tag) > SignalScoutConfig.MAX_TAG_LENGTH:
+ raise serializers.ValidationError(
+ f"Tag {raw!r} is {len(tag)} characters once normalized, over the "
+ f"{SignalScoutConfig.MAX_TAG_LENGTH} limit."
+ )
+ normalized.add(tag)
+ return sorted(normalized)
+
+
+class SignalScoutConfigListQuerySerializer(serializers.Serializer):
+ """Query parameters for the scout config list."""
+
+ tags = serializers.CharField(
+ required=False,
+ help_text=(
+ "Comma-separated tags, e.g. `revenue,on-call`. Returns the scouts carrying at least one "
+ "of them. Values are normalized the same way stored tags are, so `On Call` matches "
+ "`on-call`. Omit for the whole fleet."
+ ),
+ )
+
+ def validate_tags(self, value: str) -> list[str]:
+ tags = sorted({slug for raw in value.split(",") if (slug := slugify_tag(raw))})
+ if not tags:
+ raise serializers.ValidationError("No usable tags in the filter once normalized to lowercase slugs.")
+ return tags
+
+
@extend_schema_field(OpenApiTypes.OBJECT)
class StructuredOutputSchemaField(serializers.JSONField):
"""A JSON Schema (draft 2020-12) as a JSON object. Free-form at the OpenAPI layer —
@@ -2115,6 +2189,19 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):
"sweep paused, so the sweep never overrules a person twice."
),
)
+ # Read through `tag_list`, not the column, so a pre-migration NULL reads as `[]`.
+ # Deliberately neither read-only nor a method field: both mark `tags` `readOnly` in the
+ # schema, which the generated TS clients emit as `readonly string[]` — not assignable to the
+ # update body's `string[]`, so a caller handing a fetched config straight to the patch call
+ # stops compiling. Every other read-only field here is a scalar, where `readonly` is
+ # invisible; an array is where it bites. This serializer is response-only at every call site
+ # (the write paths have their own serializers), so being writable-shaped costs nothing.
+ tags = serializers.ListField(
+ child=serializers.CharField(),
+ source="tag_list",
+ required=False,
+ help_text=_SCOUT_TAGS_HELP_TEXT,
+ )
@extend_schema_field(OpenApiTypes.STR)
def get_description(self, obj: SignalScoutConfig) -> str:
@@ -2150,6 +2237,7 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):
"consecutive_failure_count",
"status_changed_at",
"auto_pause_exempt",
+ "tags",
"created_at",
]
read_only_fields = ["id", "created_at"]
@@ -2274,6 +2362,7 @@ class SignalScoutConfigUpdateSerializer(serializers.ModelSerializer):
"`no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet."
),
)
+ tags = _scout_tags_field()
structured_output_schema = StructuredOutputSchemaField(
required=False,
allow_null=True,
@@ -2286,6 +2375,9 @@ class SignalScoutConfigUpdateSerializer(serializers.ModelSerializer):
def validate_output_destinations(self, value: dict) -> dict:
return _validate_output_destinations(value, self.context)
+ def validate_tags(self, value: list[str]) -> list[str]:
+ return _validate_scout_tags(value)
+
def validate_structured_output_schema(self, value: dict | None) -> dict | None:
return _validate_structured_output_schema(value)
@@ -2365,6 +2457,7 @@ class SignalScoutConfigUpdateSerializer(serializers.ModelSerializer):
"structured_output_schema",
"network_access",
"auto_pause_exempt",
+ "tags",
]
@@ -2420,6 +2513,7 @@ class SignalScoutConfigOptionsSerializer(serializers.Serializer):
"Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
),
)
+ tags = _scout_tags_field()
structured_output_schema = StructuredOutputSchemaField(
required=False,
allow_null=True,
@@ -2429,6 +2523,9 @@ class SignalScoutConfigOptionsSerializer(serializers.Serializer):
def validate_run_cron_schedule(self, value: str | None) -> str | None:
return _validate_run_cron_schedule(value) if value is not None else None
+ def validate_tags(self, value: list[str]) -> list[str]:
+ return _validate_scout_tags(value)
+
def validate_output_destinations(self, value: dict) -> dict:
context = self.context
if not isinstance(context.get("project_id"), int):
diff --git a/products/signals/backend/scout_harness/tags.py b/products/signals/backend/scout_harness/tags.py
new file mode 100644
index 000000000000..cb575dc2955f
--- /dev/null
+++ b/products/signals/backend/scout_harness/tags.py
@@ -0,0 +1,25 @@
+"""Tag slug normalization shared by scout findings and scout configs.
+
+Tags are lowercase kebab-case so a vocabulary converges instead of fragmenting on casing and
+punctuation (`cost_spike` vs `Cost Spike` vs `cost-spike`). Both the emit path (tags an agent
+attaches to a finding) and the config API (labels a person puts on a scout) normalize through
+here, so the two read alike and a person filtering the fleet by `revenue` types the same thing
+a scout would have written.
+"""
+
+import re
+
+_TAG_SEPARATORS = re.compile(r"[\s_]+")
+_TAG_INVALID_CHARS = re.compile(r"[^a-z0-9-]+")
+_TAG_HYPHEN_RUNS = re.compile(r"-{2,}")
+
+
+def slugify_tag(raw: str) -> str:
+ """Lowercase kebab-case slug for one tag, or `""` if nothing survives normalization.
+
+ Callers decide what an empty result means — the emit path rejects it so an agent never
+ believes a tag stuck when it didn't, and the config API does the same for a person.
+ """
+ slug = _TAG_SEPARATORS.sub("-", raw.strip().lower())
+ slug = _TAG_INVALID_CHARS.sub("", slug)
+ return _TAG_HYPHEN_RUNS.sub("-", slug).strip("-")
diff --git a/products/signals/backend/scout_harness/tools/emit.py b/products/signals/backend/scout_harness/tools/emit.py
index 0dcadbf5cf84..c755961a8324 100644
--- a/products/signals/backend/scout_harness/tools/emit.py
+++ b/products/signals/backend/scout_harness/tools/emit.py
@@ -25,7 +25,6 @@ validates against.
from __future__ import annotations
-import re
import uuid
import logging
from dataclasses import asdict, dataclass
@@ -38,6 +37,7 @@ from posthog.sync import database_sync_to_async
from products.signals.backend.models import SignalScoutConfig, SignalScoutEmission, SignalScoutRun, SignalSourceConfig
from products.signals.backend.scout_harness.slack_delivery_queue import queue_configured_scout_slack_delivery
+from products.signals.backend.scout_harness.tags import slugify_tag
from products.tasks.backend.facade import api as tasks_facade
logger = logging.getLogger(__name__)
@@ -56,15 +56,12 @@ MAX_EVIDENCE_ENTRIES = 20
# (default 1.0) immediately. See products/signals/backend/scout_harness/AGENTS.md.
SCOUT_SIGNAL_WEIGHT = 1.0
-# Tags are slugs: lowercase kebab-case so the per-scout vocabulary converges instead of
-# fragmenting on casing/punctuation (`cost_spike` vs `Cost Spike` vs `cost-spike`). The
-# harness normalizes rather than rejects near-misses — agents shouldn't burn a turn on a
-# formatting 400 — but an unsalvageable tag (empty after normalization, or overlong) is a
-# hard error so the vocabulary never accretes junk entries.
+# Tags are slugs (normalized by `scout_harness.tags.slugify_tag`, shared with the scout config
+# API). The harness normalizes rather than rejects near-misses — agents shouldn't burn a turn on
+# a formatting 400 — but an unsalvageable tag (empty after normalization, or overlong) is a hard
+# error so the vocabulary never accretes junk entries.
MAX_TAGS_PER_FINDING = 10
MAX_TAG_LENGTH = 50
-_TAG_INVALID_CHARS = re.compile(r"[^a-z0-9-]+")
-_TAG_HYPHEN_RUNS = re.compile(r"-{2,}")
# Cap on a caller-supplied `finding_id`. The deterministic `source_id` is
# `run:<uuid>:finding:<finding_id>` (~49 fixed chars), and both `finding_id` and `source_id`
@@ -338,9 +335,7 @@ def normalize_tags(tags: list[str] | None) -> list[str] | None:
raise InvalidEmitError(f"tags has {len(tags)} entries, max is {MAX_TAGS_PER_FINDING}")
normalized: list[str] = []
for raw in tags:
- slug = re.sub(r"[\s_]+", "-", raw.strip().lower())
- slug = _TAG_INVALID_CHARS.sub("", slug)
- slug = _TAG_HYPHEN_RUNS.sub("-", slug).strip("-")
+ slug = slugify_tag(raw)
if not slug:
raise InvalidEmitError(f"tag {raw!r} is empty after slug normalization")
if len(slug) > MAX_TAG_LENGTH:
diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.py
index d36437c862c6..2c419f2ee58c 100644
--- a/products/signals/backend/scout_harness/views.py
+++ b/products/signals/backend/scout_harness/views.py
@@ -101,6 +101,7 @@ from products.signals.backend.scout_harness.serializers import (
SearchMemoryQuerySerializer,
SearchRecentRunsQuerySerializer,
SignalScoutConfigCreateSerializer,
+ SignalScoutConfigListQuerySerializer,
SignalScoutConfigSerializer,
SignalScoutConfigUpdateSerializer,
SignalScoutCreateResponseSerializer,
@@ -1927,7 +1928,8 @@ class SignalScoutConfigViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
"is read verbatim by the scout agent."
)
- @extend_schema(
+ @validated_request(
+ query_serializer=SignalScoutConfigListQuerySerializer,
responses={
200: OpenApiResponse(
response=SignalScoutConfigSerializer(many=True),
@@ -1938,8 +1940,9 @@ class SignalScoutConfigViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
description=(
"List the per-(team, skill) scout configs for this project. Each row includes its schedule "
"(rolling `run_interval_minutes`, or a project-local `run_cron_schedule` when set), `enabled`, "
- "and `emit` posture. A freshly authored scout skill appears here once its config is registered, "
- "either explicitly via create or by the coordinator's next tick."
+ "`emit` posture, and `tags`. A freshly authored scout skill appears here once its config is "
+ "registered, either explicitly via create or by the coordinator's next tick. Pass `tags` to "
+ "narrow the fleet to the scouts carrying at least one of the given labels."
),
operation_id="signals_scout_config_list",
)
@@ -1950,12 +1953,14 @@ class SignalScoutConfigViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):
# held-back team across the whole config API. Storage is untouched; the row reappears if
# the team is later un-withheld.
withheld = withheld_skills_for_team(team_id)
- configs = list(
- SignalScoutConfig.objects.unscoped()
- .filter(team_id=team_id)
- .exclude(skill_name__in=withheld)
- .order_by("skill_name")
- )
+ queryset = SignalScoutConfig.objects.unscoped().filter(team_id=team_id).exclude(skill_name__in=withheld)
+ # Any-of, matching how the fleet UI's tag picker reads. `&&` over the array column rather
+ # than a join table or a GIN index: the team filter already bounds this to the handful of
+ # scouts an org is allowed to create, so there is nothing left for an index to save.
+ tags = (getattr(request, "validated_query_data", None) or {}).get("tags")
+ if tags:
+ queryset = queryset.filter(tags__overlap=tags)
+ configs = list(queryset.order_by("skill_name"))
skill_info = _skill_info_for(team_id, [c.skill_name for c in configs])
serializer = SignalScoutConfigSerializer(configs, many=True, context={"skill_info": skill_info})
return Response(serializer.data)
diff --git a/products/signals/backend/test/test_scout_create_api.py b/products/signals/backend/test/test_scout_create_api.py
index 6a47cca1416c..37734694b343 100644
--- a/products/signals/backend/test/test_scout_create_api.py
+++ b/products/signals/backend/test/test_scout_create_api.py
@@ -67,6 +67,18 @@ class TestSignalScoutCreateAPI(APIBaseTest):
assert config.output_destinations == payload["config"]["output_destinations"]
assert response.json()["config"]["description"] == payload["description"]
+ def test_create_stores_normalized_tags_from_the_config_block(self) -> None:
+ # Tagging at authoring time is the point — a scout the agent creates should land in the
+ # right group without a follow-up PATCH.
+ payload = {**self._payload(), "config": {"tags": ["Revenue", "on call", "revenue"]}}
+
+ response = self.client.post(self._url(), data=payload, format="json")
+
+ assert response.status_code == status.HTTP_201_CREATED
+ assert response.json()["config"]["tags"] == ["on-call", "revenue"]
+ config = SignalScoutConfig.all_teams.get(team=self.team, skill_name=payload["name"])
+ assert config.tags == ["on-call", "revenue"]
+
def test_matching_definition_retry_is_idempotent_and_applies_config(self) -> None:
payload = self._payload()
diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.py
index ca78e3260565..1e70dd47d4f5 100644
--- a/products/signals/backend/test/test_scout_harness_api.py
+++ b/products/signals/backend/test/test_scout_harness_api.py
@@ -2216,6 +2216,140 @@ class TestScoutHarnessConfigAPI(APIBaseTest):
assert response.status_code == status.HTTP_404_NOT_FOUND
assert SignalScoutConfig.all_teams.filter(id=config.id).exists()
+ def test_list_reports_no_tags_as_an_empty_list(self) -> None:
+ # The column is nullable so the AddField could land without a rewrite; a consumer must
+ # never have to tell "no tags" apart from "null".
+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo")
+ SignalScoutConfig.objects.filter(pk=config.pk).update(tags=None)
+
+ response = self.client.get(self._list_url())
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()[0]["tags"] == []
+
+ @parameterized.expand(
+ [
+ ("single", "revenue", ["signals-scout-alpha", "signals-scout-beta"]),
+ ("any_of_matches_either", "revenue,on-call", ["signals-scout-alpha", "signals-scout-beta"]),
+ ("narrow", "on-call", ["signals-scout-beta"]),
+ ("normalized_like_stored_tags", "On Call", ["signals-scout-beta"]),
+ ("unknown_tag_matches_nothing", "nope", []),
+ ]
+ )
+ def test_list_filters_by_tags(self, _name: str, tags_param: str, expected: list[str]) -> None:
+ SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-alpha", tags=["revenue"])
+ SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-beta", tags=["on-call", "revenue"])
+ SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-gamma", tags=[])
+
+ response = self.client.get(self._list_url(), data={"tags": tags_param})
+
+ assert response.status_code == status.HTTP_200_OK
+ assert [c["skill_name"] for c in response.json()] == expected
+
+ def test_list_without_a_tag_filter_returns_the_whole_fleet(self) -> None:
+ SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-alpha", tags=["revenue"])
+ SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-beta", tags=[])
+
+ response = self.client.get(self._list_url())
+
+ assert response.status_code == status.HTTP_200_OK
+ assert [c["skill_name"] for c in response.json()] == ["signals-scout-alpha", "signals-scout-beta"]
+
+ def test_list_rejects_a_tag_filter_that_normalizes_to_nothing(self) -> None:
+ # An unusable filter must not silently widen to "the whole fleet" — that would read as
+ # "these scouts carry the tag" when nothing was filtered at all.
+ SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-alpha", tags=["revenue"])
+
+ response = self.client.get(self._list_url(), data={"tags": "!!!"})
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+
+ @parameterized.expand(
+ [
+ ("normalizes_and_sorts", ["Revenue", "on call"], ["on-call", "revenue"]),
+ ("dedupes_after_normalization", ["revenue", "Revenue", "REVENUE"], ["revenue"]),
+ ("slugifies_punctuation", ["cost_spike", "billing/usage"], ["billingusage", "cost-spike"]),
+ ("empty_list_clears", [], []),
+ # The length cap is measured on the slug, not the raw string. A raw entry longer than
+ # the cap whose punctuation strips down to a short slug has to be accepted: rejecting
+ # it would 400 a tag the desktop editor showed as fine, since the editor measures the
+ # normalized form too.
+ ("long_raw_input_that_normalizes_short", ["revenue" + "!" * 60], ["revenue"]),
+ ]
+ )
+ def test_partial_update_normalizes_tags(self, _name: str, payload: list[str], expected: list[str]) -> None:
+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo", tags=["stale"])
+
+ response = self.client.patch(self._detail_url(str(config.id)), data={"tags": payload}, format="json")
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["tags"] == expected
+ config.refresh_from_db()
+ assert config.tags == expected
+
+ def test_partial_update_replaces_tags_rather_than_merging(self) -> None:
+ config = SignalScoutConfig.objects.create(
+ team=self.team, skill_name="signals-scout-foo", tags=["revenue", "on-call"]
+ )
+
+ response = self.client.patch(self._detail_url(str(config.id)), data={"tags": ["revenue"]}, format="json")
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["tags"] == ["revenue"]
+
+ def test_partial_update_leaves_tags_untouched_when_omitted(self) -> None:
+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo", tags=["revenue"])
+
+ response = self.client.patch(self._detail_url(str(config.id)), data={"emit": False}, format="json")
+
+ assert response.status_code == status.HTTP_200_OK
+ assert response.json()["tags"] == ["revenue"]
+
+ @parameterized.expand(
+ [
+ ("blank_after_normalization", ["!!!"]),
+ # Over the cap once normalized (all-alphanumeric, so the slug is the same length).
+ ("over_the_per_tag_length_cap", ["a" * (SignalScoutConfig.MAX_TAG_LENGTH + 1)]),
+ ("over_the_count_cap", [f"tag-{index}" for index in range(SignalScoutConfig.MAX_TAGS + 1)]),
+ ]
+ )
+ def test_partial_update_rejects_invalid_tags(self, _name: str, payload: list[str]) -> None:
+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo", tags=["revenue"])
+
+ response = self.client.patch(self._detail_url(str(config.id)), data={"tags": payload}, format="json")
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ config.refresh_from_db()
+ assert config.tags == ["revenue"]
+
+ def test_create_registers_tags(self) -> None:
+ self._make_skill("signals-scout-foo")
+
+ response = self.client.post(
+ self._list_url(),
+ data={"skill_name": "signals-scout-foo", "tags": ["Revenue", "on call"]},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_201_CREATED
+ assert response.json()["tags"] == ["on-call", "revenue"]
+ config = SignalScoutConfig.objects.get(team=self.team, skill_name="signals-scout-foo")
+ assert config.tags == ["on-call", "revenue"]
+
+ def test_create_upsert_applies_tags_to_an_existing_config(self) -> None:
+ self._make_skill("signals-scout-foo")
+ config = SignalScoutConfig.objects.create(team=self.team, skill_name="signals-scout-foo", tags=["stale"])
+
+ response = self.client.post(
+ self._list_url(),
+ data={"skill_name": "signals-scout-foo", "tags": ["revenue"]},
+ format="json",
+ )
+
+ assert response.status_code == status.HTTP_200_OK
+ config.refresh_from_db()
+ assert config.tags == ["revenue"]
+
def _sync_url(self) -> str:
return f"/api/projects/{self.team.id}/signals/scout/configs/sync/"
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index 06f58fe199bc..46e41332b5ea 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -1888,6 +1888,11 @@ export interface SignalScoutConfigOptionsApi {
* @nullable
*/
run_cron_schedule?: string | null
+ /**
+ * Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.
+ * @maxItems 10
+ */
+ tags?: string[]
/**
* Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces via `scout-record-output` — e.g. a per-report quality judgment (`{"type": "object", "properties": {"verdict": {"enum": ["good", "bad", "unsure"]}, "reason": {"type": "string"}}, "required": ["verdict", "reason"]}`). The root must be `"type": "object"`. Setting a schema turns the structured-output channel on: the run prompt renders the schema and every submitted record is validated against it and recorded in the project as a `$scout_structured_output` event, queryable like any event. The channel also requires emit — a dry-run scout has nowhere to record to. Cardinality is the scout's call (one record per run, one per judged entity, ...). Null = channel off. Setting a schema requires skill-authoring authorization (the `llm_skill:write` scope and skill editor access) since the scout reads it verbatim in its prompt; clearing it needs only the config write. Records validate against the schema in force when the run was dispatched.
* @nullable
@@ -2036,6 +2041,8 @@ export interface SignalScoutConfigApi {
readonly status_changed_at: string | null
/** Whether this scout is exempt from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet. Also set automatically when someone re-enables a scout the inactivity sweep paused, so the sweep never overrules a person twice. */
readonly auto_pause_exempt: boolean
+ /** Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter. */
+ tags?: string[]
readonly created_at: string
}
@@ -2084,6 +2091,11 @@ export interface SignalScoutConfigCreateApi {
* @nullable
*/
run_cron_schedule?: string | null
+ /**
+ * Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.
+ * @maxItems 10
+ */
+ tags?: string[]
/**
* Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces via `scout-record-output` — e.g. a per-report quality judgment (`{"type": "object", "properties": {"verdict": {"enum": ["good", "bad", "unsure"]}, "reason": {"type": "string"}}, "required": ["verdict", "reason"]}`). The root must be `"type": "object"`. Setting a schema turns the structured-output channel on: the run prompt renders the schema and every submitted record is validated against it and recorded in the project as a `$scout_structured_output` event, queryable like any event. The channel also requires emit — a dry-run scout has nowhere to record to. Cardinality is the scout's call (one record per run, one per judged entity, ...). Null = channel off. Setting a schema requires skill-authoring authorization (the `llm_skill:write` scope and skill editor access) since the scout reads it verbatim in its prompt; clearing it needs only the config write. Records validate against the schema in force when the run was dispatched.
* @nullable
@@ -2136,6 +2148,11 @@ export interface PatchedSignalScoutConfigUpdateApi {
network_access?: ScoutConfigNetworkAccessEnumApi
/** Exempt this scout from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet. */
auto_pause_exempt?: boolean
+ /**
+ * Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.
+ * @maxItems 10
+ */
+ tags?: string[]
}
/**
@@ -3955,6 +3972,14 @@ export type SignalsReportArtefactsListParams = {
offset?: number
}
+export type SignalsScoutConfigListParams = {
+ /**
+ * Comma-separated tags, e.g. `revenue,on-call`. Returns the scouts carrying at least one of them. Values are normalized the same way stored tags are, so `On Call` matches `on-call`. Omit for the whole fleet.
+ * @minLength 1
+ */
+ tags?: string
+}
+
export type SignalsScoutMembersListParams = {
/**
* Case-insensitive substring filter over member email and first/last name. Use it to narrow a large project's roster to the owner you're trying to match instead of pulling every member.
diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.ts
index 33fae935ef4b..1eeda82d2c6b 100644
--- a/products/signals/frontend/generated/api.ts
+++ b/products/signals/frontend/generated/api.ts
@@ -73,6 +73,7 @@ import type {
SignalsProcessingListParams,
SignalsReportArtefactsListParams,
SignalsReportsListParams,
+ SignalsScoutConfigListParams,
SignalsScoutMembersListParams,
SignalsScoutNotesListParams,
SignalsScoutProjectProfileGetParams,
@@ -698,19 +699,32 @@ export const signalsScoutCreate = async (
})
}
-export const getSignalsScoutConfigListUrl = (projectId: string) => {
- return `/api/projects/${projectId}/signals/scout/configs/`
+export const getSignalsScoutConfigListUrl = (projectId: string, params?: SignalsScoutConfigListParams) => {
+ const normalizedParams = new URLSearchParams()
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? 'null' : String(value))
+ }
+ })
+
+ const stringifiedParams = normalizedParams.toString()
+
+ return stringifiedParams.length > 0
+ ? `/api/projects/${projectId}/signals/scout/configs/?${stringifiedParams}`
+ : `/api/projects/${projectId}/signals/scout/configs/`
}
/**
- * List the per-(team, skill) scout configs for this project. Each row includes its schedule (rolling `run_interval_minutes`, or a project-local `run_cron_schedule` when set), `enabled`, and `emit` posture. A freshly authored scout skill appears here once its config is registered, either explicitly via create or by the coordinator's next tick.
+ * List the per-(team, skill) scout configs for this project. Each row includes its schedule (rolling `run_interval_minutes`, or a project-local `run_cron_schedule` when set), `enabled`, `emit` posture, and `tags`. A freshly authored scout skill appears here once its config is registered, either explicitly via create or by the coordinator's next tick. Pass `tags` to narrow the fleet to the scouts carrying at least one of the given labels.
* @summary List scout configs
*/
export const signalsScoutConfigList = async (
projectId: string,
+ params?: SignalsScoutConfigListParams,
options?: RequestInit
): Promise<SignalScoutConfigApi[]> => {
- return apiMutator<SignalScoutConfigApi[]>(getSignalsScoutConfigListUrl(projectId), {
+ return apiMutator<SignalScoutConfigApi[]>(getSignalsScoutConfigListUrl(projectId, params), {
...options,
method: 'GET',
})
diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.ts
index ead0de3323fb..be45565255c2 100644
--- a/products/signals/frontend/generated/api.zod.ts
+++ b/products/signals/frontend/generated/api.zod.ts
@@ -336,6 +336,8 @@ export const signalsScoutCreateBodyConfigOneOutputDestinationsOneSlackOneChannel
export const signalsScoutCreateBodyConfigOneRunCronScheduleMax = 100
+export const signalsScoutCreateBodyConfigOneTagsMax = 10
+
export const SignalsScoutCreateBody = /* @__PURE__ */ zod
.object({
name: zod
@@ -438,6 +440,13 @@ export const SignalsScoutCreateBody = /* @__PURE__ */ zod
.describe(
"Optional five-field cron expression, e.g. '30 9 \* \* \*' (daily at 09:30), '0 9,17 \* \* \*' (twice daily), or '0 9 \* \* 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
),
+ tags: zod
+ .array(zod.string())
+ .max(signalsScoutCreateBodyConfigOneTagsMax)
+ .optional()
+ .describe(
+ 'Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.'
+ ),
structured_output_schema: zod
.record(zod.string(), zod.unknown())
.nullish()
@@ -464,6 +473,8 @@ export const signalsScoutConfigCreateBodyOutputDestinationsOneSlackOneChannelMax
export const signalsScoutConfigCreateBodyRunCronScheduleMax = 100
+export const signalsScoutConfigCreateBodyTagsMax = 10
+
export const signalsScoutConfigCreateBodySkillNameMax = 200
export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod
@@ -529,6 +540,13 @@ export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod
.describe(
"Optional five-field cron expression, e.g. '30 9 \* \* \*' (daily at 09:30), '0 9,17 \* \* \*' (twice daily), or '0 9 \* \* 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
),
+ tags: zod
+ .array(zod.string())
+ .max(signalsScoutConfigCreateBodyTagsMax)
+ .optional()
+ .describe(
+ 'Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.'
+ ),
structured_output_schema: zod
.record(zod.string(), zod.unknown())
.nullish()
@@ -557,6 +575,8 @@ export const signalsScoutConfigUpdateBodyRunCronScheduleMax = 100
export const signalsScoutConfigUpdateBodyOutputDestinationsOneSlackOneChannelMax = 255
+export const signalsScoutConfigUpdateBodyTagsMax = 10
+
export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod
.object({
enabled: zod
@@ -633,6 +653,13 @@ export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod
.describe(
'Exempt this scout from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet.'
),
+ tags: zod
+ .array(zod.string())
+ .max(signalsScoutConfigUpdateBodyTagsMax)
+ .optional()
+ .describe(
+ 'Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.'
+ ),
})
.describe('Editable schedule, enablement, and emit posture for one scout config.')
diff --git a/products/signals/skills/authoring-scouts/SKILL.md b/products/signals/skills/authoring-scouts/SKILL.md
index a3c997871e82..519b6adf477f 100644
--- a/products/signals/skills/authoring-scouts/SKILL.md
+++ b/products/signals/skills/authoring-scouts/SKILL.md
@@ -119,6 +119,11 @@ For an **existing scout**, tune with `posthog:scout-config-update` (find the `id
A scout whose reports nobody acts on is warned and then paused automatically (`pause_reason=ignored`) — every run costs a sandbox agent, so a scout producing output no human consumes shouldn't keep running forever. A scout that is merely quiet is only flagged (`pause_reason=no_output`, a warning that never advances to a pause), since a watch scout's silence can be its job.
`-config-list` shows the warning as `status=pending_pause` and the pause as `status=paused_by_system`; setting `enabled=true` again resumes the scout, and marks it exempt so the sweep never overrules a person twice.
Set `auto_pause_exempt=true` up front for a watchdog scout whose whole job is to stay quiet, so it never even picks up the quiet flag.
+- `tags` — free-form labels grouping the fleet, e.g. `["revenue", "on-call"]`. Up to 10 per scout, normalized to lowercase kebab-case (`On Call` → `on-call`) and deduped.
+ Set them at create time: a scout that lands already grouped saves a follow-up edit, and the desktop app's scout list filters on them.
+ Prefer a tag that already exists on the fleet (`-config-list` shows every scout's tags) over minting a near-duplicate — `revenue` and `revenue-analytics` fragment the same group.
+ A write **replaces** the set, so send the full desired list, not just the additions.
+ Filter the roster with `-config-list`'s `tags` parameter (comma-separated, matches a scout carrying **any** of them).
- `structured_output_schema` — defaults to null (channel off).
Set a JSON Schema (draft 2020-12, root `"type": "object"`) describing **one** structured record and the scout gains a third output channel next to reports: each run is shown the schema and told to submit conforming records via `scout-record-output` (one per run, or one per judged entity — the skill body decides the cardinality and when to record).
Records are validated server-side against the schema (all-or-nothing per call) and recorded in the project as `$scout_structured_output` events with scalar payload keys flattened to `output_<key>` properties — so a judging/scoring scout's series is chartable in insights directly, and past records are queryable like any events (filter on `subject` or `run_id`, break down on `output_<key>`).
diff --git a/products/signals/skills/exploring-scouts/SKILL.md b/products/signals/skills/exploring-scouts/SKILL.md
index c4c3506aac51..0bd51409e6e8 100644
--- a/products/signals/skills/exploring-scouts/SKILL.md
+++ b/products/signals/skills/exploring-scouts/SKILL.md
@@ -35,14 +35,16 @@ For "what kind of run was this?" questions — did it author a self-improvement
There are six things you can observe about the fleet, each with its own tool:
-| What you want to know | Tool | What it tells you |
-| -------------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------- |
-| Which scouts run, how often, in what posture | `scout-config-list` | One row per scout: schedule, `enabled`, `status` / `pause_reason`, `emit`, `last_run_at`, `description` |
-| What the scouts actually did, run by run | `scout-runs-list` / `-retrieve` | Per-run status, timing, end-of-run summary, `emitted_report_ids` / `edited_report_ids`, deep-link |
-| What the fleet has learned across runs | `scout-scratchpad-search` | Durable per-team memory (baselines, noise, allowlists) |
-| What the team has told the fleet | `scout-notes-list` | Steering notes humans/agents left for scouts (per-scout or fleet-wide, newest first) |
-| Which reports a run wrote or edited | the run row itself | `emitted_report_ids` / `edited_report_ids` — resolve each id via `inbox-reports-retrieve` |
-| What the scouts surfaced to the user | `inbox-reports-list` | The scout-written reports, as the user sees them (filter `source_product: "signals_scout"`) |
+| What you want to know | Tool | What it tells you |
+| -------------------------------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------- |
+| Which scouts run, how often, in what posture | `scout-config-list` | One row per scout: schedule, `enabled`, `status` / `pause_reason`, `emit`, `last_run_at`, `description`, `tags` |
+| What the scouts actually did, run by run | `scout-runs-list` / `-retrieve` | Per-run status, timing, end-of-run summary, `emitted_report_ids` / `edited_report_ids`, deep-link |
+| What the fleet has learned across runs | `scout-scratchpad-search` | Durable per-team memory (baselines, noise, allowlists) |
+| What the team has told the fleet | `scout-notes-list` | Steering notes humans/agents left for scouts (per-scout or fleet-wide, newest first) |
+| Which reports a run wrote or edited | the run row itself | `emitted_report_ids` / `edited_report_ids` — resolve each id via `inbox-reports-retrieve` |
+| What the scouts surfaced to the user | `inbox-reports-list` | The scout-written reports, as the user sees them (filter `source_product: "signals_scout"`) |
+
+`scout-config-list` takes a `tags` parameter (comma-separated) to narrow the roster to the scouts carrying any of the given labels — useful on a large fleet when the question is scoped to one area, e.g. `tags=revenue`.
The orienting tool is `scout-project-profile-get` — the deterministic snapshot of "what's true about this project" that every scout cold-starts from.
When a scout found nothing, this is usually why.
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 3e9b4b263631..fc255888962a 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -56366,6 +56366,11 @@ export namespace Schemas {
network_access?: ScoutConfigNetworkAccessEnum;
/** Exempt this scout from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet. */
auto_pause_exempt?: boolean;
+ /**
+ * Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.
+ * @maxItems 10
+ */
+ tags?: string[];
}
export interface PatchedSignalSourceConfig {
@@ -66438,6 +66443,8 @@ export namespace Schemas {
readonly status_changed_at: string | null;
/** Whether this scout is exempt from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet. Also set automatically when someone re-enables a scout the inactivity sweep paused, so the sweep never overrules a person twice. */
readonly auto_pause_exempt: boolean;
+ /** Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter. */
+ tags?: string[];
readonly created_at: string;
}
@@ -66479,6 +66486,11 @@ export namespace Schemas {
* @nullable
*/
run_cron_schedule?: string | null;
+ /**
+ * Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.
+ * @maxItems 10
+ */
+ tags?: string[];
/**
* Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces via `scout-record-output` — e.g. a per-report quality judgment (`{"type": "object", "properties": {"verdict": {"enum": ["good", "bad", "unsure"]}, "reason": {"type": "string"}}, "required": ["verdict", "reason"]}`). The root must be `"type": "object"`. Setting a schema turns the structured-output channel on: the run prompt renders the schema and every submitted record is validated against it and recorded in the project as a `$scout_structured_output` event, queryable like any event. The channel also requires emit — a dry-run scout has nowhere to record to. Cardinality is the scout's call (one record per run, one per judged entity, ...). Null = channel off. Setting a schema requires skill-authoring authorization (the `llm_skill:write` scope and skill editor access) since the scout reads it verbatim in its prompt; clearing it needs only the config write. Records validate against the schema in force when the run was dispatched.
* @nullable
@@ -66526,6 +66538,11 @@ export namespace Schemas {
* @nullable
*/
run_cron_schedule?: string | null;
+ /**
+ * Free-form labels for grouping the fleet, e.g. `["revenue", "on-call"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.
+ * @maxItems 10
+ */
+ tags?: string[];
/**
* Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces via `scout-record-output` — e.g. a per-report quality judgment (`{"type": "object", "properties": {"verdict": {"enum": ["good", "bad", "unsure"]}, "reason": {"type": "string"}}, "required": ["verdict", "reason"]}`). The root must be `"type": "object"`. Setting a schema turns the structured-output channel on: the run prompt renders the schema and every submitted record is validated against it and recorded in the project as a `$scout_structured_output` event, queryable like any event. The channel also requires emit — a dry-run scout has nowhere to record to. Cardinality is the scout's call (one record per run, one per judged entity, ...). Null = channel off. Setting a schema requires skill-authoring authorization (the `llm_skill:write` scope and skill editor access) since the scout reads it verbatim in its prompt; clearing it needs only the config write. Records validate against the schema in force when the run was dispatched.
* @nullable
@@ -84995,6 +85012,14 @@ export namespace Schemas {
offset?: number;
};
+ export type SignalsScoutConfigListParams = {
+ /**
+ * Comma-separated tags, e.g. `revenue,on-call`. Returns the scouts carrying at least one of them. Values are normalized the same way stored tags are, so `On Call` matches `on-call`. Omit for the whole fleet.
+ * @minLength 1
+ */
+ tags?: string;
+ };
+
export type SignalsScoutMembersListParams = {
/**
* Case-insensitive substring filter over member email and first/last name. Use it to narrow a large project's roster to the owner you're trying to match instead of pulling every member.
diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.ts
index 846a26024df1..c243a8d495ae 100644
--- a/services/mcp/src/generated/signals/api.ts
+++ b/services/mcp/src/generated/signals/api.ts
@@ -426,6 +426,8 @@ export const signalsScoutCreateBodyConfigOneOutputDestinationsOneSlackOneChannel
export const signalsScoutCreateBodyConfigOneRunCronScheduleMax = 100
+export const signalsScoutCreateBodyConfigOneTagsMax = 10
+
export const SignalsScoutCreateBody = /* @__PURE__ */ zod
.object({
name: zod
@@ -528,6 +530,13 @@ export const SignalsScoutCreateBody = /* @__PURE__ */ zod
.describe(
"Optional five-field cron expression, e.g. '30 9 \* \* \*' (daily at 09:30), '0 9,17 \* \* \*' (twice daily), or '0 9 \* \* 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
),
+ tags: zod
+ .array(zod.string())
+ .max(signalsScoutCreateBodyConfigOneTagsMax)
+ .optional()
+ .describe(
+ 'Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.'
+ ),
structured_output_schema: zod
.record(zod.string(), zod.unknown())
.nullish()
@@ -544,7 +553,7 @@ export const SignalsScoutCreateBody = /* @__PURE__ */ zod
.describe('Create a runnable custom scout and its config in one atomic request.')
/**
- * List the per-(team, skill) scout configs for this project. Each row includes its schedule (rolling `run_interval_minutes`, or a project-local `run_cron_schedule` when set), `enabled`, and `emit` posture. A freshly authored scout skill appears here once its config is registered, either explicitly via create or by the coordinator's next tick.
+ * List the per-(team, skill) scout configs for this project. Each row includes its schedule (rolling `run_interval_minutes`, or a project-local `run_cron_schedule` when set), `enabled`, `emit` posture, and `tags`. A freshly authored scout skill appears here once its config is registered, either explicitly via create or by the coordinator's next tick. Pass `tags` to narrow the fleet to the scouts carrying at least one of the given labels.
* @summary List scout configs
*/
export const SignalsScoutConfigListParams = /* @__PURE__ */ zod.object({
@@ -555,6 +564,16 @@ export const SignalsScoutConfigListParams = /* @__PURE__ */ zod.object({
),
})
+export const SignalsScoutConfigListQueryParams = /* @__PURE__ */ zod.object({
+ tags: zod
+ .string()
+ .min(1)
+ .optional()
+ .describe(
+ 'Comma-separated tags, e.g. `revenue,on-call`. Returns the scouts carrying at least one of them. Values are normalized the same way stored tags are, so `On Call` matches `on-call`. Omit for the whole fleet.'
+ ),
+})
+
/**
* Register the config for a `signals-scout-*` skill immediately, without waiting for the coordinator to auto-register it. The same call can optionally set `run_interval_minutes`, a cron `run_cron_schedule`, `enabled`, `emit`, `network_access`, and output destinations. The skill must already exist on this project. Upsert: if a config already exists for the skill, the provided fields are applied to it.
* @summary Create a scout config
@@ -574,6 +593,8 @@ export const signalsScoutConfigCreateBodyOutputDestinationsOneSlackOneChannelMax
export const signalsScoutConfigCreateBodyRunCronScheduleMax = 100
+export const signalsScoutConfigCreateBodyTagsMax = 10
+
export const signalsScoutConfigCreateBodySkillNameMax = 200
export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod
@@ -639,6 +660,13 @@ export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod
.describe(
"Optional five-field cron expression, e.g. '30 9 \* \* \*' (daily at 09:30), '0 9,17 \* \* \*' (twice daily), or '0 9 \* \* 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
),
+ tags: zod
+ .array(zod.string())
+ .max(signalsScoutConfigCreateBodyTagsMax)
+ .optional()
+ .describe(
+ 'Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.'
+ ),
structured_output_schema: zod
.record(zod.string(), zod.unknown())
.nullish()
@@ -676,6 +704,8 @@ export const signalsScoutConfigUpdateBodyRunCronScheduleMax = 100
export const signalsScoutConfigUpdateBodyOutputDestinationsOneSlackOneChannelMax = 255
+export const signalsScoutConfigUpdateBodyTagsMax = 10
+
export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod
.object({
enabled: zod
@@ -752,6 +782,13 @@ export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod
.describe(
'Exempt this scout from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet.'
),
+ tags: zod
+ .array(zod.string())
+ .max(signalsScoutConfigUpdateBodyTagsMax)
+ .optional()
+ .describe(
+ 'Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.'
+ ),
})
.describe('Editable schedule, enablement, and emit posture for one scout config.')
diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.ts
index 128c87785f5c..bb7054f5f0bb 100644
--- a/services/mcp/src/tools/generated/signals.ts
+++ b/services/mcp/src/tools/generated/signals.ts
@@ -20,6 +20,7 @@ import {
SignalsReportsStateCreateParams,
SignalsScoutConfigCreateBody,
SignalsScoutConfigDestroyParams,
+ SignalsScoutConfigListQueryParams,
SignalsScoutConfigRunParams,
SignalsScoutConfigUpdateBody,
SignalsScoutConfigUpdateParams,
@@ -538,6 +539,9 @@ const scoutConfigCreate = (): ToolBase<typeof ScoutConfigCreateSchema, Schemas.S
if (params.run_cron_schedule !== undefined) {
body['run_cron_schedule'] = params.run_cron_schedule
}
+ if (params.tags !== undefined) {
+ body['tags'] = params.tags
+ }
if (params.structured_output_schema !== undefined) {
body['structured_output_schema'] = params.structured_output_schema
}
@@ -568,17 +572,19 @@ const scoutConfigDelete = (): ToolBase<typeof ScoutConfigDeleteSchema, unknown>
},
})
-const ScoutConfigListSchema = z.object({})
+const ScoutConfigListSchema = SignalsScoutConfigListQueryParams
const scoutConfigList = (): ToolBase<typeof ScoutConfigListSchema, WithPostHogUrl<Schemas.SignalScoutConfig[]>> => ({
name: 'scout-config-list',
schema: ScoutConfigListSchema,
- // eslint-disable-next-line no-unused-vars
handler: async (context: Context, params: z.infer<typeof ScoutConfigListSchema>) => {
const projectId = await context.stateManager.getProjectId()
const result = await context.api.request<Schemas.SignalScoutConfig[]>({
method: 'GET',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/`,
+ query: {
+ tags: params.tags,
+ },
})
return await withPostHogUrl(context, result, '/inbox')
},
@@ -634,6 +640,9 @@ const scoutConfigUpdate = (): ToolBase<typeof ScoutConfigUpdateSchema, WithPostH
if (params.auto_pause_exempt !== undefined) {
body['auto_pause_exempt'] = params.auto_pause_exempt
}
+ if (params.tags !== undefined) {
+ body['tags'] = params.tags
+ }
const result = await context.api.request<Schemas.SignalScoutConfig>({
method: 'PATCH',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/`,
@@ -1215,6 +1224,9 @@ const signalsScoutConfigCreate = (): ToolBase<typeof SignalsScoutConfigCreateSch
if (params.run_cron_schedule !== undefined) {
body['run_cron_schedule'] = params.run_cron_schedule
}
+ if (params.tags !== undefined) {
+ body['tags'] = params.tags
+ }
if (params.structured_output_schema !== undefined) {
body['structured_output_schema'] = params.structured_output_schema
}
@@ -1245,7 +1257,7 @@ const signalsScoutConfigDelete = (): ToolBase<typeof SignalsScoutConfigDeleteSch
},
})
-const SignalsScoutConfigListSchema = z.object({})
+const SignalsScoutConfigListSchema = SignalsScoutConfigListQueryParams
const signalsScoutConfigList = (): ToolBase<
typeof SignalsScoutConfigListSchema,
@@ -1253,12 +1265,14 @@ const signalsScoutConfigList = (): ToolBase<
> => ({
name: 'signals-scout-config-list',
schema: SignalsScoutConfigListSchema,
- // eslint-disable-next-line no-unused-vars
handler: async (context: Context, params: z.infer<typeof SignalsScoutConfigListSchema>) => {
const projectId = await context.stateManager.getProjectId()
const result = await context.api.request<Schemas.SignalScoutConfig[]>({
method: 'GET',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/`,
+ query: {
+ tags: params.tags,
+ },
})
return await withPostHogUrl(context, result, '/inbox')
},
@@ -1320,6 +1334,9 @@ const signalsScoutConfigUpdate = (): ToolBase<
if (params.auto_pause_exempt !== undefined) {
body['auto_pause_exempt'] = params.auto_pause_exempt
}
+ if (params.tags !== undefined) {
+ body['tags'] = params.tags
+ }
const result = await context.api.request<Schemas.SignalScoutConfig>({
method: 'PATCH',
path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/`,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json
index aa47d525e1f7..660662320f78 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json
@@ -93,6 +93,14 @@
}
],
"description": "Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces via `scout-record-output` — e.g. a per-report quality judgment (`{\"type\": \"object\", \"properties\": {\"verdict\": {\"enum\": [\"good\", \"bad\", \"unsure\"]}, \"reason\": {\"type\": \"string\"}}, \"required\": [\"verdict\", \"reason\"]}`). The root must be `\"type\": \"object\"`. Setting a schema turns the structured-output channel on: the run prompt renders the schema and every submitted record is validated against it and recorded in the project as a `$scout_structured_output` event, queryable like any event. The channel also requires emit — a dry-run scout has nowhere to record to. Cardinality is the scout's call (one record per run, one per judged entity, ...). Null = channel off. Setting a schema requires skill-authoring authorization (the `llm_skill:write` scope and skill editor access) since the scout reads it verbatim in its prompt; clearing it needs only the config write. Records validate against the schema in force when the run was dispatched."
+ },
+ "tags": {
+ "description": "Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.",
+ "items": {
+ "type": "string"
+ },
+ "maxItems": 10,
+ "type": "array"
}
},
"required": ["skill_name"],
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-list.json
index 7b7ea9186078..2515168be9a1 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-list.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-list.json
@@ -1,5 +1,11 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "properties": {},
+ "properties": {
+ "tags": {
+ "description": "Comma-separated tags, e.g. `revenue,on-call`. Returns the scouts carrying at least one of them. Values are normalized the same way stored tags are, so `On Call` matches `on-call`. Omit for the whole fleet.",
+ "minLength": 1,
+ "type": "string"
+ }
+ },
"type": "object"
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json
index 8036e26580f6..ad3365c1ae40 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json
@@ -91,6 +91,14 @@
}
],
"description": "Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces via `scout-record-output` — e.g. a per-report quality judgment (`{\"type\": \"object\", \"properties\": {\"verdict\": {\"enum\": [\"good\", \"bad\", \"unsure\"]}, \"reason\": {\"type\": \"string\"}}, \"required\": [\"verdict\", \"reason\"]}`). The root must be `\"type\": \"object\"`. Setting a schema turns the structured-output channel on: the run prompt renders the schema and every submitted record is validated against it and recorded in the project as a `$scout_structured_output` event, queryable like any event. The channel also requires emit — a dry-run scout has nowhere to record to. Cardinality is the scout's call (one record per run, one per judged entity, ...). Null = channel off. Setting a schema requires skill-authoring authorization (the `llm_skill:write` scope and skill editor access) since the scout reads it verbatim in its prompt; clearing it needs only the config write. Records validate against the schema in force when the run was dispatched."
+ },
+ "tags": {
+ "description": "Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.",
+ "items": {
+ "type": "string"
+ },
+ "maxItems": 10,
+ "type": "array"
}
},
"required": ["id"],
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create-prepare.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create-prepare.json
index a83b9ef3e54e..b85b5cdb576d 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create-prepare.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create-prepare.json
@@ -95,6 +95,14 @@
}
],
"description": "Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces via `scout-record-output` — e.g. a per-report quality judgment (`{\"type\": \"object\", \"properties\": {\"verdict\": {\"enum\": [\"good\", \"bad\", \"unsure\"]}, \"reason\": {\"type\": \"string\"}}, \"required\": [\"verdict\", \"reason\"]}`). The root must be `\"type\": \"object\"`. Setting a schema turns the structured-output channel on: the run prompt renders the schema and every submitted record is validated against it and recorded in the project as a `$scout_structured_output` event, queryable like any event. The channel also requires emit — a dry-run scout has nowhere to record to. Cardinality is the scout's call (one record per run, one per judged entity, ...). Null = channel off. Setting a schema requires skill-authoring authorization (the `llm_skill:write` scope and skill editor access) since the scout reads it verbatim in its prompt; clearing it needs only the config write. Records validate against the schema in force when the run was dispatched."
+ },
+ "tags": {
+ "description": "Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.",
+ "items": {
+ "type": "string"
+ },
+ "maxItems": 10,
+ "type": "array"
}
},
"type": "object"
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json
index aa47d525e1f7..660662320f78 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json
@@ -93,6 +93,14 @@
}
],
"description": "Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces via `scout-record-output` — e.g. a per-report quality judgment (`{\"type\": \"object\", \"properties\": {\"verdict\": {\"enum\": [\"good\", \"bad\", \"unsure\"]}, \"reason\": {\"type\": \"string\"}}, \"required\": [\"verdict\", \"reason\"]}`). The root must be `\"type\": \"object\"`. Setting a schema turns the structured-output channel on: the run prompt renders the schema and every submitted record is validated against it and recorded in the project as a `$scout_structured_output` event, queryable like any event. The channel also requires emit — a dry-run scout has nowhere to record to. Cardinality is the scout's call (one record per run, one per judged entity, ...). Null = channel off. Setting a schema requires skill-authoring authorization (the `llm_skill:write` scope and skill editor access) since the scout reads it verbatim in its prompt; clearing it needs only the config write. Records validate against the schema in force when the run was dispatched."
+ },
+ "tags": {
+ "description": "Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.",
+ "items": {
+ "type": "string"
+ },
+ "maxItems": 10,
+ "type": "array"
}
},
"required": ["skill_name"],
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-list.json
index 7b7ea9186078..2515168be9a1 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-list.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-list.json
@@ -1,5 +1,11 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "properties": {},
+ "properties": {
+ "tags": {
+ "description": "Comma-separated tags, e.g. `revenue,on-call`. Returns the scouts carrying at least one of them. Values are normalized the same way stored tags are, so `On Call` matches `on-call`. Omit for the whole fleet.",
+ "minLength": 1,
+ "type": "string"
+ }
+ },
"type": "object"
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json
index 8036e26580f6..ad3365c1ae40 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json
@@ -91,6 +91,14 @@
}
],
"description": "Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces via `scout-record-output` — e.g. a per-report quality judgment (`{\"type\": \"object\", \"properties\": {\"verdict\": {\"enum\": [\"good\", \"bad\", \"unsure\"]}, \"reason\": {\"type\": \"string\"}}, \"required\": [\"verdict\", \"reason\"]}`). The root must be `\"type\": \"object\"`. Setting a schema turns the structured-output channel on: the run prompt renders the schema and every submitted record is validated against it and recorded in the project as a `$scout_structured_output` event, queryable like any event. The channel also requires emit — a dry-run scout has nowhere to record to. Cardinality is the scout's call (one record per run, one per judged entity, ...). Null = channel off. Setting a schema requires skill-authoring authorization (the `llm_skill:write` scope and skill editor access) since the scout reads it verbatim in its prompt; clearing it needs only the config write. Records validate against the schema in force when the run was dispatched."
+ },
+ "tags": {
+ "description": "Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.",
+ "items": {
+ "type": "string"
+ },
+ "maxItems": 10,
+ "type": "array"
}
},
"required": ["id"],