# Automation tasks, callbacks, and task templates

Create and run automation tasks, maintain callback rules, and manage reusable agent task templates. This page does not observe runtime tasks; use the adjacent task page for runtime observation.

## Prerequisites

Prepare credentials that can access the target workspace and IDs for source resources required by automation tasks, callback rules, or templates. For service endpoints, authentication, and general request formats, see [Prepare to call an API](../../api-call-basics.md).

Confirm a target task before starting it. To receive callbacks, manage the corresponding callback rule first.

## Call sequence

1. Create a task template or query existing templates to determine a reusable task definition.
2. Retain the task ID after creating an automation task. To adjust it, get task details first, then update the task.
3. After starting a task run, use the run-detail, event, and result actions to view distinct observable run information.
4. To manage callback rules, query the target rule first, then create, update, or delete it. Confirm impact before archiving a task.

## API operations

### Manage automation tasks and runs

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Create an automation task | [Create an automation task](../../../../reference/api/ai-studio/agents/automation-tasks/create-task.md) | Create a new automation task. |
| Query automation tasks | [List automation tasks](../../../../reference/api/ai-studio/agents/automation-tasks/list-tasks.md) | Select or confirm a target task. |
| Query automation-task details | [Get automation-task details](../../../../reference/api/ai-studio/agents/automation-tasks/get-task.md) | Confirm a target task before updating, starting, or archiving. |
| Update an automation task | [Update an automation task](../../../../reference/api/ai-studio/agents/automation-tasks/update-task.md) | You have the task ID and need to modify it. |
| Start an automation-task run | [Start an automation-task run](../../../../reference/api/ai-studio/agents/automation-tasks/start-task-run.md) | You confirmed a task and need to submit one run. |
| Query automation-task run details | [Get an automation-task run](../../../../reference/api/ai-studio/agents/automation-tasks/get-run.md) | You have a run ID and need run information. |
| Query automation-task run events | [List automation-task run events](../../../../reference/api/ai-studio/agents/automation-tasks/list-run-events.md) | View events for a target run. |
| Query automation-task run results | [Get an automation-task run result](../../../../reference/api/ai-studio/agents/automation-tasks/get-run-result.md) | View the result for a target run. |
| Archive an automation task | [Archive an automation task](../../../../reference/api/ai-studio/agents/automation-tasks/archive-task.md) | Confirm impact and conditions on the action page before archiving. |

### Manage callback rules

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Create a callback rule | [Create a callback rule](../../../../reference/api/ai-studio/agents/callback-rules/create-callback-rule.md) | Configure a callback rule for a task. |
| Query callback rules | [List callback rules](../../../../reference/api/ai-studio/agents/callback-rules/list-callback-rules.md) | Select or confirm a target rule. |
| Query callback-rule details | [Get a callback rule](../../../../reference/api/ai-studio/agents/callback-rules/get-callback-rule.md) | Confirm a target rule before updating or deleting it. |
| Update a callback rule | [Update a callback rule](../../../../reference/api/ai-studio/agents/callback-rules/update-callback-rule.md) | You have the rule ID and need to modify it. |
| Delete a callback rule | [Delete a callback rule](../../../../reference/api/ai-studio/agents/callback-rules/delete-callback-rule.md) | Confirm impact and conditions on the action page before deletion. |

### Manage agent task templates

| What you need to do | API operation | Use it when |
| --- | --- | --- |
| Create an agent task template | [Create an agent task template](../../../../reference/api/ai-studio/agents/task-templates/create-task-template.md) | Create a reusable template. |
| Query agent task templates | [List agent task templates](../../../../reference/api/ai-studio/agents/task-templates/list-task-templates.md) | Select or confirm a template. |
| Query agent task-template details | [Get an agent task template](../../../../reference/api/ai-studio/agents/task-templates/get-task-template.md) | Confirm a target template before updating. |
| Update an agent task template | [Update an agent task template](../../../../reference/api/ai-studio/agents/task-templates/update-task-template.md) | You have the template ID and need to modify it. |

## Confirm the result

After starting a run, use [Get an automation-task run](../../../../reference/api/ai-studio/agents/automation-tasks/get-run.md), [List automation-task run events](../../../../reference/api/ai-studio/agents/automation-tasks/list-run-events.md), and [Get an automation-task run result](../../../../reference/api/ai-studio/agents/automation-tasks/get-run-result.md) to confirm it. Confirm task, callback-rule, and template changes with their respective detail or list actions.

## Limitations and notes

Archiving a task and deleting a callback rule affect the target object. Confirm conditions and results on the corresponding action page before proceeding.

## Next steps

- [Monitor runs and handle feedback](runtime-observability-feedback.md)
- [Invoke agents and manage sessions](agent-invocation-sessions.md)
