Skip to content

execute.py installs rlms only in agent venv, not framework venv (Docker dual-venv bug) #2

@grodingo

Description

@grodingo

Bug Description

In Docker environments, Agent Zero uses two separate Python venvs:

  • /opt/venv — agent runtime (used by execute.py via sys.executable)
  • /opt/venv-a0 — framework runtime (used by hooks.py)

The execute.py script installs rlms using sys.executable, which resolves to /opt/venv/bin/python3. This means the dependency is only installed in the agent venv.

However, the RLM plugin's tool (tools/rlm.py) and extensions run inside the framework runtime (/opt/venv-a0), where the rlm module is not importable:

/opt/venv-a0/bin/python3 -c 'import rlm'
# ModuleNotFoundError: No module named 'rlm'

Impact

  • Users install the plugin dependency via the UI (which runs execute.py)
  • The installation reports success (exit code 0)
  • But the plugin fails at runtime when trying to import rlm in the framework context
  • The readiness check in build_runtime_readiness() reports dependency_satisfied: false

Steps to Reproduce

  1. Run Agent Zero in Docker
  2. Install the RLM plugin
  3. Click the "Execute" button in the plugin UI to install dependencies
  4. Observe: installation succeeds, execute_record.json shows exit_code: 0
  5. Verify: /opt/venv-a0/bin/python3 -c 'import rlm'ModuleNotFoundError

Root Cause

execute.py uses the skill template pattern:

result = subprocess.run(
    [sys.executable, "-m", "pip", "install", ...],
)

sys.executable in execute.py is /opt/venv/bin/python3, so pip installs there. But hooks.py (which calls ensure_rlm_dependency()) runs in /opt/venv-a0.

The hooks.py install() function does call ensure_rlm_dependency(), but only when triggered by the plugin lifecycle (install/update). If the user only runs execute.py from the UI, the framework venv is never populated.

Suggested Fix

execute.py should install the dependency in both venvs in Docker environments. For example:

import shutil
import sys
from pathlib import Path

def main() -> int:
    # Install in current venv (agent runtime)
    _install_deps(sys.executable)
    
    # In Docker, also install in framework venv
    framework_python = Path('/opt/venv-a0/bin/python3')
    if framework_python.exists() and str(framework_python) != sys.executable:
        _install_deps(str(framework_python))
    
    return 0

Alternatively, document in README that users in Docker must manually run the install command in both venvs.

Environment

  • Agent Zero in Docker (Kali Linux container)
  • /opt/venv: Python 3.13 (agent runtime)
  • /opt/venv-a0: Python 3.12 (framework runtime)
  • Plugin version: RLM 1.1
  • rlms version: 0.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions