# Update agent task template

Updates a saved agent task template; fields not provided retain their original values.

```text
PATCH $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/agent-task-templates/{template_id}
```

## Before you call this API

Configure the [regional API endpoint and authentication](https://omnifabric.cloudsigma.com/docs/developer/endpoints-and-authentication.html.md), and select the target workspace.

Obtain the template ID from the template list.

Set the operation-specific values used in the request:

- `$TEMPLATE_ID`: Template ID to update.

## Request example

```bash
curl -X PATCH "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/agent-task-templates/$TEMPLATE_ID" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "description": "用于工作流中的摘要节点"
  }'
```

## Path parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | Yes | The target workspace ID. |
| `template_id` | string | Yes | The ID of the template to update. |

## Request body

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `name` | string | No | Template name. |
| `agent_id` | string | No | ID of the agent to be called. |
| `description` | string | No | Template description. |
| `message_template` | object | No | Task message template. |
| `input_schema` | object | No | Input structure definition. |
| `default_context_refs` | array | No | Default context reference. |
| `runtime_policy_ref` | string | No | Run policy reference. |
| `idempotency_policy` | object | No | Idempotent policy. |
| `output_contract` | object | No | Output contract. |
| `status` | string | No | Template status. |
| `labels` | object | No | Tag key-value pair. |
| `annotations` | object | No | Annotation key-value pair. |

## Successful response

Returns `200` and the updated template on success.

```json
{"code": 0, "data": {"id": "template_01", "description": "用于工作流中的摘要节点"}}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | `0` on success. |
| `data.id` | string | Template ID. |
| `data.description` | string | Updated template description. |

## Error response

```json
{"code": 5, "message": "agent task template not found"}
```

### Common HTTP errors

```{list-table}
:header-rows: 1

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `2`
  - The request body is invalid.
  - Check the fields to be updated.
* - `404`
  - `5`
  - The template does not exist.
  - Check template ID.
```
