> ## 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.

# 快速开始

> 通过模板构建智能体

在本快速开始中，你将使用预定义的**邮件助手**[模板](/langsmith/fleet/templates)，该模板可为你整理和管理收件箱。

* 选择其他模板。

<Callout icon="message" color="#8B5CF6" iconType="regular">
  你将通过聊天与你的智能体互动，就像给一位得力的助手发消息一样。
</Callout>

## 开始之前

你需要准备：

* 一个 LangSmith 账户（[在此注册](https://smith.langchain.com/agents?skipOnboarding=true)）。
* 一个 Gmail 账户。
* 一个 Google 日历。
* 一个 OpenAI 或 Anthropic 的 API 密钥（步骤 1 将展示如何获取）。

## 1. 获取模型 API 密钥

你的智能体需要一个 API 密钥来连接 AI 模型。AI 模型使你的智能体能够理解并响应你的请求。

<Tabs>
  <Tab title="OpenAI (ChatGPT)">
    1. 访问 [platform.openai.com/api-keys](https://platform.openai.com/api-keys)。
    2. 点击 **Create new secret key**。
    3. 为其命名，例如 "Fleet"。
    4. 复制密钥（以 `sk-` 开头）。
    5. 将其保存在安全的地方，你将在步骤 2 中用到它。
  </Tab>

  <Tab title="Anthropic (Claude)">
    1. 访问 [console.anthropic.com/settings/keys](https://console.anthropic.com/settings/keys)。
    2. 点击 **Create Key**。
    3. 为其命名，例如 "Fleet"。
    4. 复制密钥（以 `sk-ant-` 开头）。
    5. 将其保存在安全的地方，你将在步骤 2 中用到它。
  </Tab>
</Tabs>

<Warning>
  两项服务均按使用量计费。
</Warning>

## 2. 将 API 密钥添加到 LangSmith

现在，你需要将 API 密钥添加到 LangSmith，以便你的智能体可以使用它：

<Steps>
  <Step title="打开设置">
    1. 访问 [smith.langchain.com](https://smith.langchain.com)。
    2. 点击左下角的 <Icon icon="settings" /> **Settings** 图标。
  </Step>

  <Step title="进入密钥管理">
    点击顶部的 **Secrets** 标签页。
  </Step>

  <Step title="添加你的密钥">
    1. 点击 **Add secret**。
    2. 在 **Key** 字段中，输入：
       * `OPENAI_API_KEY`（如果使用 OpenAI）
       * `ANTHROPIC_API_KEY`（如果使用 Anthropic）
    3. 在 **Value** 字段中，粘贴你在步骤 1 中复制的 API 密钥。
    4. 点击 **Save secret**。
  </Step>
</Steps>

<Callout type="success" icon="check" color="#10B981" iconType="regular">
  你的智能体现在可以访问 AI 模型来理解和响应你的请求了。接下来，你将创建你的智能体。
</Callout>

## 3. 创建你的智能体

<Steps>
  <Step title="导航到 Fleet">
    1. 在 [LangSmith 界面](https://smith.langchain.com) 中，点击左侧导航栏顶部的 <Icon icon="pointer" /> **Switch to Fleet**。
  </Step>

  <Step title="选择一个模板">
    1. 在左侧导航栏中选择 **Templates**。
    2. 选择 **Email Assistant** 模板。
    3. 点击 **Use this template**。

    <Tip>
      如果你不想从模板开始，还有另外两个选项。在 **+ New Agent** 页面：

      * **Chat**：使用聊天界面描述你的智能体，它将逐步引导你创建。
      * **Manually**：选择 **Create manually instead**，在配置页面上无需预填响应即可构建你的智能体。
    </Tip>
  </Step>

  <Step title="授权账户">
    你的智能体会要求你连接你的 Google 账户：

    1. 点击 **Connect**。
    2. 使用你的 Google 账户登录。
    3. 查看权限并点击 **Allow**。
    4. 你将被重定向回 LangSmith，你的智能体将在此创建。
  </Step>
</Steps>

<Info>
  你的智能体仅在处理你分配的任务时访问你的账户。你可以随时在 Google 账户设置中撤销访问权限。
</Info>

## 4. 查看智能体模板

<Steps>
  <Step title="查看并自定义模板">
    此时，你可以查看邮件助手的模板指令。如果需要，你可以对指令进行调整。

    如果你进行了任何更改，请点击 **Save changes**。
  </Step>

  <Step title="开始测试聊天">
    1. 在配置页面的右侧面板中，选择 **Test Chat** 标签页。
    2. 在聊天界面中试用邮件助手，例如：

       > *为我收到的、需要我进行某种审核的邮件应用“Review”标签*
  </Step>

  <Step title="智能体开始工作">
    你的智能体将开始工作，并为每个需要你批准的步骤提供 **Continue** 选项。

    <img className="block dark:hidden" src="https://mintcdn.com/hhh-8c10bf0c/dGi5Qyx6ZNfUuqyP/langsmith/images/agent-builder-response.png?fit=max&auto=format&n=dGi5Qyx6ZNfUuqyP&q=85&s=a9e80881038703a0d628f5768a879107" alt="测试聊天输出视图，包含 Gmail 工具的审批响应。" width="670" height="974" data-path="langsmith/images/agent-builder-response.png" />

    <img className="hidden dark:block" src="https://mintcdn.com/hhh-8c10bf0c/dGi5Qyx6ZNfUuqyP/langsmith/images/agent-builder-response-dark.png?fit=max&auto=format&n=dGi5Qyx6ZNfUuqyP&q=85&s=a323269ccb8e36c3150ceff6510bbfb2" alt="测试聊天输出视图，包含 Gmail 工具的审批响应。" width="659" height="973" data-path="langsmith/images/agent-builder-response-dark.png" />

    3. 在测试智能体时，你可以编辑指令，或添加你可能需要的工具。当你对结果满意时，点击 **Save changes**。
  </Step>
</Steps>

## 编辑你的智能体

你可能想要更新智能体的指令或包含更多工具。你可以直接与智能体聊天请求更新，或者：

1. 在左侧导航栏的 **My Agents** 中，选择你想要编辑的智能体。
2. 选择 <Icon icon="pencil" /> **Edit Agent**。

在智能体的编辑页面，你可以：

* 通过 **+ Add tool** 添加工具，以连接更多应用和服务，如 Slack、GitHub 或 Linear。
* 通过 **+ Add sub-agent** 添加进一步的助手，将复杂任务分解为专门的子任务。
* 请求在现有工具上暂停以进行审核。
* 修改现有工具。
* 探索可以自动启动智能体的渠道。

## 后续步骤

现在你已经创建了你的第一个智能体，以下是接下来可以探索的内容：

<CardGroup cols={2}>
  <Card title="尝试更多模板" icon="layout-grid" href="/langsmith/fleet/templates">
    探索针对常见任务的预构建智能体
  </Card>

  <Card title="添加自动化" icon="bolt" href="/langsmith/fleet/essentials#channels">
    通过渠道（Slack、邮件、计划任务）自动运行你的智能体
  </Card>

  <Card title="连接更多工具" icon="puzzle" href="/langsmith/fleet/tools">
    添加 Slack、GitHub、Linear 等更多工具
  </Card>

  <Card title="构建复杂智能体" icon="sitemap" href="/langsmith/fleet/essentials#sub-agents">
    使用子智能体分解大型任务
  </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\fleet\quickstart.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>
