Mastra 详解 Firecrawl 浏览器提供器
Mastra 发布了一篇关于 @mastra/browser-firecrawl 的实操说明;该浏览器提供器由 Firecrawl 团队为 Mastra 构建,号称可让智能体使用托管浏览器访问需要登录的页面,而无需在本机运行 Chromium,演示中它登录 Sauce Labs 测试商店并购买了背包。Mastra 表示 FirecrawlBrowser 继承其 AgentBrowser,默认提供相同的 16 个浏览器工具,区别只在于 Chromium 的运行位置:AgentBrowser 用 Playwright 在本机启动,FirecrawlBrowser 则连接 Firecrawl 会话并通过 CDP 操作;浏览器会话与智能体线程绑定,但线程到会话的映射保存在服务器进程中,重启或请求落到其他实例时会得到没有 Cookie 的新浏览器,Firecrawl 默认在闲置 5 分钟或总计 10 分钟后结束会话。Mastra 还提醒,通过 browser_type 工具输入的密码会以明文进入记忆和追踪记录,因为该工具字段名为 text 而非 password;使用命名配置文件并将 saveChanges 设为 false,可让智能体在模型看不到密码的情况下保持已登录状态。
该实操说明展示了如何用按线程隔离的托管浏览器会话维持智能体登录状态,同时指出若不使用命名配置文件,浏览器工具输入的密码可能落入追踪记录。
Firecrawl just published a walkthrough for @mastra/browser-firecrawl, the browser provider their team built for Mastra. It gives your agent a hosted browser for pages behind a login, with no Chromium running on your machine. Their demo logs into Sauce Labs' test store and checks out a backpack.
Their post covers setup. We'll walk through what happens inside Mastra when the agent logs in. One detail matters once you move from the demo to a real login: where the password ends up.
Same tools, different browser
FirecrawlBrowser extends our AgentBrowser, so the model drives the page the same way with either one. Both give the agent the same 16 browser tools by default. The only difference is where Chromium runs. AgentBrowser launches it on your machine with Playwright. FirecrawlBrowser gets a session from Firecrawl and connects to it over CDP.
Each browser session belongs to a thread. Inside @mastra/agent-browser, every page tool pulls threadId from the agent's execution context before running:
browser/agent-browser/src/tools/type.ts
#Mastra#Firecrawl#@mastra/browser-firecrawl#AgentBrowser#Playwright#Sauce Labs#Chromium