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

# 工作流自动化

> 通过调度和事件触发器构建多步骤自动化工作流。

工作流将多个 AI 任务串联起来,并结合调度、条件逻辑和通知机制。

## 创建工作流

```typescript theme={null}
const workflow = await theo.createWorkflow({
  name: "Weekly Newsletter Draft",
  triggerType: "schedule",
  triggerConfig: { cron: "0 9 * * 1" },
  steps: [
    {
      type: "ai_transform",
      name: "Research trends",
      config: { prompt: "Research top AI trends this week", skills: ["deep-research"] },
    },
    {
      type: "ai_transform",
      name: "Draft newsletter",
      config: { prompt: "Draft a newsletter from the research above", skills: ["content-writer"] },
    },
    {
      type: "notification",
      name: "Send draft",
      config: { channel: "email", to: "editor@acme.com" },
    },
  ],
});
```

## 触发器类型

| 类型 | 说明 |
| - | - |
| `schedule` | 基于 Cron 表达式的调度 |
| `event` | 由系统事件触发 |
| `manual` | 通过 API 调用触发 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.