Skip to content

feat(agents): Update JavaScript onboarding docs#106361

Merged
priscilawebdev merged 14 commits intomasterfrom
priscila/feat/update-ai-agent-onboarding-for-javascript-platforms
Jan 20, 2026
Merged

feat(agents): Update JavaScript onboarding docs#106361
priscilawebdev merged 14 commits intomasterfrom
priscila/feat/update-ai-agent-onboarding-for-javascript-platforms

Conversation

@priscilawebdev
Copy link
Member

@priscilawebdev priscilawebdev commented Jan 15, 2026

Problem

Node.js–based platforms
The instructions currently tell users to add integrations explicitly. However, these integrations are enabled by default, and manual addition is only required when customization is needed.

Browser-based platforms
The instructions are incorrect because integrations are not exposed in browser environments. To capture AI spans, users must manually instrument their applications—either by creating custom spans or by using Sentry’s helper utilities.

LLM instructions
The instructions are incorrect for the same reasons outlined in points 1 and 2 above.

Solution

This PR updates the documentation to reflect the correct setup and instrumentation requirements for each platform.

Note:

I could, but decided against adding the "Copy for LLm" button to the JavaScript instructions because of the verify section.

closes https://linear.app/getsentry/issue/TET-1698/js-ai-integrations-are-autoenabled

@linear
Copy link

linear bot commented Jan 15, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 15, 2026
@priscilawebdev
Copy link
Member Author

Example Before/After in Node:

Before:

image

After:
image

@priscilawebdev
Copy link
Member Author

Example Before/After in React:

Before:
image

After:

image

Comment on lines -234 to -244
? [
{label: 'OpenAI SDK', value: 'openai'},
{label: 'OpenAI Agents SDK', value: 'openai_agents'},
{label: 'Anthropic SDK', value: 'anthropic'},
{label: 'Google Gen AI SDK', value: 'google_genai'},
{label: 'LangChain', value: 'langchain'},
{label: 'LangGraph', value: 'langgraph'},
{label: 'LiteLLM', value: 'litellm'},
{label: 'Pydantic AI', value: 'pydantic_ai'},
{label: 'Other', value: 'manual'},
]
Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this change could go to other PR, but this inspired me to create ENUMS and constants, so I just updated everything here too.

@priscilawebdev priscilawebdev marked this pull request as ready for review January 15, 2026 11:49
@priscilawebdev priscilawebdev requested a review from a team as a code owner January 15, 2026 11:49
Copy link
Member

@ArthurKnaus ArthurKnaus left a comment

Choose a reason for hiding this comment

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

Looks good so far. I am just being a bit defensive as we had so many problems with the onboarding in the past.

Comment on lines +686 to +692
? tct(
'Import and initialize the Sentry SDK - the [integration] will be enabled automatically:',
{
integration:
AGENT_INTEGRATION_LABELS[selected as AgentIntegration] ?? selected,
}
)
Copy link
Member

Choose a reason for hiding this comment

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

There are edge cases to this. E.g. for next-js if you use the edge runtime, you have to use do some manual steps as we cannot auto-enable afaik.
cc @RulaKhaled

Copy link
Member

Choose a reason for hiding this comment

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

Also for meta frameworks the situation is in general a bit more complicated. E.g. we need to tell them to do it in the BE Sentry init call. And some might be browser based, e.g. last time I checked tanstackstart is a SPA per default and would need to be configured like a browser platform.

again @RulaKhaled pls correct me if I am wrong

Copy link
Member Author

Choose a reason for hiding this comment

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

There are edge cases to this. E.g. for next-js if you use the edge runtime, you have to use do some manual steps as we cannot auto-enable afaik. cc @RulaKhaled

oh this is true. good catch! I saw this info when restructuring the docs here https://github.com/getsentry/sentry-docs/blob/20087dbc1ac538e977a13076fdce1126a715b2b5/docs/platforms/javascript/common/configuration/integrations/anthropic.mdx (Funny that this was present just for Anthropic). I will address this. thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

Also for meta frameworks the situation is in general a bit more complicated. E.g. we need to tell them to do it in the BE Sentry init call. And some might be browser based, e.g. last time I checked tanstackstart is a SPA per default and would need to be configured like a browser platform.

again @RulaKhaled pls correct me if I am wrong

That’s a very good point, and I wasn’t entirely sure why only the server-side is shown in the app onboarding. I assumed it might have been an intentional choice to avoid presenting something too extensive. I’ll think about how we can present this more clearly, and we can likely address it incrementally across multiple PRs.

Copy link
Member

@ArthurKnaus ArthurKnaus Jan 19, 2026

Choose a reason for hiding this comment

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

yeah, in the past the agent monitoring was only available on the BE

Comment on lines +720 to +729
content: isNodeOrMetaPlatform
? nonManualContent
: [
...nonManualContent,
...getBrowserAgentMonitoringOnboardingConfiguration({
integration: selected,
packageName,
importMode,
}),
],
Copy link
Member

@ArthurKnaus ArthurKnaus Jan 16, 2026

Choose a reason for hiding this comment

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

Checking for isNodeOrMetaPlatform all the time and then conditionally show different content all the time requires quite a bit of mental acrobatics. Couldn't we simplify this by splitting it into getNodeAgentMonitoringOnboarding and getBrowserAgentMonitoringOnboarding?
(+ maybe something extra for fullstack / meta?)

Copy link
Member Author

Choose a reason for hiding this comment

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

I had a similar concern, but decided to proceed with this approach for now since it’s simpler, and we can improve it in a follow-up. At the moment, the onboarding documentation is misleading, and it’s important that we fix it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines +1 to +12
export enum AgentIntegration {
OPENAI = 'openai',
OPENAI_AGENTS = 'openai_agents',
ANTHROPIC = 'anthropic',
GOOGLE_GENAI = 'google_genai',
LANGCHAIN = 'langchain',
LANGGRAPH = 'langgraph',
LITTELLM = 'litellm',
PYDANTIC_AI = 'pydantic_ai',
VERCEL_AI = 'vercel_ai',
MANUAL = 'manual',
}
Copy link
Member

Choose a reason for hiding this comment

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

nice! 🙌

@priscilawebdev priscilawebdev merged commit acc6e68 into master Jan 20, 2026
53 checks passed
@priscilawebdev priscilawebdev deleted the priscila/feat/update-ai-agent-onboarding-for-javascript-platforms branch January 20, 2026 07:14
@github-actions github-actions bot locked and limited conversation to collaborators Feb 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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

Comments