Skip to content

fix(ai-red-teaming): use UV tool Python executable for workflow execution#7

Merged
rdheekonda merged 3 commits into
mainfrom
fix/python-executable-path-uv-tool
May 12, 2026
Merged

fix(ai-red-teaming): use UV tool Python executable for workflow execution#7
rdheekonda merged 3 commits into
mainfrom
fix/python-executable-path-uv-tool

Conversation

@rdheekonda
Copy link
Copy Markdown
Contributor

Problem

AIRT workflows fail when running under UV tool environments due to Python executable mismatch.

Root Cause:

  • sys.executable points to system Python (/usr/bin/python3)
  • System Python lacks Dreadnode SDK and dependencies (litellm, etc.)
  • Workflow subprocess execution fails with ModuleNotFoundError

Solution

Use resolve_python_executable() instead of sys.executable:

  • Before: sys.executable → system Python without SDK
  • After: resolve_python_executable() → UV tool Python with full SDK

Changes

# Import added
from dreadnode.app.env import resolve_python_executable

# Subprocess call updated  
python_executable = resolve_python_executable()
result = subprocess.run([python_executable, str(filepath)], ...)

Testing

  • Reproduces the AWS EC2 workflow execution issue
  • Fix ensures workflows use same Python as agent runtime
  • All AIRT dependencies available in workflow subprocess

Files Changed

  • capabilities/ai-red-teaming/tools/workflows.py - Updated Python executable resolution

This fix ensures that when users install the ai-red-teaming capability via UV tool, workflows execute properly with access to the full Dreadnode SDK.

…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.
@rdheekonda rdheekonda merged commit 0a437ed into main May 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant