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

# 定时任务

定时任务按设定时间自动执行，适用于定期巡检、日报整理等重复工作。应用必须保持运行，定时任务才会执行。

## 创建定时任务

在会话中用自然语言描述任务和时间即可创建，例如：

```text theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
每天早上 9 点检查项目依赖是否有安全更新，整理成一份简报。
```

定时任务支持：

* 单次执行和循环执行。
* 设置到期时间，创建前可确认编辑器显示的时区。
* 暂停、删除、立即运行和查看运行历史与失败原因。
* 将结果推送至飞书。

![新建定时任务时设置每天执行的时间](https://mintcdn.com/stepfun/ho4Rzxj0opZfa8eD/images/step-code/desktop/desktop-scheduled-task-editor.png?fit=max\&auto=format\&n=ho4Rzxj0opZfa8eD\&q=85\&s=33c67d69972aff49078aa3a188b6cf42)

## 任务与会话的关系

定时任务绑定到创建它的会话。任务随应用保存，切换工作目录不会丢失；绑定的会话被删除后，任务自动暂停。对话上方的任务卡片可以直接编辑对应任务。


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