Skip to content

[python] migrate python weblog to ddtrace.aiguard imports#7334

Merged
avara1986 merged 1 commit into
mainfrom
avara/aiguard-import-migration
Jul 17, 2026
Merged

[python] migrate python weblog to ddtrace.aiguard imports#7334
avara1986 merged 1 commit into
mainfrom
avara/aiguard-import-migration

Conversation

@avara1986

Copy link
Copy Markdown
Member

Motivation

AI Guard in dd-trace-py was moved out of AppSec into a dedicated top-level package:

  • ddtrace.appsec.ai_guardddtrace.aiguard (dd-trace-py#18754, #19110)
  • ddtrace.internal.settings.asm.ai_guard_configddtrace.internal.settings.aiguard.aiguard_config

This updates the Python Flask weblog to use the new import locations.

Changes

  • utils/build/docker/python/flask/app.py: the /ai_guard/evaluate endpoint now imports from the new ddtrace.aiguard / ddtrace.internal.settings.aiguard locations.

To keep the weblog working against every tracer version under test (old and new), the new import paths are attempted first and fall back to the legacy paths on ImportError. This retrocompatibility is required because system-tests runs against a matrix of tracer versions.

Jira

https://datadoghq.atlassian.net/browse/APPSEC-67628

🤖 Generated with Claude Code

Migrate the AI Guard imports in the Flask weblog from the old
ddtrace.appsec.ai_guard / ddtrace.internal.settings.asm locations to the
new ddtrace.aiguard / ddtrace.internal.settings.aiguard packages
(dd-trace-py#18754, #19110).

The new import paths are tried first and fall back to the old ones so the
weblog stays compatible with every tracer version under test.

JIRA: APPSEC-67628

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

utils/build/docker/python/flask/app.py                                  @DataDog/apm-python @DataDog/asm-python @DataDog/system-tests-core

@avara1986 avara1986 added the python Pull requests that update Python code label Jul 17, 2026
@avara1986 avara1986 changed the title test(ai_guard): migrate python weblog to ddtrace.aiguard imports [python] migrate python weblog to ddtrace.aiguard imports Jul 17, 2026
@avara1986
avara1986 marked this pull request as ready for review July 17, 2026 09:48
@avara1986
avara1986 requested review from a team as code owners July 17, 2026 09:48
@avara1986
avara1986 requested review from mabdinur and ncybul and removed request for a team July 17, 2026 09:48
@avara1986
avara1986 merged commit f80b47d into main Jul 17, 2026
337 checks passed
@avara1986
avara1986 deleted the avara/aiguard-import-migration branch July 17, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants