Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion capabilities/ai-red-teaming/capability.yaml
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
6 changes: 5 additions & 1 deletion capabilities/ai-red-teaming/scripts/attack_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion capabilities/ai-red-teaming/scripts/workflow_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion capabilities/ai-red-teaming/tests/test_attack_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
# ---------------------------------------------------------------------------
Expand All @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion capabilities/ai-red-teaming/tools/attacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion capabilities/ai-red-teaming/tools/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
Loading