如何自动启动Agent
如果您需要每次重启设备时自动启动Agent,请运行以下脚本。
Agent需要显示器才能工作。如果您的系统没有显示器,请使用虚拟显示器。示例:
xvfb-run mlxWindows
import os
import subprocess
def connect_agent():
    username = os.getlogin()
    exe_path = f'C:\\Users\\USERNAME\\AppData\\Local\\MLX\\agent.exe'
    agent_connection = subprocess.run([exe_path])
    assert agent_connection.returncode == 0
    if agent_connection.returncode == 0:
        print("Agent connected")
    else:
        print(f"Failed to connect agent. Error {agent_connection.returncode}")
if __name__ == "__main__":
  connect_agent()macOS
import subprocess
def connect_agent():
    agent_connection = subprocess.Popen(['open', '/Applications/Multilogin.app/'])
    agent_connection.wait()  
    return_code = agent_connection.returncode
    if return_code == 0:
        print("Agent connected")
    else:
        print(f"Failed to connect agent. Error {return_code}")
connect_agent()Linux
您可以通过以下方式启动Agent:
/opt/mlx/agent.bin或者简单来说:
mlx 
        
