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