
Sentry Setup Ai Monitoring
Instrument OpenAI, Anthropic, Vercel AI, LangChain, Google GenAI, or Pydantic AI with Sentry so LLM calls, tools, and token usage are traceable in production.
Install
npx skills add https://github.com/getsentry/sentry-agent-skills --skill sentry-setup-ai-monitoringWhat is this skill?
- Invoke when users ask to monitor LLM calls, AI agents, token usage, or model latency
- Requires tracing enabled with tracesSampleRate greater than zero before AI monitoring works
- Detects installed AI SDKs and maps them to the appropriate Sentry integration pattern
- Explicit PII and compliance gate before enabling prompt/output capture (recordInputs, include_prompts, send_default_pii)
- Directs implementers to verify APIs against current docs.sentry.io because minimum SDK versions change
Adoption & trust: 559 installs on skills.sh; 19 GitHub stars; 3/3 security scanners passed (skills.sh audits).
Recommended Skills
Microsoft Foundrymicrosoft/azure-skills
Azure Aimicrosoft/azure-skills
Azure Hosted Copilot Sdkmicrosoft/azure-skills
Lark Eventlarksuite/cli
Running Claude Code Via Litellm Copilotxixu-me/skills
Setup Matt Pocock Skillsmattpocock/skills
Journey fit
Primary fit
Primary shelf is Build integrations because the skill’s job is detecting SDKs and wiring Sentry in the codebase before you ship. Integrations subphase matches SDK-specific setup steps and tracing prerequisites rather than one-off debugging.
Common Questions / FAQ
Is Sentry Setup Ai Monitoring safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Sentry Setup Ai Monitoring
# 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](https://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:** ```bash # 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: ```javascript 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): ```javascript 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: ```javascript import OpenAI from "openai"; import * as Sentry from "@sentry/nextjs"; // or @