diff --git a/capabilities/ai-red-teaming/capability.yaml b/capabilities/ai-red-teaming/capability.yaml index 21cebdb..65fd2ef 100644 --- a/capabilities/ai-red-teaming/capability.yaml +++ b/capabilities/ai-red-teaming/capability.yaml @@ -1,6 +1,6 @@ schema: 1 name: ai-red-teaming -version: "1.2.0" +version: "1.2.1" description: > Probe the security and safety of AI applications, agents, and foundation models. Orchestrates adversarial attack workflows to discover vulnerabilities in LLMs, diff --git a/capabilities/ai-red-teaming/scripts/attack_runner.py b/capabilities/ai-red-teaming/scripts/attack_runner.py index 29c6d34..632590a 100644 --- a/capabilities/ai-red-teaming/scripts/attack_runner.py +++ b/capabilities/ai-red-teaming/scripts/attack_runner.py @@ -20,6 +20,8 @@ import time from pathlib import Path +from dreadnode.app.env import resolve_python_executable + WORKFLOWS_DIR = Path( os.environ.get( "AIRT_WORKFLOWS_DIR", @@ -79,8 +81,10 @@ def _auto_execute_workflow(filename: str, timeout: int = 540) -> str: return "\n[AUTO-EXECUTE] Syntax error in generated script: {} (line {})".format(e.msg, e.lineno) try: + python_executable = resolve_python_executable() + print(f"[INFO] Executing workflow with Python: {python_executable}", file=sys.stderr) result = subprocess.run( - [sys.executable, str(filepath)], + [python_executable, str(filepath)], cwd=str(WORKFLOWS_DIR.parent), capture_output=True, text=True, diff --git a/capabilities/ai-red-teaming/scripts/workflow_helper.py b/capabilities/ai-red-teaming/scripts/workflow_helper.py index d787ef2..bc42b64 100644 --- a/capabilities/ai-red-teaming/scripts/workflow_helper.py +++ b/capabilities/ai-red-teaming/scripts/workflow_helper.py @@ -13,6 +13,8 @@ import time from pathlib import Path +from dreadnode.app.env import resolve_python_executable + WORKFLOWS_DIR = Path( os.environ.get( "AIRT_WORKFLOWS_DIR", @@ -118,8 +120,10 @@ def execute_workflow(params: dict) -> dict: timeout = min(timeout, 600) # Max 10 minutes try: + python_executable = resolve_python_executable() + print(f"[INFO] Executing workflow with Python: {python_executable}", file=sys.stderr) result = subprocess.run( - [sys.executable, str(filepath)], + [python_executable, str(filepath)], cwd=str(WORKFLOWS_DIR.parent), capture_output=True, text=True, diff --git a/capabilities/ai-red-teaming/tests/test_attack_runner.py b/capabilities/ai-red-teaming/tests/test_attack_runner.py index 8570da7..bf8b6e0 100644 --- a/capabilities/ai-red-teaming/tests/test_attack_runner.py +++ b/capabilities/ai-red-teaming/tests/test_attack_runner.py @@ -16,6 +16,8 @@ import pytest +from dreadnode.app.env import resolve_python_executable + # --------------------------------------------------------------------------- # Load attack_runner as a module (it's not a package, just a script) # --------------------------------------------------------------------------- @@ -39,8 +41,10 @@ def _generate(params: dict) -> dict: """Call attack_runner via subprocess and return JSON result.""" payload = json.dumps({"name": "generate_attack", "parameters": params}) env = {**os.environ, "DREADNODE_WORKSPACE_DIR": "/tmp/airt_test"} + python_executable = resolve_python_executable() + print(f"[INFO] Running test with Python: {python_executable}", file=sys.stderr) result = subprocess.run( - [sys.executable, str(RUNNER_PATH)], + [python_executable, str(RUNNER_PATH)], input=payload, capture_output=True, text=True, diff --git a/capabilities/ai-red-teaming/tools/attacks.py b/capabilities/ai-red-teaming/tools/attacks.py index 93b61c0..9601fbd 100644 --- a/capabilities/ai-red-teaming/tools/attacks.py +++ b/capabilities/ai-red-teaming/tools/attacks.py @@ -18,6 +18,7 @@ from pathlib import Path from dreadnode.agents.tools import tool +from dreadnode.app.env import resolve_python_executable _RUNNER_SCRIPT = Path(__file__).parent.parent / "scripts" / "attack_runner.py" @@ -26,8 +27,10 @@ def _call_runner(name: str, params: dict) -> str: """Call attack_runner.py via subprocess with JSON dispatch.""" payload = json.dumps({"name": name, "parameters": params}) try: + python_executable = resolve_python_executable() + print(f"[INFO] Executing attack runner with Python: {python_executable}", file=sys.stderr) result = subprocess.run( - [sys.executable, str(_RUNNER_SCRIPT)], + [python_executable, str(_RUNNER_SCRIPT)], input=payload, capture_output=True, text=True, diff --git a/capabilities/ai-red-teaming/tools/workflows.py b/capabilities/ai-red-teaming/tools/workflows.py index 5c39d50..b1061bf 100644 --- a/capabilities/ai-red-teaming/tools/workflows.py +++ b/capabilities/ai-red-teaming/tools/workflows.py @@ -15,6 +15,7 @@ from pathlib import Path from dreadnode.agents.tools import tool +from dreadnode.app.env import resolve_python_executable WORKFLOWS_DIR = Path( os.environ.get( @@ -122,8 +123,10 @@ def execute_workflow( timeout = min(timeout, 600) try: + python_executable = resolve_python_executable() + print(f"[INFO] Executing workflow with Python: {python_executable}", file=sys.stderr) result = subprocess.run( - [sys.executable, str(filepath)], + [python_executable, str(filepath)], capture_output=True, text=True, timeout=timeout,