跳到正文Skip to content
Agent J Beta
菜单Menu
中文EN
登录Sign in

搜索文档和页面Search docs and pages

文档Docs

Agent J 专用浏览器与登录保活Agent J's own browser and staying signed in

Agent J 自带一个专用浏览器,帮你的自动化账号保持登录,每天早上体检,掉线时用手机扫码卡重新登录。Agent J installs its own browser, keeps your automation accounts signed in, checks them every morning and helps you reconnect with a phone QR card.

Agent J 在你的电脑上自带一个专用浏览器。你的 Agent 用它在已登录的网站上干活——Gmail、YouTube 工作室、B站、抖音、微信公众号、视频号,或者你自己加的网站。默认就装好,可以关掉;万一没装成功,Agent J 照常能用,只是要用浏览器的活先等着。

安装 Agent J · 电脑端说明 · 让电脑保持唤醒 · 命令参考

你要做的:说一声「早上好」

不需要任何浏览器按钮。跟你的 Agent 说「早上好」(或 good morning),它会检查自动化要用的每个网站:

  • 都登录着:给你一份根据昨夜真实报告写的简短晨报;
  • 某个支持扫码的网站掉线了(B站、抖音、公众号、视频号):已配对的手机上弹出一张登录卡,上面只有这个网站的二维码;
  • 要密码或通行密钥的网站(Google、Gmail、YouTube):登录页会在电脑屏幕上打开,你在电脑前登录。

同一台手机扫不了自己的屏幕:用另一台设备显示这张卡,或长按保存图片,再在对应 App 里从相册识别(不是每个 App 都支持)。二维码最长两分钟有效,准备好了点「刷新二维码」。「我扫好了」只是请电脑现在看一眼——是否登录成功,由电脑上的浏览器来判断。说「稍后」也行,只有要用那个网站的活会先等着。

「早上好」只是登录体检,不等于允许发布。发邮件、发布、付款、删除,照样要在手机上批准。

交给你的 Agent

装好的 Agent J(0.18 及以上)会自己做好这些。已经装过的电脑,或者想检查一下,把下面这段发给你的 Agent:

请在这台电脑上配好 Agent J 的专用浏览器,并告诉我哪些已经就绪。先读 https://agentj.app/docs/browser-automation/zh.md 和 agentj-browser 技能。运行 agentj browser status --json;没就绪就运行 agentj browser setup --json(第一次会下载约 200 MB 并校验)。缺系统库就用 agentj sudo 安装,再运行一次 setup。如果我关掉过浏览器,就尊重我的选择。然后问我自动化要用哪些网站(建议先配 Gmail),用 agentj browser sites add 加上,运行 agentj browser check --json,需要登录的用 agentj browser login <网站> --wait 带我登录。不要在聊天里要密码、验证码或二维码截图,不要读取或导出 cookie,也不要把浏览器的本机地址发到任何地方。最后告诉我浏览器状态、每个网站的状态和检查时间,以及我还要做什么。

macOS

Agent J 的浏览器是作为 LaunchAgent 跑在你已登录的桌面会话里的。所以它会显示在屏幕上,只要你保持登录,它就一直在。Mac 休眠或注销时,它就离线了——Mac 醒来后,会补做一次早上的体检。想让 Mac 一直在线,看让电脑保持唤醒。

agentj browser setup --json
agentj browser status --json

Linux

浏览器作为 systemd --user 服务,和 Agent J 一起跑。桌面电脑有屏幕,它会弹出窗口;服务器没屏幕,就无界面运行:扫码登录照样在手机上搞定,需要密码的网站,得先在带屏幕的电脑上登一次。服务器记得开 linger,注销后它也能继续跑:

loginctl enable-linger "$USER"
agentj browser setup --json

如果 setup 报告缺系统库(missing_libs),Agent 会通过手机密码卡(agentj sudo)装好,再跑一次 setup。

Ubuntu 23.10 及以上版本限制了浏览器沙箱。如果你装的是系统软件包里的 Google Chrome 或 Chromium,Agent J 会用它配合自己的私有登录资料;没装的话,setup 会报 sandbox_blocked,然后 Agent 运行 agentj browser sandbox-fix,在手机密码卡上请你批准后,只为本用户的 Agent J 浏览器开启沙箱。Agent J 从不关闭沙箱。

Windows(WSL2)

Agent J 和它的浏览器都跑在 WSL2(Linux 那边),WSLg 负责把窗口显示在 Windows 桌面上。登录资料留在 Linux 文件系统里,不放在 /mnt/c 下。不支持 WSL1,请升级到带 WSLg 的 WSL2。Agent J 不会碰你日常用的 Windows Chrome。WSL 停了或者 Windows 休眠了,浏览器就离线。

agentj browser setup --json

已经有一个给自动化用的浏览器?

如果这台电脑上已经开着一个能被自动化工具连接的浏览器(比如用 --remote-debugging-port=9222 启动、各网站都已登录的 Chromium),Agent J 不会再装一套:agentj browser setup 发现它会先问你。Agent 用 agentj browser adopt --endpoint http://127.0.0.1:9222 提议(只限本机回环地址),你在首次准备清单页上点「用我已有的浏览器」才生效。之后 Agent J 原样检查和使用这个浏览器:不启动、不关闭、不修改它,不读取它的 cookie,只打开和关闭自己开的标签页。它没在运行时,清单会写「你登记的浏览器没在运行」。agentj browser adopt --forget 可以不再使用它。

Agent J 自己的浏览器和你平时用的一眼就能分开:窗口标题写着「Agent J 专用浏览器 · Agent J browser」,起始页是紫色的。从清单里点登录时,它会弹到最前面(Linux 的 Hyprland 或 X11、macOS 支持)。

可以添加的网站

网站模板怎么登录
Google 账号google在电脑前登录(密码 / 通行密钥)。能简化其他「用 Google 登录」的网站,但每个网站可能仍要单独授权。
Gmailgmail在电脑前登录。只确认是否登录,从不读邮件。
YouTube 工作室youtube-studio在电脑前登录;频道权限单独确认。
B站创作中心bilibili手机扫码卡
抖音创作者中心douyin-creator手机扫码卡
微信公众号mp-weixin手机扫码卡;部分账号每天都要重新扫
微信视频号助手channels-weixin手机扫码卡
其他网站custom在电脑前登录;Agent J 没有可信的检查方法,所以显示「尚未确认」
agentj browser sites add gmail
agentj browser sites add custom --origin https://shop.example.com --url https://shop.example.com/admin
agentj browser sites list --json

添加网站只是把它加进每日体检,不会启用任何任务。

每日体检

每天本地时间 08:00(用 agentj config set browser.check_time 07:30 修改),Agent J 只读地检查每个网站:在自己的标签页里打开这个网站固定的页面,只看页面最终停在哪里,然后关掉这个标签页。它不会替你登录、刷新 cookie、点任何东西,也不会让你退出登录。08:00 时电脑在休眠的话,醒来后补查一次。

每日体检从不发二维码。某个网站刚掉线,你会收到一条简短提醒(22:00 到 07:00 之间不发),下次你说「早上好」时 Agent 会带你重新登录。做任务前,超过 15 分钟没确认的网站会先复查。体检只代表检查那一刻的状态,网站当天晚些时候仍可能让你重新登录。

状态包括:已登录、需要登录、尚未确认(超时或页面改版不算掉线)、暂时不可用(没网或浏览器没在运行)以及已关闭。

agentj browser check --json
agentj browser check --site mp-weixin --if-stale --json

Telegram

如果你接了 Telegram 机器人,有登录卡在等你时它会收到一条文字提醒——不带链接,也不带二维码。Telegram 机器人不是端到端加密的:Telegram 能看到它收到的内容。想让二维码图片也发到 Telegram,就在手机登录卡上点「以后二维码也发到 Telegram」。只有你能在手机上打开它;Agent 只能关掉:

agentj browser telegram-qr status
agentj browser telegram-qr off

隐私与限制

  • 登录信息留在你的电脑上。登录资料在 Agent J 的私有状态目录里,只有你的系统用户能读。cookie 和密码从不离开电脑,也不会进聊天;Agent J 也不会导入你日常浏览器的数据。
  • 浏览器的控制端口只监听 127.0.0.1,端口随机,不转发、不走隧道,也不发到我们的中继。每次启动 Agent J 都会检查,不符合就停掉浏览器。以你自己的系统用户运行的其他程序仍然能用它——私有资料夹是把数据分开,不是防你自己软件的沙箱。
  • 登录卡里只有裁剪出来的二维码,端到端加密发到你已配对的手机,不留在聊天记录和手机上;登录成功、过期、点「先不登录」或「全部停下」后立即清除。我们的服务器只看到加密数据。
  • 下载:约 200 MB,从官方来源下载 Chrome for Testing,并按已签名的 Agent J 安装包里的清单逐字节校验(需要约 1.5 GB 空闲空间)。中国大陆可以设置一个内容完全相同的 HTTPS 镜像:agentj config set browser.mirror https://<镜像地址>;对不上就直接丢弃。
  • 关掉就是关掉:agentj browser disable 停掉浏览器和每日体检,保留你的登录;agentj browser enable 重新打开。删除登录资料是单独的操作,Agent 会先问你。
  • 暂不支持:在手机上实时看整个浏览器画面,以及 WSL 之外的 Windows 原生浏览器。网站仍可能要求额外验证,Agent J 从不设法绕过。

Agent J comes with its own browser on your computer. Your Agent uses it for web work on sites you are signed in to — Gmail, YouTube Studio, Bilibili, Douyin, WeChat Official Accounts, WeChat Channels or any site you add. It is installed by default, you can turn it off, and if it fails to install Agent J still works: only the browser jobs wait.

Install Agent J · On your computer · Keep your computer awake · Command reference

What you do: say "good morning"

You never need a browser button. Say good morning (or 「早上好」) to your Agent. It checks every site your automations use, then:

  • signed in everywhere: a short morning brief from the real overnight reports;
  • a site signed out and it supports QR sign-in (Bilibili, Douyin, WeChat Official Accounts, WeChat Channels): a sign-in card appears on your paired phone with only that site's QR code;
  • a site that needs a password or passkey (Google, Gmail, YouTube): the sign-in page opens on your computer's screen; you sign in there.

A phone cannot scan its own screen. Show the card on another device, or long-press to save the image and open it from your photos in the site's app (not every app supports that). The card is valid for up to two minutes; tap New QR code when you are ready. "I scanned it" only asks the computer to look — the computer's browser decides whether you are signed in. Say "later" and only the work that needs that site waits.

Good morning is a sign-in check, never permission to publish. Sending mail, publishing, paying or deleting still ask on your phone.

Give this to your Agent

Installed Agent J (0.18 or newer) does this by itself. For an existing computer, or to check it, send your Agent:

Set up Agent J's own browser on this computer and tell me what is ready. Read https://agentj.app/docs/browser-automation/en.md and the agentj-browser skill. Run agentj browser status --json; if it is not ready run agentj browser setup --json (it downloads about 200 MB once and verifies it). If system libraries are missing, install them with agentj sudo and run setup again. Respect it if I turned the browser off. Then ask me which sites my automations use (suggest Gmail first), add them with agentj browser sites add, run agentj browser check --json and help me sign in to any that need it with agentj browser login <site> --wait. Never ask me for passwords, codes or QR screenshots in chat, never read or export cookies, and never send the browser's local address anywhere. Report the browser state, each site's status with the check time, and anything I still need to do.

macOS

Agent J's browser runs as a LaunchAgent in your logged-in session, so it is visible on your screen and stays running while you are logged in. When the Mac sleeps or you log out it is offline — the morning check catches up once when the Mac wakes. Keep the Mac reachable with keep awake.

agentj browser setup --json
agentj browser status --json

Linux

The browser runs as a systemd --user service next to Agent J. On a desktop it opens windows on your screen. On a server without a screen it runs headless: QR sign-ins still work from the phone; sites that need a password must be signed in once on a computer with a screen. For a server, enable lingering so it keeps running after you log out:

loginctl enable-linger "$USER"
agentj browser setup --json

If setup reports missing libraries (missing_libs), your Agent installs them through the phone password card (agentj sudo), then runs setup again.

Ubuntu 23.10 and newer restrict the browser's sandbox. If Google Chrome or Chromium from your system's packages is installed, Agent J uses that program with its own private profile; otherwise setup reports sandbox_blocked and your Agent runs agentj browser sandbox-fix, which asks for your approval on the phone password card and allows the sandbox for this user's Agent J browser only. Agent J never turns the sandbox off.

Windows (WSL2)

Agent J and its browser both run inside WSL2 (Linux side), and WSLg shows the browser window on your Windows desktop. The profile stays in the Linux file system, never under /mnt/c. WSL1 is not supported — upgrade to WSL2 with WSLg. Agent J never uses your everyday Windows Chrome. When WSL stops or Windows sleeps, the browser is offline.

agentj browser setup --json

Already running a browser for automation?

If this computer already runs a browser that automation tools connect to (for example a Chromium started with --remote-debugging-port=9222, signed in everywhere), Agent J does not install a second one: agentj browser setup finds it and asks first. Your Agent proposes it with agentj browser adopt --endpoint http://127.0.0.1:9222 (this computer's loopback only); it takes effect when you tap "Use my existing browser" on the first-run checklist page. From then on Agent J checks and uses that browser as it is — it never starts, stops or changes it, never reads its cookies, and only opens and closes its own tabs. If it is not running, the checklist says "the browser you registered is not running". agentj browser adopt --forget stops using it.

Agent J's own browser is easy to tell apart from your everyday one: its window title says "Agent J 专用浏览器 · Agent J browser" and its start page is purple. When you sign in from the checklist, it comes to the front (Linux with Hyprland or X11, and macOS).

Sites you can add

SiteTemplateHow you sign in
Google accountgoogleOn the computer (password / passkey). Makes other "Sign in with Google" sites easier, but each site may still ask for its own consent.
GmailgmailOn the computer. Only the signed-in state is checked; mail is never read.
YouTube Studioyoutube-studioOn the computer; channel access is confirmed separately.
Bilibili creator centerbilibiliPhone QR card
Douyin creator centerdouyin-creatorPhone QR card
WeChat Official Accountmp-weixinPhone QR card; some accounts need a fresh scan every day
WeChat Channels assistantchannels-weixinPhone QR card
Any other sitecustomOn the computer; shown as "not verified" because Agent J has no trusted check for it
agentj browser sites add gmail
agentj browser sites add custom --origin https://shop.example.com --url https://shop.example.com/admin
agentj browser sites list --json

Adding a site only adds it to the daily check. It never turns on a task.

The daily check

Every day at 08:00 your local time (change it with agentj config set browser.check_time 07:30) Agent J checks each site read-only: it opens the site's fixed page in its own tab, looks only at where the page ends up, and closes that tab. It never signs in for you, refreshes cookies, clicks anything or signs you out. A computer that was asleep at 08:00 checks once when it wakes.

The daily check never sends a QR code. If a site newly needs a sign-in, you get one short note (not between 22:00 and 07:00), and your Agent helps you the next time you say good morning. Before a task, your Agent re-checks any site not confirmed in the last 15 minutes. A check says what was true at that moment; sites can still sign you out later in the day.

Statuses: signed in · needs a sign-in · not verified (a timeout or a changed page is never treated as signed out) · unavailable (no network or the browser is not running) · off.

agentj browser check --json
agentj browser check --site mp-weixin --if-stale --json

Telegram

If you connected a Telegram bot, it gets a text reminder when a sign-in card is waiting — no link, no QR. A Telegram bot is not end-to-end encrypted: Telegram can read what it receives. If you also want the QR image itself there, tap Also send QR codes to Telegram on a sign-in card on your phone. Only you can turn this on, from the phone; your Agent can only turn it off:

agentj browser telegram-qr status
agentj browser telegram-qr off

Privacy and limits

  • Your sign-ins stay on your computer. The profile lives in Agent J's private state folder (only your user can read it). Cookies and passwords never leave the computer and never enter a chat; Agent J never imports your everyday browser's data.
  • The browser's control port listens on 127.0.0.1 only, on a random port, and is never forwarded, tunnelled or sent to our relay. Agent J checks this on every start and stops the browser otherwise. Another program running as your own user could still use it — the private profile separates data; it is not a sandbox against your own software.
  • The QR card contains only the cropped QR code, travels end-to-end encrypted to your paired phones, is not kept in the chat or on the phone, and is wiped after success, expiry, "Not now" or Stop everything. Our servers only see encrypted data.
  • Download: about 200 MB, Chrome for Testing from the official source, checked byte for byte against a manifest inside the signed Agent J package (about 1.5 GB free space needed). In mainland China you can set an HTTPS mirror that serves the same bytes: agentj config set browser.mirror https://<mirror>; anything that does not match is discarded.
  • Off means off: agentj browser disable stops the browser and the daily check and keeps your sign-ins; agentj browser enable turns it back on. Deleting the profile is a separate delete your Agent asks you about.
  • Not yet: watching the whole browser screen live from the phone, and a native Windows browser outside WSL. Sites may still ask for extra verification; Agent J never tries to get around it.

这一页的 Markdown 原文This page as Markdown: zh.md · en.md