Tự động khởi chạy Agent
Tác nhân cần có màn hình để hoạt động. Nếu hệ thống của bạn không có, hãy sử dụng màn hình ảo. Ví dụ (cho Linux):
xvfb-run mlx
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.
Windows
Chạy tập lệnh thông qua IDE hoặc Command Prompt. Bạn chưa biết cách? Hãy đọc bài viết sau: Bắt đầu với tập lệnh tự động hóa.
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
Chạy tập lệnh qua IDE hoặc Terminal. Bạn chưa biết cách? Đọc bài viết sau: Bắt đầu với tập lệnh tự động hóa.
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