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

# 运行

> Agent Server 中运行的概述，包括如何启动后台运行、无状态运行以及取消运行。

**运行**（run）是对[助手](/langsmith/assistants)的一次调用。执行运行时，您需要指定使用哪个助手——可以通过默认助手的图ID，或通过特定配置的助手ID来指定。

```mermaid actions={false} theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
flowchart TB
    subgraph deploy[部署]
        G[图代码<br/>━━━━━━━━━<br/>已部署的逻辑]
    end

    subgraph config[配置]
        A1[助手 1<br/>GPT-4, 正式]
        A2[助手 2<br/>Claude, 随意]
    end

    subgraph state[状态]
        T1[线程 1<br/>用户 A]
        T2[线程 2<br/>用户 B]
    end

    subgraph runs[运行]
        A1T1["运行: A1 + T1"]
        A1T2["运行: A1 + T2"]
        A2T1["运行: A2 + T1"]
    end

    A1 -.-> T1
    A1 -.-> T2
    A2 -.-> T1

    A1T1 --> G
    A1T2 --> G
    A2T1 --> G

    style G fill:#DBEAFE,stroke:#2563EB,stroke-width:2px,color:#1E3A8A
    style A1 fill:#B3E0F2,stroke:#4A90E2,stroke-width:2px,color:#1E3A5F
    style A2 fill:#B3E0F2,stroke:#4A90E2,stroke-width:2px,color:#1E3A5F
    style T1 fill:#FFE0B3,stroke:#F59E0B,stroke-width:2px,color:#78350F
    style T2 fill:#FFE0B3,stroke:#F59E0B,stroke-width:2px,color:#78350F
    style A1T1 fill:#B3F2C9,stroke:#10B981,stroke-width:2px,color:#14532D
    style A1T2 fill:#B3F2C9,stroke:#10B981,stroke-width:2px,color:#14532D
    style A2T1 fill:#B3F2C9,stroke:#10B981,stroke-width:2px,color:#14532D
```

此图展示了**运行**如何将助手与线程结合以执行图：

* **图**（蓝色）：包含您智能体逻辑的已部署代码
* **助手**（浅蓝色）：配置选项（模型、提示词、工具）
* **线程**（橙色）：用于存储对话历史的状态容器
* **运行**（绿色）：将助手与线程配对执行

**组合示例：**

* **运行: A1 + T1**：将助手1的配置应用于用户A的对话
* **运行: A1 + T2**：同一助手服务用户B（不同对话）
* **运行: A2 + T1**：将不同助手应用于用户A的对话（配置切换）

执行运行时：

* 每个运行可以有自己的输入、配置覆盖和元数据。
* 运行可以是无状态的（无线程）或有状态的（在[线程](/langsmith/use-threads)上执行以实现对话持久化）。
* 多个运行可以使用相同的助手配置。
* 助手的配置会影响底层图的执行方式。

Agent Server API 提供了多个用于创建和管理运行的端点。更多详细信息，请参阅 [API 参考](/langsmith/server-api-ref)。

## 本节内容

<CardGroup cols={2}>
  <Card title="启动后台运行" icon="player-play" href="/langsmith/background-run">
    异步运行您的智能体并轮询结果。
  </Card>

  <Card title="在同一线程上运行多个智能体" icon="messages" href="/langsmith/same-thread">
    在共享线程上使用多个助手以结合智能体能力。
  </Card>

  <Card title="无状态运行" icon="player-skip-forward" href="/langsmith/stateless-runs">
    当不需要对话历史时，执行不持久化状态的运行。
  </Card>

  <Card title="取消运行" icon="player-stop" href="/langsmith/cancel-run">
    通过 API 取消单个运行或多个运行。
  </Card>
</CardGroup>

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/i18n\zh-CN\langsmith\runs.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
