Tự động khởi chạy agent
Nếu bạn cần agent được khởi chạy tự động mỗi khi bạn khởi động lại thiết bị của mình, hãy chạy các tập lệnh bên dưới.
Agent cần một màn hình để làm việc. Nếu hệ thống của bạn không có, hãy sử dụng màn hình ảo. Ví dụ:
xvfb-run mlx
Windows
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 X.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
Bạn có thể khởi chạy agent bằng cách gọi:
/opt/mlx/agent.bin
Hoặc đơn giản:
mlx