sentry-setup-ai-monitoring▌
getsentry/sentry-agent-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Automatically detect and configure Sentry monitoring for LLM calls, agents, and AI SDKs.
- ›Auto-detects installed AI packages (OpenAI, Anthropic, LangChain, Google GenAI, Vercel AI, Pydantic AI, and others) and enables appropriate integrations with zero manual registration in Python
- ›Requires tracing enabled ( tracesSampleRate > 0 ) and supports manual span instrumentation via gen_ai.* operation types for unsupported SDKs
- ›Captures model, token counts, and latency by default; prompt and
Setup Sentry AI Agent Monitoring
Configure Sentry to track LLM calls, agent executions, tool usage, and token consumption.
Invoke This Skill When
- User asks to "monitor AI/LLM calls" or "track OpenAI/Anthropic usage"
- User wants "AI observability" or "agent monitoring"
- User asks about token usage, model latency, or AI costs
Important: The SDK versions, API names, and code samples below are examples. Always verify against docs.sentry.io before implementing, as APIs and minimum versions may have changed.
Prerequisites
AI monitoring requires tracing enabled (tracesSampleRate > 0).
Data Capture Warning
Prompt and output recording captures user content that is likely PII. Before enabling recordInputs/recordOutputs (JS) or include_prompts/send_default_pii (Python), confirm:
- The application's privacy policy permits capturing user prompts and model responses
- Captured data complies with applicable regulations (GDPR, CCPA, etc.)
- Sentry data retention settings are appropriate for the sensitivity of the data
Ask the user whether they want prompt/output capture enabled. Do not enable it by default — configure it only when explicitly requested or confirmed. Use tracesSampleRate: 1.0 only in development; in production, use a lower value or a tracesSampler function.
Detection First
Always detect installed AI SDKs before configuring:
# JavaScript
grep -E '"(openai|@anthropic-ai/sdk|ai|@langchain|@google/genai)"' package.json
# Python
grep -E '(openai|anthropic|langchain|huggingface)' requirements.txt pyproject.toml 2>/dev/null
Supported SDKs
JavaScript
| Package | Integration | Min Sentry SDK | Auto? |
|---|---|---|---|
openai |
openAIIntegration() |
10.28.0 | Yes |
@anthropic-ai/sdk |
anthropicAIIntegration() |
10.28.0 | Yes |
ai (Vercel) |
vercelAIIntegration() |
10.6.0 | Yes* |
@langchain/* |
langChainIntegration() |
10.28.0 | Yes |
@langchain/langgraph |
langGraphIntegration() |
10.28.0 | Yes |
@google/genai |
googleGenAIIntegration() |
10.28.0 | Yes |
*Vercel AI: 10.6.0+ for Node.js, Cloudflare Workers, Vercel Edge Functions, Bun. 10.12.0+ for Deno. Requires experimental_telemetry per-call.
Python
Integrations auto-enable when the AI package is installed — no explicit registration needed:
| Package | Auto? | Notes |
|---|---|---|
openai |
Yes | Includes OpenAI Agents SDK |
anthropic |
Yes | |
langchain / langgraph |
Yes | |
huggingface_hub |
Yes | |
google-genai |
Yes | |
pydantic-ai |
Yes | |
litellm |
No | Requires explicit integration |
mcp (Model Context Protocol) |
Yes |
JavaScript Configuration
Node.js — auto-enabled integrations
Just ensure tracing is enabled. Integrations auto-enable when the AI package is installed:
Sentry.init({
dsn: "YOUR_DSN",
tracesSampleRate: 1.0, // Lower in production (e.g., 0.1)
// OpenAI, Anthropic, Google GenAI, LangChain integrations auto-enable in Node.js
});
To customize (e.g., enable prompt capture — see Data Capture Warning):
integrations: [
Sentry.openAIIntegration({
// recordInputs: true, // Opt-in: captures prompt content (PII)
// recordOutputs: true, // Opt-in: captures response content (PII)
}),
],
Browser / Next.js OpenAI (manual wrapping required)
In browser-side code or Next.js meta-framework apps, auto-instrumentation is not available. Wrap the client manually:
import OpenAI from "openai";
import * as Sentry from "@sentry/nextjs"; // or @sentry/react, @sentry/browser
const openai = Sentry.instrumentOpenAiClient(new OpenAI());
// Use 'openai' client as normal
LangChain / LangGraph (auto-enabled)
integrations: [
Sentry.langChainIntegration({
// recordInputs: true, // Opt-in: captures prompt content (PII)
// recordOutputs: true, // Opt-in: captures response content (PII)
}),
Sentry.langGraphIntegration({
// recordInputs: true,
// recordOutputs: true,
}),
],
Vercel AI SDK
Add to sentry.edge.config.ts for Edge runtime:
integrations: [Sentry.vercelAIIntegration()],
Enable telemetry per-call:
await generateText({
model: openai("gpt-4o"),
prompt: "Hello",
experimental_telemetry: {
isEnabled: true,
// recordInputs: true, // Opt-in: captures prompt content (PII)
// recordOutputs: true, // Opt-in: captures response content (PII)
},
});
Python Configuration
Integrations auto-enable — just init with tracing. Only add explicit imports to customize options:
import sentry_sdk
sentry_sdk.init(
dsn="YOUR_DSN",
traces_sample_rate=1.0, # Lower in production (e.g., 0.1)
# send_default_pii=True, # Opt-in: required for prompt capture (sends user PII)
# Integrations auto-enable when the AI package is installed.
# Only specify explicitly to customize (e.g., include_prompts):
# integrations=[OpenAIIntegration(include_prompts=True)],
)
Manual Instrumentation
Use when no supported SDK is detected.
Span Types
op Value |
Purpose |
|---|---|
gen_ai.request |
Individual LLM calls |
gen_ai.invoke_agent |
Agent execution lifecycle |
gen_ai.execute_tool |
Tool/function calls |
gen_ai.handoff |
Agent-to-agent transitions |
Example (JavaScript)
await Sentry.startSpan({
op: "gen_ai.request",
name: "LLM request gpt-4o",
attributes: { "gen_ai.request.model": "gpt-4o" },
}, async (span) => {
span.setAttribute("gen_ai.request.messages", JSON.stringify(messages));
const result = await llmClient.complete(prompt);
span.setAttribute("gen_ai.usage.input_tokens", result.inputTokens);
span.setAttribute("gen_ai.usage.output_tokens", result.outputTokens);
return result;
});
Key Attributes
| Attribute | Description |
|---|---|
gen_ai.request.model |
Model identifier |
gen_ai.request.messages |
JSON input messages |
gen_ai.usage.input_tokens |
Input token count |
gen_ai.usage.output_tokens |
Output token count |
gen_ai.agent.name |
Agent identifier |
gen_ai.tool.name |
Tool identifier |
Enable prompt/output capture only after confirming with the user (see Data Capture Warning above).
Verification
After configuring, make an LLM call and check the Sentry Traces dashboard. AI spans appear with gen_ai.* operations showing model, token counts, and latency.
Troubleshooting
| Issue | Solution |
|---|---|
| AI spans not appearing | Verify tracesSampleRate > 0, check SDK version |
| Token counts missing | Some providers don't return tokens for streaming |
| Prompts not captured | Enable recordInputs/include_prompts |
| Vercel AI not working | Add experimental_telemetry to each call |
How to use sentry-setup-ai-monitoring on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add sentry-setup-ai-monitoring
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches sentry-setup-ai-monitoring from GitHub repository getsentry/sentry-agent-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate sentry-setup-ai-monitoring. Access the skill through slash commands (e.g., /sentry-setup-ai-monitoring) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.8★★★★★51 reviews- ★★★★★Soo Smith· Dec 28, 2024
sentry-setup-ai-monitoring is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Anika Bansal· Dec 16, 2024
Solid pick for teams standardizing on skills: sentry-setup-ai-monitoring is focused, and the summary matches what you get after install.
- ★★★★★Mia Singh· Dec 16, 2024
sentry-setup-ai-monitoring reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Ganesh Mohane· Dec 8, 2024
Useful defaults in sentry-setup-ai-monitoring — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Shikha Mishra· Dec 4, 2024
Solid pick for teams standardizing on skills: sentry-setup-ai-monitoring is focused, and the summary matches what you get after install.
- ★★★★★Sakshi Patil· Nov 27, 2024
sentry-setup-ai-monitoring is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Hana Anderson· Nov 19, 2024
Useful defaults in sentry-setup-ai-monitoring — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Kaira Farah· Nov 7, 2024
We added sentry-setup-ai-monitoring from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Kaira Liu· Oct 26, 2024
sentry-setup-ai-monitoring fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Chaitanya Patil· Oct 18, 2024
Keeps context tight: sentry-setup-ai-monitoring is the kind of skill you can hand to a new teammate without a long onboarding doc.
showing 1-10 of 51