Create automated tasks¶
Create automated tasks and specify the agents to be called, fixed instructions, and triggering methods.
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/agent-automation-tasks
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
First query the agent list to obtain the ID of the agent to be called.
Set the operation-specific values used in the request:
$WORKSPACE_ID: The workspace ID of the task to be created, passed in theX-Workspace-IDheader and also asworkspace_idin the path.$AGENT_ID: The ID of the agent to be called, obtained through query agent list, used foragent_idin the request body.
trigger.mode supports cron, api and callback. Provide a cron expression in trigger.cron_expression when using cron; API triggering needs to be configured with the corresponding authentication policy.
Request¶
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/agent-automation-tasks" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"name": "每日摘要",
"agent_id": "'"$AGENT_ID"'",
"instruction_text": "汇总当天的输入内容。",
"trigger": {
"mode": "cron",
"cron_expression": "0 9 * * *"
},
"status": "active"
}'
Path parameters
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Workspace ID. |
Request body
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Task name. |
|
string |
Yes |
The ID of the agent to be called. |
|
string |
Yes |
Fixed instruction used every time it is run. |
|
object |
Yes |
Trigger configuration that contains at least |
|
string |
No |
Custom task ID. |
|
string |
No |
Task description. |
|
string |
No |
The workspace to which the agent belongs; if not passed, the workspace in the path will be used. |
|
string |
No |
The model name to use when executing the task. |
|
integer |
No |
LLM backend ID. |
|
object |
No |
The authentication policy used by the API or callback trigger. |
|
string |
No |
Tool policy reference. |
|
string |
No |
Run policy reference. |
|
string |
No |
Approval policy reference. |
|
object |
No |
Structured output constraints. |
|
string |
No |
The associated workflow application ID. |
|
string |
No |
The associated agent task template ID. |
|
string |
No |
The associated agent workflow binding ID. |
|
string |
No |
Task source type. |
|
string |
No |
Initial task status. |
|
string |
No |
Next trigger time, using RFC 3339 format. |
|
object |
No |
API summary. |
|
object |
No |
Tag key-value pair. |
|
object |
No |
Annotation key-value pair. |
Successful response¶
Returns 201 on success. Successful creation only means that the task configuration and its execution plan have been saved; whether the plan or external trigger has been run should be confirmed through the running record.
{
"code": 0,
"data": {
"id": "task_01",
"workspace_id": "ws_01",
"agent_workspace_id": "ws_01",
"name": "每日摘要",
"agent_id": "agent_01",
"trigger": {
"mode": "cron",
"cron_expression": "0 9 * * *"
},
"status": "active",
"version": 1,
"next_trigger_at": "2026-08-19T01:00:00Z",
"created_at": "2026-08-18T01:00:00Z",
"updated_at": "2026-08-18T01:00:00Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
New task, workspace, and target agent identifiers. |
|
string |
New task, workspace, and target agent identifiers. |
|
string |
New task, workspace, and target agent identifiers. |
|
string |
New task, workspace, and target agent identifiers. |
|
string |
Task name, trigger configuration, initial status and version. |
|
object |
Task name, trigger configuration, initial state and version. |
|
string |
Task name, trigger configuration, initial status and version. |
|
integer |
Task name, trigger configuration, initial status and version. |
|
string |
Next scheduled trigger time; returned when computable, using RFC 3339 format. |
|
object |
The saved task execution plan. |
|
string |
Creation and last update times, using RFC 3339 format. |
|
string |
Creation and last update times, using RFC 3339 format. |
Error response¶
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
Invalid task name, agent, trigger configuration, authentication policy, or workspace scope. |
Check the configuration required for request fields and triggering methods. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current identity has not been verified for workspace access and valid roles. |
Use an identity and a valid role with access to the workspace. |
|
|
The target agent does not exist. |
Check |
|
|
The specified task ID already exists, or the task status conflicts. |
Change the task ID or refresh the task status and try again. |
|
|
Execution plan, workflow or task services are temporarily unavailable. |
Try again later. |
Follow-up operations¶
Log data.id. When immediate execution is required Start automated task running; other triggering methods save the task ID and use the accepted running details, events or result interfaces to confirm the running status.