
Sentry Python Sdk
Walk through detecting your Python stack and wiring sentry-sdk for errors, tracing, profiling, logging, metrics, crons, and AI monitoring.
Overview
Sentry Python SDK is an agent skill most often used in Build (also Ship, Operate) that guides complete sentry-sdk installation and configuration for Python apps and frameworks.
Install
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-python-sdkWhat is this skill?
- Opinionated multi-phase wizard: Detect project context before recommending setup
- Covers error monitoring, tracing, profiling, logging, metrics, crons, and AI monitoring
- Framework-aware guidance for Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, Tornado
- Phase 1 detect commands grep requirements and pyproject for existing Sentry usage
- Aligned with sentry-sdk 2.x; points to official Python platform docs for verification
- Phase 1 Detect workflow with grep-based project scanning
- Documents sentry-sdk 2.x alignment
Adoption & trust: 1.2k installs on skills.sh; 197 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
Your Python app is ready to ship but you have no consistent error, trace, or cron monitoring wired into Django, Flask, FastAPI, or Celery.
Who is it for?
Solo builders on Python web or worker codebases who want a guided, framework-aware Sentry install instead of copying generic docs.
Skip if: Non-Python stacks, org-wide Sentry governance-only tasks with no code changes, or teams that already have verified sentry-sdk 2.x config and only need dashboard tweaks.
When should I use this skill?
User asks to add Sentry to Python, install sentry-sdk, setup Sentry in Python, or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring.
What do I get? / Deliverables
You get a detected stack profile and implemented Sentry SDK setup so crashes and performance issues surface in Sentry after deploy.
- Detected framework and dependency report
- Configured sentry-sdk initialization
- Framework-specific instrumentation hooks
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Build integrations is the canonical shelf because the wizard’s first job is installing and configuring sentry-sdk inside an existing Python codebase. Integrations subphase fits framework-specific SDK hooks for Django, Flask, FastAPI, Celery, and related runtimes named in the skill.
Where it fits
Wire sentry-sdk into a new FastAPI service before merging the first production-ready API routes.
Enable release health, crons, and tracing so launch week regressions show up in Sentry immediately.
Extend an existing Python worker with profiling and structured logging when intermittent task failures spike.
How it compares
SDK setup wizard for in-repo instrumentation—not a hosted Sentry MCP or manual-only dashboard configuration.
Common Questions / FAQ
Who is sentry-python-sdk for?
Indie Python developers shipping SaaS, APIs, or background jobs who need agent-led Sentry SDK integration across popular frameworks.
When should I use sentry-python-sdk?
While building integrations before launch, when hardening Ship observability, or in Operate when extending monitoring to traces, crons, logs, or AI features in Python.
Is sentry-python-sdk safe to install?
Check the Security Audits panel on this Prism page; the skill runs repo inspection commands and will touch dependency files—review DSN and secret handling before enabling in production.
SKILL.md
READMESKILL.md - Sentry Python Sdk
> [All Skills](../../SKILL_TREE.md) > [SDK Setup](../sentry-sdk-setup/SKILL.md) > Python SDK # Sentry Python SDK Opinionated wizard that scans your Python project and guides you through complete Sentry setup. ## Invoke This Skill When - User asks to "add Sentry to Python" or "setup Sentry" in a Python app - User wants error monitoring, tracing, profiling, logging, metrics, or crons in Python - User mentions `sentry-sdk`, `sentry_sdk`, or Sentry + any Python framework - User wants to monitor Django views, Flask routes, FastAPI endpoints, Celery tasks, or scheduled jobs > **Note:** SDK versions and APIs below reflect Sentry docs at time of writing (sentry-sdk 2.x). > Always verify against [docs.sentry.io/platforms/python/](https://docs.sentry.io/platforms/python/) before implementing. --- ## Phase 1: Detect Run these commands to understand the project before making recommendations: ```bash # Check existing Sentry grep -i sentry requirements.txt pyproject.toml setup.cfg setup.py 2>/dev/null # Detect web framework grep -rE "django|flask|fastapi|starlette|aiohttp|tornado|quart|falcon|sanic|bottle" \ requirements.txt pyproject.toml 2>/dev/null # Detect task queues grep -rE "celery|rq|huey|arq|dramatiq" requirements.txt pyproject.toml 2>/dev/null # Detect logging libraries grep -E "loguru" requirements.txt pyproject.toml 2>/dev/null # Detect AI libraries grep -rE "openai|anthropic|langchain|huggingface|google-genai|pydantic-ai|litellm" \ requirements.txt pyproject.toml 2>/dev/null # Detect schedulers / crons grep -rE "celery|apscheduler|schedule|crontab" requirements.txt pyproject.toml 2>/dev/null # OpenTelemetry tracing — check for SDK + instrumentations grep -rE "opentelemetry-sdk|opentelemetry-instrumentation|opentelemetry-distro" \ requirements.txt pyproject.toml 2>/dev/null grep -rn "TracerProvider\|trace\.get_tracer\|start_as_current_span" \ --include="*.py" 2>/dev/null | head -5 # Check for companion frontend ls frontend/ web/ client/ ui/ static/ templates/ 2>/dev/null ``` **What to note:** - Is `sentry-sdk` already in requirements? If yes, check if `sentry_sdk.init()` is present — may just need feature config. - Which framework? (Determines where to place `sentry_sdk.init()`.) - Which task queue? (Celery needs dual-process init; RQ needs a settings file.) - AI libraries? (OpenAI, Anthropic, LangChain are auto-instrumented.) - OpenTelemetry tracing? (Use OTLP path instead of native tracing.) - Companion frontend? (Triggers Phase 4 cross-link.) --- ## Phase 2: Recommend Based on what you found, present a concrete proposal. Don't ask open-ended questions — lead with a recommendation: **Route from OTel detection:** - **OTel tracing detected** (`opentelemetry-sdk` / `opentelemetry-distro` in requirements, or `TracerProvider` in source) → use OTLP path: `OTLPIntegration()`; do **not** set `traces_sample_rate`; Sentry links errors to OTel traces automatically **Always recommended (core coverage):** - ✅ **Error Monitoring** — captures unhandled exceptions, supports `ExceptionGroup` (Python 3.11+) - ✅ **Logging** — Python `logging` stdlib auto-captured; enhanced if Loguru detected **Recommend when detected:** - ✅ **Tracing** — HTTP framework detected (Django/Flask/FastAPI/etc.) - ✅ **AI Monitoring** — OpenAI/Anthropic/LangChain/etc. detected (auto-instrumented, zero config) - ⚡ **Profiling** — production apps where performance matters; **not available with OTLP path** - ⚡ **Crons** — Celery Beat, APScheduler, or cron patterns detected - ⚡ **Metrics*