Scheduled Tasks
You can create and manage scheduled tasks using natural language, including periodic tasks (such as daily code checks) and one-time tasks (such as tomorrow's submission reminders), achieving flexible task scheduling and control.
Scheduled Task Commands
| Development Environment | Command | Function |
|---|---|---|
| TUI | /schedule Natural language prompt | In the TUI development environment, you can create a scheduled task by entering the /schedule command or using a natural language description. |
| CLI | codearts run --command schedule "Prompt" codearts run "Prompt" | In the CLI development environment, you can create a scheduled task by entering the /schedule command or using a natural language description. |
A scheduled task created using a command will be executed immediately, while a scheduled task created using a natural language description will not.
Scheduled Task Configuration Files
Running scheduled tasks in the CodeArts Agent CLI depends on the following files. The data is automatically generated by the system.
| File Type | File Path | Description |
|---|---|---|
| Task data file (configuration file) | ~/.codeartsdoer/cli-data/cron/scheduled_tasks.json | Stores the definitions of all scheduled tasks, such as the interval, prompt, and status. For the specific fields in the data file, see Table 3. |
| Execution log file (execution record) | ~/.codeartsdoer/cli-data/cron/cron_log/task_{TASK_ID}.json | Records the execution result of each task, including the status, duration, and result summary. |
| Field | Value Range/Format | Description | Example |
|---|---|---|---|
| id | A random ID consisting of 8 characters (automatically generated by the system) | Unique task ID | 10e366d0 |
| cron | A 5-segment Cron expression: minute hour day month weekday Supported formats: *, */N, N, N-M, and N,M,O Value range: minute (0–59), hour (0–23), day (1–31), month (1–12), and weekday (0–6, where 0 indicates Sunday) | Execution schedule (local time), which is used to trigger a task at a scheduled time | */5 * * * * (every 5 minutes) and 0 9 * * * (9:00 every day) |
| prompt | Any text | AI prompt (instruction content) executed when a task is triggered | Check the remaining storage space of the local drive C. |
| projectPath | Absolute path | Project path (The system automatically binds the current project context.) | D:\tmp\test_hc_cli |
| status |
| Current task status (It is automatically managed by the system, and its initial value is active.) | active |
| recurring |
| Whether to enable recurring execution | true |
| durable |
| Whether the task is a persistent task. The default value is false. | false |
| createdAt | Unix timestamp (ms) | Task creation time, which is automatically generated by the system | 1783996637621 |
| humanSchedule | Description | Scheduling description, which is automatically generated by the system based on the cron expression | Every minute, 09:00 every day, every 5 minutes |
| sessionID | String | Session ID. A session is created for each scheduled task. The session is updated with the task. | ses_0a16ceba1ffeXQHnpNW0jh20J8 |
| agentID | Built-in agent name | Agent used to execute a task. It is automatically obtained by the system. | build, code |
| modelID | ID of a configured model | ID of the model used to execute a task. It is automatically obtained by the system. | deepseek-v3.2 |
| providerID | Provider ID that has been configured | ID of provider of the model used to execute a task. It is automatically obtained by the system. | huaweicloud-maas |
| isCustom |
| Whether to use a custom agent, which is automatically determined by the system | false |
| sessionType | kernel or other | Session type, which is automatically obtained by the system | kernel |
| category |
| Task category, which is automatically obtained by the system | code |
Creating a Scheduled Task on the TUI
In the TUI development environment, you can create a scheduled task using a command or natural language. A scheduled task created using a command will be executed immediately, while a scheduled task created using a natural language description will not.
Command syntax:
/schedule [Interval] <Prompt>
| Parameter | Description |
|---|---|
| Interval | (Optional) Interval at which the scheduled task is executed. If this parameter is not set, the command is executed every 10 minutes by default. Format: number + unit letter. The unit letter can be s (second), m (minute), h (hour), or d (day). |
| Prompt | (Mandatory) The command that you want AI to execute |
After a scheduled task command is submitted for the first time, AI immediately executes the specified prompt and then sets and runs a scheduled task. Subsequent scheduled tasks will be generated in an independent session. You can run the /sessions command to view all sessions. For example, if you deliver a /schedule 5m check the deployment status command, AI will immediately check the deployment status once and then check the deployment status every five minutes.
Example:
- Enter the TUI development environment.
- Open the root directory of the target project.
- Right-click in the blank area and select Open Windows Terminal here.
- Enter /codearts in the terminal and press Enter to enter the TUI development environment.
- Run the /schedule command to create a scheduled task.
- In the TUI dialog box, enter / and select /schedule.
- Enter the following command and press Enter:
1m Create a TXT file with an increasing suffix and write the current system date and time into the file.
- AI creates a scheduled task and executes it immediately. In addition, the two files listed in Table 5 are generated. Figure 1 Creating a session-level scheduled task
- Run the /sessions command to view the session created for the scheduled task. Figure 2 Viewing the session created for the scheduled task
In addition to the /schedule command, you can also use a natural language description to create a scheduled task. Scheduled tasks created using natural language will not be executed immediately.
- Enter the TUI development environment.
- Open the root directory of the target project.
- Right-click in the blank area and select Open Windows Terminal here.
- Enter /codearts in the terminal and press Enter to enter the TUI development environment.
- In the TUI dialog box, enter the operation you want AI to perform and press Enter.
- Example of creating a recurring task using natural language
Table 6 Creating a recurring task using natural language Prompt
What AI Will Do
Check error logs in the production environment every 30 minutes.
Create a recurring task that runs every 30 minutes.
Run a unit test at 9:00 a.m. every day.
Create a recurring task that runs at 9:00 every day.
Scan for security vulnerabilities every hour.
Create a recurring task that runs every hour.
- Example of creating a one-off task using natural language
Table 7 Creating a one-off task using natural language Prompt
What AI Will Do
Remind me to review PR#42 at 9:00 a.m. tomorrow.
Create a one-off task that runs at 9:00 tomorrow and automatically ends after execution.
Remind me to confirm the database migration result in 3 minutes.
Create a one-off task that runs once in 3 minutes.
Remind me to submit a weekly report at 10:00 next Monday.
Create a one-off task that runs at 10:00 next Monday.
- Example of creating a recurring task using natural language
Creating a Scheduled Task on the CLI
In the CLI development environment, you can create a scheduled task using a command or natural language. A scheduled task created using a command will be executed immediately, while a scheduled task created using a natural language description will not.
CLI dialogs are one-off. The scheduled tasks created on the CLI are only written to the scheduled_tasks.json configuration file. Scheduled tasks will be executed only when the TUI or other CodeArts Agent CLI processes are started. Keep CodeArts Agent CLI running to ensure that tasks can be executed stably as scheduled.
Command syntax:
codearts run --command schedule "Prompt" | Parameter | Description |
|---|---|
| Prompt | (Mandatory) The operation that you want AI to perform |
Example:
- In the CLI development environment, enter the command for creating a scheduled task and press Enter. For example, to create a scheduled task that reminds you to perform a CLI test every two minutes, you can use the following prompt. If no time is specified in the command, a scheduled task that is executed every 10 minutes by default is created (for example, you can run codearts run --command schedule to list all scheduled tasks).
codearts run --command schedule "Remind me to perform a CLI test every 2 minutes."
- AI will create a scheduled task based on your instruction and run it immediately. Figure 3 Creating and running a scheduled task
- In the CLI development environment, enter the command for creating a scheduled task and press Enter.
codearts run "Prompt"For example, to create a scheduled task that reminds you to write a weekly CLI report every minute, you can use the following prompt.
codearts run "Remind me to write a weekly CLI report every minute."
- AI will create a scheduled task based on your instruction. Figure 4 Creating a scheduled task
Managing Scheduled Tasks
Scheduled tasks cannot be managed using commands. You can manage them only using natural language descriptions.
| Natural Language Prompt | Execution Result |
|---|---|
| The list of all scheduled tasks is displayed. |
| Only paused tasks are displayed. |
| The task details are displayed, including the execution history and next execution time. |
| The task stops, with no configuration lost. After the task is resumed, it continues running at the original interval. |
| The paused task is reactivated and continues running as planned. |
| The task is permanently deleted and cannot be restored. |
| The task is immediately executed, without affecting the original schedule. For example, you can immediately execute a scheduled task that is paused. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot