Skip to content

feat(seer): Add LLM context to widget builder page#112703

Open
Mihir-Mavalankar wants to merge 1 commit intomasterfrom
mihir-mavalankar/feat/widget-builder-llm-context
Open

feat(seer): Add LLM context to widget builder page#112703
Mihir-Mavalankar wants to merge 1 commit intomasterfrom
mihir-mavalankar/feat/widget-builder-llm-context

Conversation

@Mihir-Mavalankar
Copy link
Copy Markdown
Contributor

  • Register a 'widget-builder' node in the LLM context tree so the Seer Explorer agent understands what widget the user is configuring. Pushes builder state (dataset, displayType, visualize, fields, query, sort, thresholds, legendAlias) with readable condition transforms.

  • Also adds the widget builder routes to STRUCTURED_CONTEXT_ROUTES so structured context is sent instead of ASCII when the builder is open.

@Mihir-Mavalankar Mihir-Mavalankar self-assigned this Apr 10, 2026
@Mihir-Mavalankar Mihir-Mavalankar requested review from a team as code owners April 10, 2026 18:13
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 10, 2026
@Mihir-Mavalankar Mihir-Mavalankar force-pushed the mihir-mavalankar/feat/widget-builder-llm-context branch from 0937545 to ec1ddd1 Compare April 10, 2026 18:16
Comment thread static/app/views/dashboards/widgetBuilder/components/newWidgetBuilder.tsx Outdated
Comment thread static/app/views/seerExplorer/hooks/useSeerExplorer.tsx
Copy link
Copy Markdown
Member

@gggritso gggritso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense overall but the "dummy" context is very strange. This would be tidier if you set the LLM context in the UI component that renders the widget builder, which will make test setup easier, too, since that code already exists

Comment on lines +69 to +83
useLLMContext({
contextHint:
'Sentry widget builder. The user is configuring a dashboard widget. visualize is the y-axis metrics (timeseries) or the aggregate (big number/table). fields are group-by columns (timeseries) or visible columns (table). query filters the data and sort controls ordering.',
mode: isEditing ? 'editing' : 'creating',
title: state.title,
description: state.description,
dataset: state.dataset,
displayType: state.displayType,
visualize: state.yAxis?.map(generateFieldAsString),
fields: state.fields?.map(generateFieldAsString),
query: state.query?.map(readableConditions),
sort: state.sort?.map(s => (s.kind === 'desc' ? `-${s.field}` : s.field)),
thresholds: state.thresholds,
legendAlias: state.legendAlias,
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this out of the custom context and put it directly into the UI component that renders the builder? It's a very unusual pattern to have a loose <WidgetBuilderLLMContext /> component. The name implies that it's a context provider, which it is not, and the fact that is has no children makes it even more confusing. All the state you need is available via hooks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-worked it, lmk if that looks good.

Register a 'widget-builder' node in the LLM context tree so the Seer
Explorer agent understands what widget the user is configuring. Pushes
builder state (dataset, displayType, visualize, fields, query, sort,
thresholds, legendAlias) with readable condition transforms.

Also adds the widget builder routes to STRUCTURED_CONTEXT_ROUTES so
structured context is sent instead of ASCII when the builder is open.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants