# run()

Canonical URL: https://developers.iagenify.com/zh/sdk/ref/workflow/run/
Language: zh

`workflow.run({ input }) → Promise<WorkflowRun>`

启动运行并立即返回。运行在平台上继续,无论您的进程是否运行。

Status: returns at once · input feeds the templates · survives your process

```javascript
const run = await workflow.run({ input: { since: "2026-10-01", channel: "ops" } });

console.log(run.id, run.data.status);   // "running"
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `input` | object | {} | 进进 `{{input.…}}` 模板。任何您喜欢的形状。 |

## 等待不等待 {#async}

跑步开始并交还 跟着它,打电话给 [等待()](/zh/sdk/ref/workflow-run/wait),或者保留识别特征,然后把它捡起来 [raun()](/zh/sdk/ref/workflows/get-run).

```javascript
const run = await workflow.run({ input });
await run.wait();                      // until it finishes, or waits for a human

if (run.data.status === "waiting") {
  const step = run.data.steps.find((s) => s.status === "waiting");
  await run.resume(step.id, { approved: true });
}
```

## 输入是运行唯一需要的 {#input}

> **其它一切都在定义中**
>
> 流程保存时,模型、 存储器、 提示和地址会固定。 这就是问题所在: 无人观看的运行在启动时不能被告知要做不同的事情 。

## 运行开始其他方式 {#triggers}

| 触发触发 | 开始于 |
| --- | --- |
| `manual` | 此项呼吁的本呼吁 |
| `cron` | 时间表 |
| `webhook` | 一项内容外请求 |
| `mail` | 发送信息 |

四人生产同样的运行, `input` 由从它开始的任何东西填充 。

## 多少运行成本 {#cost}

无论步骤成本如何—— 示范电话、搜索、取回、转换、媒体。 每一步都报告自己的信用额,运行量也包含总金额。

- [工作流程流动](/zh/sdk/ref/workflow-run): 之后,批准,重试。
- [触发器 · cron](/zh/sdk/workflows/triggers/cron): 计划上说要按进度进行

```python
run = workflow.run(input={"since": "2026-10-01", "channel": "ops"})

print(run.id, run.data["status"])   # "running"
```

```python
run = workflow.run(input=payload)
run.wait()                     # until it finishes, or waits for a human

if run.data["status"] == "waiting":
    step = next(s for s in run.data["steps"] if s["status"] == "waiting")
    run.resume(step["id"], {"approved": True})
```
