Skip to content
Integration collection

Python integrations

Instrument Python APIs, workers, database applications, and AI agent frameworks with synchronous or asyncio-safe structured events.

Reviewed by the Telemetry product team on . We checked where the code runs, shared event fields, verification steps, and the linked implementation guides. Who reviews this page

9 implementation guides

Every guide includes a server-side snippet, delivery and privacy boundaries, a verification query, related SQL, and links to upstream documentation.

Browse guides

Selection framework

Log where the final result is known

Match sync and async execution

Use the synchronous client for ordinary workers and the async client for asyncio request or agent paths so telemetry does not block the event loop.

Send the event after the transaction finishes

Wait for the database commit, queued task, or model workflow to finish before logging success. A handler can return successfully while that work is still pending.

Categorize exceptions before logging

Record a controlled error type and failed step. Avoid raw exception text when it can contain SQL parameters, prompts, secrets, or customer content.

Shared event contract

Use the same field definitions across services

  • operation, status, duration_ms, release, and environment
  • request_id, task_id, run_id, account_id, and controlled error_type
  • attempt, model, provider, tool_name, and database operation where relevant

Adapt these fields to your workflow. Document units, allowed statuses, and identifiers before several services write to the same table. Name the team responsible for the schema.

Verification

Exercise failure paths before alerts

  1. 1Exercise one synchronous and one asynchronous path when the application uses both.
  2. 2Confirm events are emitted after commit or final task status.
  3. 3Test cancellation, timeout, retry, and process-shutdown behavior.
  4. 4Inspect inferred field types before building the first query.

Implementation guides

Match the framework, provider, or runtime

Setup guide with source links

Python and FastAPI structured logging

Capture FastAPI request outcomes and latency with the asynchronous Telemetry client and normalized route names.

Open guide
Setup guide with source links

Django and Celery structured event monitoring

Connect Django request outcomes and Celery task lifecycles with safe identifiers, latency, retries, and final status.

Open guide
Setup guide with source links

Flask and SQLAlchemy telemetry

Record Flask request results and SQLAlchemy transaction behavior with approved Python event fields, consistent route templates, and safe error categories.

Open guide
Setup guide with source links

Pydantic AI agent telemetry

Measure Pydantic AI run outcomes, validated outputs, retries, tool activity, latency, usage, and product acceptance with safe structured events.

Open guide
Setup guide with source links

CrewAI workflow telemetry

Track CrewAI crew and flow outcomes, task counts, handoffs, retries, latency, cost, and accepted results without retaining agent conversations.

Open guide
Setup guide with source links

LlamaIndex agent telemetry

Track LlamaIndex agent and workflow outcomes, tool activity, latency, retrieval versions, cost, and reviewed quality with structured events.

Open guide
Setup guide with source links

DSPy program evaluation telemetry

Measure DSPy program latency, failures, metric scores, optimizer versions, model cost, and accepted outcomes across releases with SQL-ready events.

Open guide
Setup guide with source links

AutoGen task flow, state, and timeout monitoring

Track AutoGen task-flow state, timeouts, team and agent outcomes, tool activity, handoffs, latency, failures, cost, and releases with compact structured events.

Open guide
Setup guide with source links

LiteLLM gateway and SDK telemetry

Track LiteLLM provider routing, retries, fallbacks, token usage, latency, cost estimates, and accepted outcomes across a controlled model gateway.

Open guide

Verify one end-to-end workflow first

Create a free API key, choose the closest runtime guide, and send one known success and failure before expanding coverage.

Start free