Skip to content

Support PydanticAI spans in Spotlight AI Traces view #1330

Description

@sergical

Spotlight's AI Traces view (Insights → AI Traces) currently only supports the Vercel AI SDK. The gen_ai.* spans emitted by the sentry-python PydanticAIIntegration are not surfaced there because the library handler registry only contains vercelAISDKHandler, which requires a vercel.ai.operationId attribute that Python SDK spans don't set.

Current behavior

  • aiLibraries.ts registers [vercelAISDKHandler] only
  • PydanticAI spans show up in the regular Traces tab but are invisible in the AI Traces view
  • PydanticAIIntegration (sentry-python) emits standard gen_ai.* ops with token counts, model info, and prompt/completion data

Gap
Users instrumenting Python backends with PydanticAIIntegration get no AI Traces visibility in Spotlight, even though the span data is present.

Options

  • Add a dedicated pydanticAIHandler to the aiLibraries registry that detects gen_ai.* spans from the Python SDK
  • Alternatively, add a generic sentry-python gen_ai handler that covers all Python AI integrations (Anthropic, OpenAI, PydanticAI) since they share the same span format

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeaturejaredTrigger the Jared agent to work on stuff
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions