> ## Documentation Index
> Fetch the complete documentation index at: https://www.mintlify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建自定义自动化

> 通过计划或推送触发器、上下文仓库以及 agent 提示词创建自定义 Mintlify 自动化，从而自动执行周期性文档任务。

<div id="prerequisites">
  ## 前置条件
</div>

* 一个已连接到 GitHub 或 GitLab 仓库的 Mintlify 项目
* 对于 GitHub：在你计划用于自动化的每个仓库上都安装 [Mintlify GitHub 应用](/zh/deploy/github)
* 对于 GitLab：已连接的 GitLab 账户（请参见下方[GitLab 设置](#gitlab-setup)）

<div id="create-a-custom-automation">
  ## 创建自定义自动化
</div>

<Note>
  agent 运行在受限互联网访问的隔离沙箱中。它无法在运行时安装额外的包或工具。引用不可用工具的提示词可能产生意外结果或失败。
</Note>

1. 在控制台中打开 [Automations](https://app.mintlify.com/products/automations) 页面。
2. 点击 **Create a custom automation**。
3. 配置自动化名称、触发器、指令、上下文仓库、集成和更新模式。有关各字段的详细说明，请参见[配置](/zh/automations/manage#configurations)。
4. 点击 **Create automation**。

<div id="write-effective-instructions">
  ## 撰写有效的指令
</div>

有效的自动化指令聚焦于单一任务，并定义清晰、可验证的结果。由于 agent 是非确定性的，自动化结果会有所差异，但格式良好的指令能产生更一致的结果。

* **描述结果。** 告诉 agent 一次成功的运行应该是什么样的。
* **撰写流程。** 给 agent 一份按步骤执行的指南。
* **保持范围窄。** 将复杂任务拆分到多个自动化中，而不是合并到一个提示词里。

更多示例和模式请参见[使用自动化](/zh/guides/use-automations)。

<Tip>
  审查你自定义自动化的输出，以确认它们按预期运行。更新你的指令以改进结果。
</Tip>

## GitLab 设置

要在自动化中使用 GitLab 仓库，请通过 [GitLab OAuth](https://app.mintlify.com/settings/organization/gitlab-oauth) 设置页面连接每个项目。请连接自动化涉及的所有仓库——你的文档仓库以及任何触发或上下文仓库。你必须在每个项目中至少具有 Maintainer 角色。

<Note>
  自动化需要付费的 GitLab 套餐。代理使用短期项目访问令牌来访问仓库，GitLab 的 Free 套餐不支持此功能。
</Note>

<div id="delete-a-custom-automation">
  ## 删除自定义自动化
</div>

删除自动化是永久性的，会移除其配置和运行历史。

1. 在控制台中打开 [Automations](https://app.mintlify.com/products/automations) 页面。
2. 点击自动化旁边的 <Icon icon="settings" /> 设置按钮。
3. 点击 **Delete**。


## Related topics

- [使用自动化](/zh/guides/use-automations.md)
- [预定义自动化](/zh/automations/reference.md)
- [自动化概览](/zh/automations/index.md)
