Skip to content
LangSmith 文档版本 跟随上游 源快照 778eeea2 更新于 2026-10-18

Studio 入门

Studio 在 LangSmith Deployment UI 中支持连接两种类型的图:

已部署的图

在 LangSmith UI 中,可以从 Deployments 导航访问 Studio。

对于已部署的应用,你可以作为该部署的一部分访问 Studio。为此,请在 UI 中导航到该部署并选择 Studio。

这将加载连接到你的实时部署的 Studio,让你可以在该部署中创建、读取和更新线程、助手和记忆。

本地开发服务器

前提条件

要在本地使用 Studio 测试应用:

  • 先遵循本地应用快速入门。
  • 如果你不希望将数据追踪到 LangSmith,请在应用的 .env 文件中设置 LANGSMITH_TRACING=false。禁用追踪后,任何数据都不会离开你的本地服务器。

准备

  1. 安装 LangGraph CLI:
bash
pip install -U "langgraph-cli[inmem]"
langgraph dev
bash
uv add "langgraph-cli[inmem]"
langgraph dev
bash
npx @langchain/langgraph-cli dev

WARNING

浏览器兼容性 Safari 会阻止与 Studio 的 localhost 连接。要解决此问题,请使用 --tunnel 运行命令,通过安全隧道访问 Studio。你需要点击 Studio UI 中的 Connect to a local server,手动将隧道 URL 添加到允许的源。步骤请参阅故障排除指南。

这将在本地启动 Agent Server,并以内存模式运行。服务器会以监视模式运行,监听代码变更并自动重启。请阅读此参考,了解启动 API 服务器的所有选项。

你将看到以下日志:

> Ready!
>
> - API: [http://localhost:2024](http://localhost:2024/)
>
> - Docs: http://localhost:2024/docs
>
> - LangSmith Studio Web UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024

启动后,你将自动跳转到 Studio。

  1. 对于正在运行的服务器,请使用以下方式之一访问调试器:

    1. 直接导航到以下 URL:https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024。
    2. 在 UI 中导航到 Deployments,点击某个部署上的 Studio 按钮,输入 http://127.0.0.1:2024 并点击 Connect。

    如果在其他主机或端口上运行服务器,请相应更新 baseUrl。

(可选)附加调试器

要进行带断点和变量检查的逐步调试,请运行以下命令:

bash
# Install debugpy package
pip install debugpy
# Start server with debugging enabled
langgraph dev --debug-port 5678
bash
# Install debugpy package
uv add debugpy
# Start server with debugging enabled
langgraph dev --debug-port 5678

然后附加你偏好的调试器:

将此配置添加到 launch.json:

json
{
    "name": "Attach to LangGraph",
    "type": "debugpy",
    "request": "attach",
    "connect": {
      "host": "0.0.0.0",
      "port": 5678
    }
}

TIP

如果入门遇到问题,请参阅故障排除指南。

后续步骤

有关如何运行 Studio 的更多信息,请参阅以下指南:


BytesRouter 是社区翻译站点,所有译文仅供参考,一切以官方英文原文为准。