Documentation Index
Fetch the complete documentation index at: https://docs.xpander.ai/llms.txt
Use this file to discover all available pages before exploring further.
Tasks.astop cancels a running task. The platform marks it Stopped, signals the worker to abandon its current step, and returns the updated record.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
task_id | str | Yes | Task to stop. |
Returns Task
The task record after the stop request was processed. status is Stopped, is_manually_stopped is True, and finished_at is set.
Examples
Stop from a running Task instance
If you already have the Task object, prefer the instance method:
Task.astop() and Tasks().astop(task_id=task.id) are equivalent: the instance method also updates the in-memory object.
Idempotent stop
Callingastop on an already-terminal task is safe: the platform returns the existing record without changing state.
Sync version
Errors
RaisesModuleException. Common statuses:
| Status | Cause |
|---|---|
| 404 | Task doesn’t exist. |
| 500 | Server error. |

