Change8

v4.13.0

📦 datadog-sdkView on GitHub →
27 features🐛 2 fixes5 deprecations🔧 18 symbols

Summary

This release enhances LLM Observability with features like prompt management, image support, and OpenAI Realtime API instrumentation. It also introduces safer ID generation in Lambda, OpenTelemetry integration, and improved exception profiling.

Migration Steps

  1. Update imports from `ddtrace.appsec.ai_guard` to `ddtrace.aiguard` for the AI Guard SDK.
  2. Remove the `DD_PYTEST_USE_NEW_PLUGIN` environment variable to use the new default pytest plugin.
  3. Use `agent_service` and `DD_SERVICE` instead of `ml_app` and `DD_LLMOBS_ML_APP` for LLM Observability.
  4. Set `DD_ENV` instead of using the `label` parameter in `LLMObs.get_prompt()` and `LLMObs.refresh_prompt()`.
  5. When using Bedrock calls with an application-inference-profile ARN as `modelId`, enable `DD_BOTOCORE_BEDROCK_RESOLVE_INFERENCE_PROFILE` to resolve the underlying foundation model.
  6. Set `DD_ENV` to select the prompt version for a specific environment when using `LLMObs.get_prompt()`.
  7. When using the OpenAI integration, set `DD_OPENAI_REALTIME_ENABLED=false` to disable Realtime API instrumentation.
  8. When using the OpenFeature provider, set `DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED=true` to enable experimental APM span enrichment.

✨ New Features

  • Trace and span IDs are now generated more safely in AWS Lambda MicroVM environments.
  • Adds OpenTelemetry thread-context publication on Linux for profiling tool correlation.
  • Adds `DD_TRACE_OTEL_SEMANTICS_ENABLED` to opt in to OpenTelemetry trace semantics.
  • Introduces per-integration kill-switch environment variables for AI Guard: `DD_AI_GUARD_ANTHROPIC_ENABLED` and `DD_AI_GUARD_LANGCHAIN_ENABLED`.
  • Adds support for the `DD_APPSEC_AGENTIC_ONBOARDING` environment variable for AAP.
  • Added `DD_BOTOCORE_BEDROCK_RESOLVE_INFERENCE_PROFILE` to resolve underlying foundation models for Bedrock calls.
  • Captures session metadata (session id, user id, and app name) from the Google ADK `Session` object on LLM Observability spans.
  • Spans generated under an agent are now automatically attributed to their nearest agent ancestor.
  • Added `agent_service` as a preferred alias for the `ml_app` argument in LLMObs.
  • Auto-instrumented LLM integrations now automatically link Datadog Managed Prompts retrieved with `LLMObs.get_prompt()` to the resulting LLM span.
  • `LLMObs.get_prompt()` now resolves environment-scoped prompt versions and supports targeting for A/B testing via `DD_ENV`.
  • Adds a `version` argument to `LLMObs.get_prompt()` for retrieving an exact prompt version.
  • Introduces support for attaching images to messages on LLM spans via the `image_parts` field.
  • The OpenAI integration now automatically instruments the Realtime API, capturing conversation turns as `llm` spans.
  • Adds prompt management methods to `LLMObs` for creating, updating, deleting, and listing prompts and prompt versions.
  • Adds the `env_ids` argument to prompt creation and version update methods for deploying prompts to feature-flag environments.
  • `session_id` now propagates to following spans in a trace.
  • Adds support for tracing synchronous and asynchronous streaming chat completion calls using the `mistralai` client.
  • Adds support for submitting LLM Observability spans for synchronous and asynchronous streaming chat completion calls using the `mistralai` client.
  • Adds `DD_CODE_COVERAGE_FLAGS` to group and filter uploaded code coverage reports.
  • Unhandled Python exceptions are now reported through the crashtracker.
  • Enables obfuscation by default for stats computation.
  • Exception profiling is now enabled by default when the profiler is active on Python 3.12+.
  • Exception profiling now captures the full Python call stack at the point of the raise.
  • Work offloaded by an asyncio task to a ThreadPoolExecutor is now labeled with the originating task.
  • Native frames collected by the profiler are now attributed to third-party code in the code provenance view.
  • Adds experimental APM span enrichment for the OpenFeature provider when `DD_EXPERIMENTAL_FLAGGING_PROVIDER_SPAN_ENRICHMENT_ENABLED=true`.

🐛 Bug Fixes

  • Fixes duplicate ID generation in AWS Lambda MicroVM environments.
  • Fixes Strands Agents classes import path for AI Guard.

Affected Symbols

⚡ Deprecations

  • The `ml_app` argument and `DD_LLMOBS_ML_APP` environment variable for LLM Observability are deprecated and will be removed in the next major version. Use `agent_service` and `DD_SERVICE` instead.
  • Importing the AI Guard public SDK from `ddtrace.appsec.ai_guard` is deprecated and will be removed in 5.0.0. Update imports to `ddtrace.aiguard`.
  • The legacy pytest plugin (`ddtrace/contrib/internal/pytest`) is deprecated and will be removed in ddtrace 5.0.0. Remove the `DD_PYTEST_USE_NEW_PLUGIN` environment variable to use the new default plugin.
  • The `label` parameter of `LLMObs.get_prompt()` and `LLMObs.refresh_prompt()` is deprecated. Set `DD_ENV` instead.
  • The `ManagedPrompt.label` property is deprecated.