{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/vi/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Sử dụng AI Agent","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"sử-dụng-ai-agent","__idx":0},"children":["Sử dụng AI Agent"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Trang này giải thích cách sử dụng ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ml-cli"]}," với các trợ lý lập trình AI như Codex, Claude Code, Cursor, Gemini CLI và các công cụ khác."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"sao-chép-vào-agent","__idx":1},"children":["Sao chép vào Agent"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sao chép văn bản bên dưới và dán vào trợ lý AI của bạn để tự động cài đặt MoreLogin CLI:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Set up MoreLogin CLI for me, then use it whenever I ask you to operate MoreLogin.\n\nOfficial docs:\nhttps://guide.morelogin.com/cli\n\nGoal:\n- Install or update `ml-cli`.\n- Verify MoreLogin Desktop local API access.\n- Read the built-in agent package and guide.\n- After setup, ask what MoreLogin task I want to automate first.\n\nFirst detect my OS and CPU architecture, then run the matching install command.\n\nWindows x64 PowerShell:\n\n```powershell\n$dir = \"$env:USERPROFILE\\.morelogin\\bin\"\nNew-Item -ItemType Directory -Force -Path $dir | Out-Null\nInvoke-WebRequest -Uri \"https://releases.morelogin.com/prod/MoreLogin_AirDrop_window_x64_cli/2.6.3/MoreLogin_AirDrop_window_x64_cli_2.6.3.0.exe\" -OutFile \"$dir\\ml-cli.exe\"\n$userPath = [Environment]::GetEnvironmentVariable(\"Path\", \"User\")\nif ($userPath -notlike \"*$dir*\") { [Environment]::SetEnvironmentVariable(\"Path\", \"$userPath;$dir\", \"User\") }\n& \"$dir\\ml-cli.exe\" --version\n```\n\nmacOS Intel x64:\n\n```bash\nmkdir -p \"$HOME/.local/bin\"\ncurl -L \"https://releases.morelogin.com/prod/MoreLogin_AirDrop_darwin_x64_cli/2.6.3/MoreLogin_AirDrop_darwin_x64_cli_2.6.3.0\" -o \"$HOME/.local/bin/ml-cli\"\nchmod +x \"$HOME/.local/bin/ml-cli\"\nexport PATH=\"$HOME/.local/bin:$PATH\"\nml-cli --version\n```\n\nmacOS Apple Silicon arm64:\n\n```bash\nmkdir -p \"$HOME/.local/bin\"\ncurl -L \"https://releases.morelogin.com/prod/MoreLogin_AirDrop_darwin_arm64_cli/2.6.3/MoreLogin_AirDrop_darwin_arm64_cli_2.6.3.0\" -o \"$HOME/.local/bin/ml-cli\"\nchmod +x \"$HOME/.local/bin/ml-cli\"\nexport PATH=\"$HOME/.local/bin:$PATH\"\nml-cli --version\n```\n\nLinux x64:\n\n```bash\nmkdir -p \"$HOME/.local/bin\"\ncurl -L \"https://releases.morelogin.com/prod/MoreLogin_AirDrop_linux_x64_cli/2.6.3/MoreLogin_AirDrop_linux_x64_cli_2.6.3.0\" -o \"$HOME/.local/bin/ml-cli\"\nchmod +x \"$HOME/.local/bin/ml-cli\"\nexport PATH=\"$HOME/.local/bin:$PATH\"\nml-cli --version\n```\n\nAfter installation, run:\n\n```bash\nml-cli --help\nml-cli doctor --output-json\nml-cli agent-bootstrap\nml-cli agent-package\nml-cli agent-guide\n```\n\nFor long-term use, install persistent rules for my AI agent:\n\n```bash\nml-cli agent-list\nml-cli agent-init --agent <agent> --scope user --dry-run\nml-cli agent-init --agent <agent> --scope user --write\n```\n\nUse the correct `<agent>` value for my AI client. Supported values are listed by `ml-cli agent-list`, including `codex`, `claude-code`, `cursor`, `gemini`, `qwen-code`, `opencode`, `openclaw`, `trae`, `hermes`, `qclaw`, `easyclaw`, and `workbuddy`.\n\nUse `ml-cli` for MoreLogin browser profiles, environment lists, cloud phones, proxies, groups, tags, schedules, and local API status.\n\nDo not guess IDs, payload fields, or command formats. If unsure, inspect help first:\n\n```bash\nml-cli env --help\nml-cli cloudphone --help\nml-cli proxy --help\nml-cli schedule --help\n```\n\nOperation timing:\n- `env start` / `env open` takes 3-5 seconds; use `--timeout 30`.\n- `cloudphone power-on` / `cloudphone open` takes 30-90 seconds; always use `--timeout 120`.\n- All other commands complete within the default `--timeout 15`.\n\nNatural language routing rules:\n- \"How many browser profiles are on the first page?\" -> run `ml-cli env list --page-no 1 --page-size 20`, then count `data.dataList`.\n- \"Open P-1\" -> run `ml-cli --timeout 30 env open --name P-1`.\n- \"Find browser profiles by group, tag, name, or remark containing Amazon\" -> run `ml-cli env find --keyword Amazon`.\n- \"Open the profile whose group, tag, name, or remark contains Amazon\" -> run `ml-cli --timeout 30 env open --keyword Amazon`.\n- \"Open cloud phone CP-204 and show the window\" -> run `ml-cli --timeout 120 cloudphone open --keyword CP-204 --headless false`.\n- \"Close cloud phone CP-204\" -> run `ml-cli --timeout 30 cloudphone close --keyword CP-204`.\n- \"Create a new browser profile\" -> run `ml-cli env create-quick`.\n- \"Delete browser profile P-1\" -> find it first with `ml-cli env find --name P-1`, confirm with the user, then run `ml-cli env delete --env-ids <id>`.\n- \"Create a proxy\" -> run `ml-cli proxy create --proxy-ip <ip> --proxy-port <port> --proxy-provider 0`.\n- \"Show all tags\" -> run `ml-cli tag list`.\n- \"Create a group called test\" -> run `ml-cli group create --group-name test`.\n- \"Set proxy for profile P-1\" -> find the profile first, then run `ml-cli env set-proxy --env-ids <id> --proxy-ip <ip> --proxy-port <port> --proxy-type 0 --proxy-provider 0`.\n\nCandidate selection rule:\n- `env open`, `cloudphone open`, and `cloudphone close` may operate only when exactly one candidate matches.\n- If zero or multiple candidates match, show the candidates and ask me which one to operate.\n\nLocal access rule:\nMoreLogin CLI connects to `127.0.0.1:<port>`, usually `127.0.0.1:40000`. Started browser profiles may expose `127.0.0.1:<debugPort>`.\nIf Codex, Claude Code, Cursor, or another AI client reports `connect EPERM 127.0.0.1:40000`, `connect EPERM 127.0.0.1:<debugPort>`, `connection refused`, `request timeout`, or `Could not detect MoreLogin port`, treat it as local sandbox/permission first. Request local access approval or elevated execution and rerun the same command. Do not repeatedly start the same profile after an EPERM error; check status first.\n\nWhen a command fails, show the original MoreLogin response. Do not redact proxy passwords, phone numbers, device identifiers, or other fields unless I explicitly ask you to. For scripts, add `--fail-on-business-error` when a non-zero top-level JSON `code` should fail the command.\n\nFuture updates:\n- To update `ml-cli`, run `ml-cli self-update`. Or rerun this setup prompt and overwrite the existing binary with the newest official download.\n- To update persistent agent rules, rerun `ml-cli agent-init --agent <agent> --scope <scope> --write`.\n- Restart the AI agent if it only loads memory/rules files on startup.\n\nAfter verification, tell me:\n- install path\n- `ml-cli --version`\n- `ml-cli doctor --output-json` result\n- available top-level commands\n\nThen ask me what MoreLogin task I want to automate first.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Bạn cũng có thể tạo cùng một văn bản từ CLI đã cài đặt:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"ml-cli install-prompt\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"lệnh-agent-guide","__idx":2},"children":["Lệnh Agent Guide"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sau khi cài đặt, agent nên đọc hướng dẫn tích hợp:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"ml-cli agent-guide\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Hướng dẫn cho agent biết:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["khi nào sử dụng ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ml-cli"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["cách khám phá định dạng lệnh"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["cách ánh xạ ngôn ngữ tự nhiên thành lệnh"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["khi nào cần xác nhận"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["cách xử lý lỗi sandbox cục bộ như ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["connect EPERM 127.0.0.1:40000"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"lệnh-doctor","__idx":3},"children":["Lệnh Doctor"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sử dụng ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["doctor"]}," để xác minh kết nối API cục bộ:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"ml-cli doctor\nml-cli doctor --output-json\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["doctor"]}," kiểm tra khám phá cổng và gọi endpoint trạng thái cục bộ của MoreLogin."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"lệnh-tiện-ích-cho-hồ-sơ-trình-duyệt","__idx":4},"children":["Lệnh tiện ích cho hồ sơ trình duyệt"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sử dụng các lệnh này khi người dùng tham chiếu hồ sơ theo tên:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"ml-cli env find --name P-1\nml-cli env find --keyword Amazon\nml-cli env open --name P-1\nml-cli env open --keyword \"team-a\"\nml-cli env open --name P-1 --exact\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["env find --keyword"]}," tìm kiếm tên môi trường, tên nhóm, tên thẻ và ghi chú qua API cục bộ của MoreLogin."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["env open"]}," chỉ khởi động hồ sơ khi khớp chính xác một ứng viên. Nếu nhiều hồ sơ khớp, nó in danh sách ứng viên và thoát mà không khởi động gì."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"lệnh-tiện-ích-cho-điện-thoại-đám-mây","__idx":5},"children":["Lệnh tiện ích cho điện thoại đám mây"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sử dụng các lệnh này khi người dùng tham chiếu điện thoại đám mây theo tên:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"ml-cli cloudphone find --name CP-1\nml-cli cloudphone find --keyword \"android-test\"\nml-cli --timeout 120 cloudphone open --name CP-1\nml-cli --timeout 120 cloudphone open --keyword \"android-test\"\nml-cli --timeout 120 cloudphone open --name CP-1 --headless false\nml-cli --timeout 30 cloudphone close --name CP-1\nml-cli --timeout 30 cloudphone close --keyword \"android-test\"\nml-cli --timeout 120 cloudphone open --name CP-1 --exact\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cloudphone find --keyword"]}," tìm kiếm tên điện thoại đám mây, tên nhóm, tên thẻ và ghi chú qua API cục bộ của MoreLogin."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cloudphone open"]}," và ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cloudphone close"]}," chỉ hoạt động khi khớp chính xác một ứng viên. Nếu nhiều điện thoại khớp, chúng in danh sách ứng viên và thoát mà không thay đổi trạng thái."," ","Đối với ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--headless"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," hiển thị cửa sổ điện thoại đám mây và ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," không hiển thị. Giá trị mặc định của API là ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"ví-dụ-ngôn-ngữ-tự-nhiên","__idx":6},"children":["Ví dụ ngôn ngữ tự nhiên"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sau khi cài đặt, bạn có thể hỏi:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Có bao nhiêu hồ sơ trình duyệt trên trang đầu tiên của MoreLogin?\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Hiển thị trang đầu tiên của hồ sơ trình duyệt MoreLogin, bao gồm tên, ID và trạng thái.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Mở hồ sơ P-1.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Kiểm tra xem hồ sơ P-1 đã chạy chưa.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Đóng hồ sơ P-1.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Tìm hồ sơ trình duyệt có tên chứa Amazon.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Tìm hồ sơ có tên môi trường, nhóm, thẻ hoặc ghi chú chứa Amazon.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Mở môi trường trình duyệt có nhóm hoặc thẻ chứa Amazon. Nếu có nhiều hơn một, hiển thị danh sách ứng viên trước.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Khởi động hồ sơ trình duyệt đầu tiên và cho tôi biết cổng gỡ lỗi.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Hiển thị tất cả các nhóm MoreLogin.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Hiển thị tất cả các thẻ MoreLogin.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Hiển thị trang đầu tiên của bản ghi proxy.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Hiển thị danh sách điện thoại đám mây.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Mở điện thoại đám mây CP-1.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Tìm điện thoại đám mây có nhóm, thẻ hoặc ghi chú chứa Android.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Mở điện thoại đám mây có tên, nhóm, thẻ hoặc ghi chú chứa CP-204 và hiển thị cửa sổ.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Đóng điện thoại đám mây CP-1.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"Đọc trợ giúp ml-cli và tóm tắt các lệnh hồ sơ trình duyệt phổ biến.\n","lang":"text"},"children":[]}]},"headings":[{"value":"Sử dụng AI Agent","id":"sử-dụng-ai-agent","depth":1},{"value":"Sao chép vào Agent","id":"sao-chép-vào-agent","depth":2},{"value":"Lệnh Agent Guide","id":"lệnh-agent-guide","depth":2},{"value":"Lệnh Doctor","id":"lệnh-doctor","depth":2},{"value":"Lệnh tiện ích cho hồ sơ trình duyệt","id":"lệnh-tiện-ích-cho-hồ-sơ-trình-duyệt","depth":2},{"value":"Lệnh tiện ích cho điện thoại đám mây","id":"lệnh-tiện-ích-cho-điện-thoại-đám-mây","depth":2},{"value":"Ví dụ ngôn ngữ tự nhiên","id":"ví-dụ-ngôn-ngữ-tự-nhiên","depth":2}],"frontmatter":{"seo":{"title":"Sử dụng AI Agent"}},"lastModified":"2026-07-06T01:44:59.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/vi/cli/agent","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}