Create automated tasks

Create automated tasks and specify the agent to be called, fixed instructions and triggering methods.

HTTP
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.

Shell
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

workspace_id

string

Yes

workspace ID.

Request body

Field

Type

Required

Description

id

string

No

Custom task ID.

agent_workspace_id

string

No

agent source workspace. Current workspace or system, not limited when filtering is omitted.

name

string

Yes

Task name.

description

string

No

Mission statement.

agent_id

string

Yes

The agent ID to be called.

model

string

No

The model name to use when executing the task.

llm_backend_id

integer

No

LLM backend ID.

instruction_text

string

Yes

Fixed instructions used every time it is run.

trigger

object

Yes

Trigger configuration, including at least mode.

trigger.mode

string

When the object is provided

processing mode. Values: cron, api, callback.

trigger.cron_expression

string

No

Cron expressions.

trigger.result_mode

string

No

How to handle results.

trigger.input_schema

object or null

No

Input field structure.

trigger.config

object or null

No

Configuration.

auth_policy

object or null

No

Authentication strategy used by API or callback triggers.

output_contract

object or null

No

Structured output constraints.

status

string

No

Initial task status. Values: draft, creating, active, failed, disabled, archived.

labels

object or null

No

Tag key-value pairs.

annotations

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

JSON
{
  "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

data.id

string

New task, workspace and target agent identification.

data.workspace_id

string

New task, workspace and target agent identification.

data.agent_workspace_id

string

agent source workspace. Current workspace or system, not limited when filtering is omitted.

data.name

string

Task name, trigger configuration, initial state and version.

data.description

string

Description.

data.agent_id

string

New task, workspace and target agent identification.

data.model

string

model.

data.llm_backend_id

integer

Model backend ID.

data.instruction_text

string

Task instructions.

data.trigger

object

Task name, trigger configuration, initial state and version.

data.trigger.mode

string

processing mode. Values: cron, api, callback.

data.trigger.cron_expression

string

Cron expressions.

data.trigger.result_mode

string

How to handle results.

data.trigger.service_name

string

Service name.

data.trigger.input_schema

object or null

Input field structure.

data.trigger.config

object or null

Configuration.

data.auth_policy

object

Authentication policy.

data.output_contract

object

Output convention.

data.status

string

Task name, trigger configuration, initial state and version. Values: draft, creating, active, failed, disabled, archived.

data.version

integer

Task name, trigger configuration, initial state and version.

data.next_trigger_at

string

The next scheduled trigger time. Returned when computable, using RFC 3339 format. RFC 3339 time.

data.api_summary

object

Summary of API calls.

data.api_summary.agent_automation_invoke

object

Automated call configuration.

data.api_summary.agent_automation_invoke.method

string

HTTP method.

data.api_summary.agent_automation_invoke.path

string

path.

data.api_summary.agent_automation_invoke.body_example

object

Request body example.

data.api_summary.agent_automation_invoke.body_example.service_name

string

Service name.

data.api_summary.agent_automation_invoke.body_example.payload

object or null

content.

data.last_run_summary

object

Summary of recent runs.

data.last_run_summary.run_id

string

Run ID.

data.last_run_summary.status

string

status. Values: queued, running, input_required, pending_approval, succeeded, failed, canceled, expired.

data.last_run_summary.trigger_type

string

Trigger type. Values: cron, api, manual, callback.

data.last_run_summary.automation_task_version

integer

Automated task version.

data.last_run_summary.output_validation_status

string

Output verification status.

data.last_run_summary.created_at

string

Creation time.

data.last_run_summary.updated_at

string

Update time.

data.last_run_summary.completed_at

string

Completion time.

data.last_run_summary.error_code

string

error code.

data.last_run_summary.error_message

string

error message.

data.labels

object

Tag mapping.

data.annotations

object

Annotation mapping.

data.execution

object

Saved task execution plan.

data.execution.type

string

type. Value: agent, deterministic_system_flow.

data.execution.system_flow_id

string

System process ID.

data.execution.parameters

object or null

Parameter definition.

data.execution.steps

array of object

Planning steps.

data.execution.steps[].id

string

logo.

data.execution.steps[].worker_id

string

Worker ID.

data.execution.steps[].workitem_id

string

Work item ID.

data.execution.steps[].operation

string

operation.

data.execution.steps[].repetition

string

Number of repetitions.

data.execution.steps[].parameters

object or null

Parameter definition.

data.created_at

string

Creation and last update times, using RFC 3339 format. RFC 3339 time.

data.updated_at

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.

JSON
{
  "code": 2,
  "message": "<错误信息>"
}

Common HTTP errors

HTTP status code

error code

Description

400

2(INVALID_ARGUMENT)

The task name, agent, trigger configuration, authentication policy, or workspace scope is invalid. Suggestion: Check the configuration required for request fields and triggering methods.

401

6(UNAUTHENTICATED)

Valid identity credentials are missing. Recommendation: Check the API Key.

403

5(PERMISSION_DENIED)

The current identity has not been verified for workspace access and valid roles. Recommendation: Use an identity and a valid role with workspace access.

404

3(NOT_FOUND)

The target agent does not exist. Recommendation: Check agent_id and agent_workspace_id.

409

4(ALREADY_EXISTS)

The specified task ID already exists, or the task status conflicts. Suggestion: Change the task ID or refresh the task status and try again.

503

15(UNAVAILABLE)

Execution plan, workflow or task services are temporarily unavailable. Suggestion: Check the current status first. Do not automatically resubmit.

Last updated on