Documentation Index
Fetch the complete documentation index at: https://docs.shannon.run/llms.txt
Use this file to discover all available pages before exploring further.
POST http://localhost:8080/api/v1/tasks/{id}/pause
向工作流发送“暂停”信号,在下一个检查点暂停执行。当前正在运行的活动(LLM 调用、工具调用等)会先正常结束,然后工作流在检查点阻塞,直到收到恢复或取消信号。
适用于长时间运行的研究 / 监督类任务,想暂时停下来但不丢失进度的场景。
必需:是
在请求头中携带 API Key:
X-API-Key: sk_test_123456
请求头
| Header | 必需 | 说明 |
|---|
X-API-Key | 是 | API 鉴权 Key |
Content-Type | 否 | 发送 body 时为 application/json |
traceparent | 否 | W3C Trace 上下文 |
路径参数
| 参数 | 类型 | 必需 | 说明 |
|---|
id | string | 是 | 任务 ID(Temporal workflow ID) |
Body 参数
| 参数 | 类型 | 必需 | 说明 |
|---|
reason | string | 否 | 暂停原因(备注) |
请求示例
{
"reason": "用户需要先查看中间结果"
}
202 Accepted
{
"success": true,
"message": "Pause signal sent",
"task_id": "task-123"
}
404 Not Found
{ "error": "Task not found" }
409 Failed Precondition
无法暂停处于无效状态的任务:
{ "error": "cannot pause completed task" }
{ "error": "cannot pause failed task" }
{ "error": "cannot pause cancelled task" }
{ "error": "cannot pause timed out task" }
{ "error": "task is already paused" }
401 / 403
{ "error": "Unauthorized" }
或
- 暂停在工作流内部的检查点生效(如 pre_execution、pre_completion),不会强制中断正在执行的活动。
- 暂停时,SSE 流会依次发送
workflow.pausing / workflow.paused 事件,并携带 checkpoint 字段。
- 服务端会校验租户和用户,只能暂停自己所属的任务。