Create agent task template¶
Create an agent task template for the workflow node to call. If the creation is successful, only the template will be saved and the agent task will not be executed.
POST $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/agent-task-templates
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
Set the operation-specific values used in the request:
$AGENT_ID: The agent ID to be called by the template.
Request¶
curl -X POST "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/agent-task-templates" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"agent_id": "'$AGENT_ID'",
"name": "摘要任务",
"message_template": {"template": "请总结输入内容"}
}'
Path parameters
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The target workspace ID. |
Request body
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Target agent ID. |
|
string |
Yes |
Template name. |
|
object |
Yes |
Task message template. |
|
string |
No |
Template description. |
|
object |
No |
Input structure definition. |
|
array |
No |
Default context reference. |
|
string |
No |
Run policy reference. |
|
object |
No |
Idempotent policy. |
|
object |
No |
Output contract. |
|
string |
No |
Template status. |
|
object |
No |
Tag key-value pair. |
|
object |
No |
Annotation key-value pair. |
Successful response¶
Returns 201 and a new template on success.
{"code": 0, "data": {"id": "template_01", "agent_id": "agent_01", "name": "摘要任务"}}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
New template ID. |
|
string |
Associated agent ID. |
|
string |
Template name. |
Error response¶
{"code": 2, "message": "invalid agent task template"}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body or template reference is invalid. |
Check agent ID and message template. |
|
|
The template ID or workflow node association already exists. |
Use a new identity instead or query an existing resource. |
Follow-up operations¶
Save data.id, and then Create agent workflow binding.