Back to Skills

sentry-python-sdk

Full Sentry SDK setup for Python. Use when asked to "add Sentry to Python", "install sentry-sdk", "setup Sentry in Python", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for Python applications. Supports Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, Tornado, and more.

232stars30forksUpdated 7/2/2026

Security Assessment

Low Risk(85/100)

Detected risks:

Agent-reviewed override('crontab' matches are Sentry's own cron-monitoring feature docs (references/crons.md); '.env' is standard Sentry SDK DSN/config. Legitimate SDK setup, nothing executed.)
Security Score85/100

About sentry-python-sdk

An opinionated setup wizard for adding the Sentry SDK to a Python application, covering error monitoring, tracing, profiling, logging, metrics, crons, and AI monitoring. It applies to requests such as adding Sentry to Python, installing sentry-sdk, or configuring error monitoring in a Python app, and it supports many frameworks including Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, and Tornado.

Work proceeds in three phases. Detect runs a series of grep commands to understand the project before recommending anything, checking whether sentry-sdk is already present, which web framework and task queue are used, which logging and AI libraries are installed, whether schedulers or cron patterns exist, and whether OpenTelemetry tracing is in play. Recommend leads with a concrete proposal rather than open-ended questions, driven by a feature matrix: error monitoring is always recommended as the baseline, tracing when an HTTP framework is detected, AI monitoring when libraries such as OpenAI, Anthropic, or LangChain are present and auto-instrumented with zero config, and profiling, crons, and metrics when their triggers appear. Guide then handles installation, a recommended init configuration, and where to place that init call for each framework.

A notable branch is OpenTelemetry handling: when OTel tracing is detected, the skill routes to an OTLP integration path, deliberately does not set a traces sample rate, and skips profiling because it is incompatible with that path, letting Sentry link errors to existing OTel traces automatically. Per-framework guidance specifies exactly where initialization belongs, for example at the top of Django settings, before app creation in Flask and FastAPI, and dual-process init for Celery. The skill notes that its API details reflect sentry-sdk 2.x at time of writing and advises verifying against the current Python platform docs before implementing. Detailed configuration for each feature lives in referenced files. It is part of a broader Sentry SDK setup skill tree and is marked so it is not invoked by the model automatically.

FAQ

Which Python frameworks does it support?

Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, Tornado, and more, with per-framework guidance on exactly where to call sentry_sdk.init().

What Sentry features can it set up?

Error monitoring, tracing, profiling, logging, metrics, crons, and AI monitoring, recommended based on what the project scan detects.

How does it decide what to recommend?

Through a three-phase flow: Detect greps the project for frameworks, task queues, logging, AI libraries, schedulers, and OpenTelemetry; Recommend applies a feature matrix; and Guide installs and configures.

What happens if the project already uses OpenTelemetry?

It routes to the OTLP integration path, does not set a traces sample rate, and skips profiling (which is incompatible with OTLP), letting Sentry link errors to existing OTel traces.

Is AI monitoring hard to enable?

No. When libraries such as OpenAI, Anthropic, or LangChain are detected, AI monitoring is auto-instrumented with zero configuration.

All Files

8 files
references/logging.md8.1 KB
View
references/metrics.md4.1 KB
View
references/crons.md6.3 KB
View
references/profiling.md4.2 KB
View
references/tracing.md11.7 KB
View
SKILL.md15.9 KB
View
references/ai-monitoring.md11.3 KB
View
references/error-monitoring.md8.9 KB
View

Install sentry-python-sdk

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill