Create automated tasks¶
Create automated tasks and specify the agent to be called, fixed instructions and triggering methods.
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/agent-automation-tasks
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First query the agent list to obtain the agent ID to be called. Prepare a personal access token and target workspace ID that can access the target workspace.
Request body¶
Replace $WORKSPACE_ID, $CLOUDSIGMA_API_KEY, $AGENT_ID in the example with actual values.
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"
}'
trigger.mode supports cron, api and callback.
When using cron, fill in the Cron expression in trigger.cron_expression.
When using API triggers, configure the corresponding authentication policy.
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
workspace ID. |
Request body
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
Custom task ID. |
|
string |
No |
agent source workspace. Current workspace or system, not limited when filtering is omitted. |
|
string |
Yes |
Task name. |
|
string |
No |
Mission statement. |
|
string |
Yes |
The agent ID to be called. |
|
string |
No |
The model name to use when executing the task. |
|
integer |
No |
LLM backend ID. |
|
string |
Yes |
Fixed instructions used every time it is run. |
|
object |
Yes |
Trigger configuration, including at least mode. |
|
string |
When the object is provided |
processing mode. Values: |
|
string |
No |
Cron expressions. |
|
string |
No |
How to handle results. |
|
object or null |
No |
Input field structure. |
|
object or null |
No |
Configuration. |
|
object or null |
No |
Authentication strategy used by API or callback triggers. |
|
object or null |
No |
Structured output constraints. |
|
string |
No |
Initial task status. Values: |
|
object or null |
No |
Tag key-value pairs. |
|
object or null |
No |
Annotation key-value pairs. |
The workspace, operator, time and run summary are maintained by the server and cannot be specified in the request. trigger.service_name is generated by the server.
After the API is deployed, read the call information from api_summary. This request does not support configuring policy references that have not yet been accessed.
auth_policy only applies to API triggers, type must be workspace_api_key. Other trigger modes do not accept auth_policy. The actual credentials come from the header of this authentication request, and the API Key is not filled in JSON.
llm_backend_id is a signed 64 bit integer and can use negative system IDs. -900002 is an embedding-specific value and cannot be used in LLM. A non-zero backend must also specify a non-empty model. The existence of the backend and model support are checked by actually running the route.
Successful response¶
{
"code": 0,
"data": {
"id": "task_01",
"workspace_id": "ws_01",
"agent_workspace_id": "ws_01",
"name": "每日摘要",
"agent_id": "agent_01",
"instruction_text": "",
"trigger": {
"mode": "cron",
"cron_expression": "0 9 * * *"
},
"status": "active",
"version": 1,
"next_trigger_at": "2026-08-21T07:00:00Z",
"execution": {
"type": "agent",
"system_flow_id": ""
},
"created_at": "2026-08-21T07:00:00Z",
"updated_at": "2026-08-21T07:00:00Z"
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
New task, workspace and target agent identification. |
|
string |
New task, workspace and target agent identification. |
|
string |
agent source workspace. Current workspace or system, not limited when filtering is omitted. |
|
string |
Task name, trigger configuration, initial state and version. |
|
string |
Description. |
|
string |
New task, workspace and target agent identification. |
|
string |
model. |
|
integer |
Model backend ID. |
|
string |
Task instructions. |
|
object |
Task name, trigger configuration, initial state and version. |
|
string |
processing mode. Values: |
|
string |
Cron expressions. |
|
string |
How to handle results. |
|
string |
Service name. |
|
object or null |
Input field structure. |
|
object or null |
Configuration. |
|
object |
Authentication policy. |
|
object |
Output convention. |
|
string |
Task name, trigger configuration, initial state and version. Values: |
|
integer |
Task name, trigger configuration, initial state and version. |
|
string |
The next scheduled trigger time. Returned when computable, using RFC 3339 format. RFC 3339 time. |
|
object |
Summary of API calls. |
|
object |
Automated call configuration. |
|
string |
HTTP method. |
|
string |
path. |
|
object |
Request body example. |
|
string |
Service name. |
|
object or null |
content. |
|
object |
Summary of recent runs. |
|
string |
Run ID. |
|
string |
status. Values: |
|
string |
Trigger type. Values: |
|
integer |
Automated task version. |
|
string |
Output verification status. |
|
string |
Creation time. |
|
string |
Update time. |
|
string |
Completion time. |
|
string |
error code. |
|
string |
error message. |
|
object |
Tag mapping. |
|
object |
Annotation mapping. |
|
object |
Saved task execution plan. |
|
string |
type. Value: |
|
string |
System process ID. |
|
object or null |
Parameter definition. |
|
array of object |
Planning steps. |
|
string |
logo. |
|
string |
Worker ID. |
|
string |
Work item ID. |
|
string |
operation. |
|
string |
Number of repetitions. |
|
object or null |
Parameter definition. |
|
string |
Creation and last update times, using RFC 3339 format. RFC 3339 time. |
|
string |
Creation and last update times, using RFC 3339 format. RFC 3339 time. |
Record data.id. When immediate execution is required Start the automated task and run. Other Triggering Methods After saving the task ID, use the accepted run details, event or result interface to confirm the run status.
Error response¶
Internal error may return HTTP 500, code=1. Known error codes may be converted into readable instructions, unknown diagnoses remain in the original text, and the content is not guaranteed to be desensitized.
Authentication errors use the strings code and msg. The business error uses the number code and the string message.
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors
HTTP status code |
error code |
Description |
|---|---|---|
|
|
The task name, agent, trigger configuration, authentication policy, or workspace scope is invalid. Suggestion: Check the configuration required for request fields and triggering methods. |
|
|
Valid identity credentials are missing. Recommendation: Check the API Key. |
|
|
The current identity has not been verified for workspace access and valid roles. Recommendation: Use an identity and a valid role with workspace access. |
|
|
The target agent does not exist. Recommendation: Check |
|
|
The specified task ID already exists, or the task status conflicts. Suggestion: Change the task ID or refresh the task status and try again. |
|
|
Execution plan, workflow or task services are temporarily unavailable. Suggestion: Check the current status first. Do not automatically resubmit. |