autonomous-agent-patterns
Warn
Audited by Gen Agent Trust Hub on Sep 15, 2026
Risk Level: MEDIUMDYNAMIC_EXECUTIONINDIRECT_PROMPT_INJECTIONCOMMAND_EXECUTIONREMOTE_CODE_EXECUTION
Full Analysis
- [DYNAMIC_EXECUTION]: The
MCPAgentclass implements acreate_toolpattern that generates Python code via an LLM based on user-provided descriptions. This code is written directly to the filesystem (e.g.,./mcp_servers/server.py) and dynamically loaded/executed via aconnect_servermethod. This pattern facilitates the execution of unverified code generated at runtime. - [REMOTE_CODE_EXECUTION]: The combination of LLM-generated code and filesystem persistence in the
MCPAgent.create_toolmethod creates a pathway for remote code execution if the input description or the LLM's output is influenced by an attacker. - [INDIRECT_PROMPT_INJECTION]: The
ContextManagerclass demonstrates a pattern for ingesting external data from files (add_file,add_folder) and URLs (add_url) and interpolating it directly into the agent's prompt using theformat_for_promptmethod. - Ingestion points:
ContextManager.add_file,ContextManager.add_url, andContextManager.add_folderinSKILL.md. - Boundary markers: The pattern uses markdown code blocks (```) to delimit content, but lacks explicit instructions to the LLM to ignore potentially malicious directives embedded within the ingested data.
- Capability inventory: The skill patterns include capabilities for
run_command,write_file,edit_file, and browser automation (open_browser,click_element). - Sanitization: There is no evidence of sanitization, escaping, or filtering of the external content before it is interpolated into the system prompt.
- [COMMAND_EXECUTION]: The
SandboxedExecutionclass utilizessubprocess.runwithshell=Trueto execute shell commands. While it implements a command whitelist (allowed_commands), the use ofshell=Trueremains a high-risk pattern that could be vulnerable to command injection if argument parsing or whitelist validation is bypassed.
Audit Metadata