fix(ai-red-teaming): use UV tool Python executable for workflow execution#7
Merged
Merged
Conversation
…tion Fixes workflow execution failures when running under uv tool environments. Changes from sys.executable (system Python) to resolve_python_executable() which properly detects and uses the UV tool Python that has all required Dreadnode SDK dependencies. Resolves Python path issues causing: - ModuleNotFoundError for dreadnode modules - Missing litellm and AIRT dependencies - Workflow subprocess execution failures This ensures workflows use the same Python environment as the agent runtime.
Version bump to 1.2.1 and complete fix for sys.executable issues across ALL files in the ai-red-teaming capability. Fixed 5 total files: - ✅ tools/workflows.py (already committed) - ✅ tools/attacks.py - ✅ scripts/workflow_helper.py - ✅ scripts/attack_runner.py - ✅ tests/test_attack_runner.py - ✅ capability.yaml (version: 1.2.0 → 1.2.1) All subprocess calls now use resolve_python_executable() instead of sys.executable to ensure proper UV tool Python environment execution. This comprehensive fix ensures that every part of the ai-red-teaming capability uses the correct Python executable with full SDK dependencies.
…isibility - Added Python executable logging to all subprocess calls - Users now see exactly which Python is executing their workflows - Format: '[INFO] Executing workflow with Python: /path/to/python' - Helps debug environment issues and ensures correct Python is used Files updated: - tools/attacks.py - attack runner subprocess - tools/workflows.py - workflow execution subprocess - scripts/workflow_helper.py - workflow helper subprocess - scripts/attack_runner.py - generated workflow subprocess - tests/test_attack_runner.py - test subprocess Complete fix for Python executable resolution + visibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
AIRT workflows fail when running under UV tool environments due to Python executable mismatch.
Root Cause:
sys.executablepoints to system Python (/usr/bin/python3)ModuleNotFoundErrorSolution
Use
resolve_python_executable()instead ofsys.executable:sys.executable→ system Python without SDKresolve_python_executable()→ UV tool Python with full SDKChanges
Testing
Files Changed
capabilities/ai-red-teaming/tools/workflows.py- Updated Python executable resolutionThis fix ensures that when users install the ai-red-teaming capability via UV tool, workflows execute properly with access to the full Dreadnode SDK.