跳到内容

LangGraph Studio 故障排除

 Safari 连接到本地开发服务器时出错

Safari 会阻止 localhost 上的纯 HTTP 流量。如果您使用原生的 langgraph dev 启动 Studio,页面可能会报告“加载助手失败”错误,浏览器 DevTools 会显示网络错误。

快速修复 — 通过安全的 Cloudflare 隧道运行 Studio

pip install -U langgraph-cli>=0.2.6
langgraph dev --tunnel
# Requires @langchain/langgraph-cli>=0.0.26
npx @langchain/langgraph-cli dev

该命令会打印一个类似这样的 URL

https://smith.langchain.com/studio/?baseUrl=https://hamilton-praise-heart-costumes.trycloudflare.com

其中

?baseUrl=https://hamilton-praise-heart-costumes.trycloudflare.com

表示您的智能体服务器暴露的端点。在 Safari 中打开该 URL,Studio 应该会立即加载。

替代方案 — 使用基于 Chromium 的浏览器

Chrome 和其他基于 Chromium 的浏览器允许 localhost 上的 HTTP 流量,因此原生的 langgraph dev 应该无需额外步骤即可工作。

如果仍然无法加载

  1. 确保 studio URL 中的 baseUrl 查询参数指向 隧道 URL 而不是 localhost。
  2. 使用 langgraph --version 确认您的 CLI 版本。

无需其他配置、证书或 CORS 调整。

Brave 连接到本地开发服务器时出错

默认情况下,如果启用了 Brave Shields,Brave 会阻止 localhost 上的纯 HTTP 流量。如果您使用原生的 langgraph dev 启动 Studio,页面可能会报告“加载助手失败”错误,浏览器 DevTools 会显示网络错误。

快速修复 — 禁用 Brave Shields 对 LangSmith 的防护

点击 URL 地址栏旁边的 Brave 图标,在弹出的窗口中关闭 Brave Shields。

Brave Shields

替代方案 — 通过安全的 Cloudflare 隧道运行 Studio

pip install -U langgraph-cli>=0.2.6
langgraph dev --tunnel
# Requires @langchain/langgraph-cli>=0.0.26
npx @langchain/langgraph-cli dev

该命令会打印一个类似这样的 URL

https://smith.langchain.com/studio/?baseUrl=https://hamilton-praise-heart-costumes.trycloudflare.com

其中

?baseUrl=https://hamilton-praise-heart-costumes.trycloudflare.com

表示您的智能体服务器暴露的端点。在 Brave 中打开该 URL,Studio 应该会立即加载。

评论