Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.
Python agentsai-hackingai-penetration-testingai-pentestingai-securityartificial-intelligencebug-bountycode-qualityctf-toolscybersecuritycybersecurity-toolsethical-hackinghackingllm-securityoffensive-securitypenetration-testingpentesting-toolsred-teamingsecuritysecurity-automation
fix: Handle stray quotes in tag names and enforce parameter tags in prompt
0xallam027cea2f2565
diff --git a/strix/agents/StrixAgent/system_prompt.jinja b/strix/agents/StrixAgent/system_prompt.jinjaindex bcc13590..36c88508 100644--- a/strix/agents/StrixAgent/system_prompt.jinja+++ b/strix/agents/StrixAgent/system_prompt.jinja@@ -328,6 +328,9 @@ WRONG formats — NEVER use these:- <tool_call><tool_name>...</tool_name></tool_call>- {"tool_name": {"param_name": "value"}}- ```<function=tool_name>...</function>```+- <function=tool_name>value_without_parameter_tags</function>++EVERY argument MUST be wrapped in <parameter=name>...</parameter> tags. NEVER put values directly in the function body without parameter tags. This WILL cause the tool call to fail.Do NOT emit any extra XML tags in your output. In particular:- NO <thinking>...</thinking> or <thought>...</thought> blocks@@ -337,6 +340,11 @@ If you need to reason, use the think tool. Your raw output must contain ONLY theNotice: use <function=X> NOT <invoke name="X">, use <parameter=X> NOT <parameter name="X">, use </function> NOT </invoke>.+Example (terminal tool):+<function=terminal_execute>+<parameter=command>nmap -sV -p 1-1000 target.com</parameter>+</function>+Example (agent creation tool):<function=create_agent><parameter=task>Perform targeted XSS testing on the search endpoint</parameter>diff --git a/strix/llm/utils.py b/strix/llm/utils.pyindex 1ba6a5f6..8ab16933 100644--- a/strix/llm/utils.py+++ b/strix/llm/utils.py@@ -6,8 +6,7 @@ from typing import Any_INVOKE_OPEN = re.compile(r'<invoke\s+name=["\']([^"\']+)["\']>')_PARAM_NAME_ATTR = re.compile(r'<parameter\s+name=["\']([^"\']+)["\']>')_FUNCTION_CALLS_TAG = re.compile(r"</?function_calls>")-_QUOTED_FUNCTION = re.compile(r"""<function\s*=\s*['"]([^"']+)['"]\s*>""")-_QUOTED_PARAMETER = re.compile(r"""<parameter\s*=\s*['"]([^"']+)['"]\s*>""")+_STRIP_TAG_QUOTES = re.compile(r"<(function|parameter)\s*=\s*([^>]*?)>")def normalize_tool_format(content: str) -> str:@@ -27,11 +26,9 @@ def normalize_tool_format(content: str) -> str:content = _PARAM_NAME_ATTR.sub(r"<parameter=\1>", content)content = content.replace("</invoke>", "</function>")- content = _QUOTED_FUNCTION.sub(r"<function=\1>", content)- content = _QUOTED_PARAMETER.sub(r"<parameter=\1>", content)-- content = re.sub(r"<function=\s+", "<function=", content)- return re.sub(r"<parameter=\s+", "<parameter=", content)+ return _STRIP_TAG_QUOTES.sub(+ lambda m: f"<{m.group(1)}={m.group(2).strip().strip(chr(34) + chr(39))}>", content+ )STRIX_MODEL_MAP: dict[str, str] = {