> ## Documentation Index
> Fetch the complete documentation index at: https://cndoc-langchain.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Studio 快速入门

[LangSmith 部署界面](https://smith.langchain.com) 中的 [Studio](/langsmith/studio) 支持连接两种类型的图：

* 部署在[云端或自托管环境](#deployed-graphs)的图。
* 通过 [Agent Server](#local-development-server) 在本地运行的图。

## 已部署的图

在 [LangSmith 界面](https://smith.langchain.com) 中，可通过 **Deployments** 导航栏访问 Studio。

对于已[部署](/langsmith/deployment-quickstart)的应用程序，您可以将 Studio 作为该部署的一部分进行访问。为此，请在界面中导航至该部署并选择 **Studio**。

这将加载 Studio 并连接到您的实时部署，允许您在该部署中创建、读取和更新[线程](/oss/python/langgraph/persistence#threads)、[助手](/langsmith/assistants)和[记忆](/oss/python/concepts/memory)。

## 本地开发服务器

### 前提条件

要使用 Studio 在本地测试您的应用程序：

* 请先遵循[本地应用程序快速入门](/langsmith/local-dev-testing)指南。
* 如果您不希望数据被[追踪](/langsmith/observability-concepts#traces)到 LangSmith，请在应用程序的 `.env` 文件中设置 `LANGSMITH_TRACING=false`。禁用追踪后，数据将不会离开您的本地服务器。

### 设置

1. 安装 [LangGraph CLI](/langsmith/cli)：

   <CodeGroup>
     ```bash pip theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     pip install -U "langgraph-cli[inmem]"
     langgraph dev
     ```

     ```bash uv theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     uv add "langgraph-cli[inmem]"
     langgraph dev
     ```

     ```bash npm theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
     npx @langchain/langgraph-cli dev
     ```
   </CodeGroup>

   <Warning>
     **浏览器兼容性**
     Safari 会阻止 `localhost` 连接到 Studio。要解决此问题，请使用 `--tunnel` 参数运行命令，通过安全隧道访问 Studio。您需要在 Studio 界面中点击 **Connect to a local server**，手动将隧道 URL 添加到允许的来源中。具体步骤请参阅[故障排除指南](/langsmith/troubleshooting-studio#safari-connection-issues)。
   </Warning>

   这将在本地启动 Agent Server，以内存模式运行。服务器将以监视模式运行，监听代码更改并自动重启。请阅读此[参考文档](/langsmith/cli#dev)以了解启动 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。

2. 对于正在运行的服务器，请通过以下方式之一访问调试器：

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

   如果您的服务器在不同的主机或端口上运行，请相应更新 `baseUrl`。

### （可选）附加调试器

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

<CodeGroup>
  ```bash pip theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  # 安装 debugpy 包
  pip install debugpy
  # 启用调试功能启动服务器
  langgraph dev --debug-port 5678
  ```

  ```bash uv theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  # 安装 debugpy 包
  uv add debugpy
  # 启用调试功能启动服务器
  langgraph dev --debug-port 5678
  ```
</CodeGroup>

然后附加您首选的调试器：

<Tabs>
  <Tab title="VS Code">
    将此配置添加到 `launch.json`：

    ```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    {
        "name": "Attach to LangGraph",
        "type": "debugpy",
        "request": "attach",
        "connect": {
          "host": "0.0.0.0",
          "port": 5678
        }
    }
    ```
  </Tab>

  <Tab title="PyCharm">
    1. 转到 Run → Edit Configurations
    2. 点击 + 并选择 "Python Debug Server"
    3. 设置 IDE 主机名：`localhost`
    4. 设置端口：`5678`（或您在上一步选择的端口号）
    5. 点击 "OK" 并开始调试
  </Tab>
</Tabs>

<Tip>
  如遇到启动问题，请参阅[故障排除指南](/langsmith/troubleshooting-studio)。
</Tip>

## 后续步骤

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

* [运行应用程序](/langsmith/use-studio#run-application)
* [管理助手](/langsmith/use-studio#manage-assistants)
* [管理线程](/langsmith/use-studio#manage-threads)
* [迭代提示词](/langsmith/observability-studio)
* [调试 LangSmith 追踪](/langsmith/observability-studio#debug-langsmith-traces)
* [将节点添加到数据集](/langsmith/observability-studio#add-node-to-dataset)

***

<div className="source-links">
  <Callout icon="terminal-2">
    [将这些文档](/use-these-docs)通过 MCP 连接到 Claude、VSCode 等工具，以获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/langsmith/quick-start-studio.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
