360 Secure SkillHub
360 安全技能中心

Taskqueue

该 Skill 用 FastAPI 在本地 8014 端口启动一个进程内优先级任务队列服务,提供创建任务(标题、payload、优先级、标签)、按状态或标签列出任务、认领最高优先级任务、标记完成或失败、查询队列统计等 HTTP 接口,文档给出对应的 curl 调用示例,数据保存在内存中。

mirni
mirni
热度 37.09
最近更新 2026-05-11 17:42:55
分类:自动化依赖:代码执行 / 第三方 API应用场景:任务管理 / 工作流 / API 集成 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add gh-taskqueue
Metadata
name
gh-taskqueue
description
In-memory priority task queue for AI agents. Create tasks with priorities and tags, claim the next highest-priority task, mark tasks complete or failed, filter by status or tag, and get queue statistics. Like a lightweight Celery for agent workflows.
metadata
{"openclaw":{"emoji":"📋","requires":{"bins":["python"]},"install":[{"id":"pip","kind":"uv","packages":["fastapi","uvicorn","pydantic"]}]}}

TaskQueue

Priority task queue for agent workflows.

Start the server

uvicorn taskqueue.app:app --port 8014

Create a task

curl -s -X POST http://localhost:8014/v1/tasks \
  -H "Content-Type: application/json" \
  -d '{"title": "Scan skill", "payload": {"skill": "my-skill"}, "priority": 5, "tags": ["security"]}' | jq

Claim the next task (highest priority first)

curl -s -X POST http://localhost:8014/v1/claim | jq

Returns the task with status changed to running.

Complete or fail a task

curl -s -X POST http://localhost:8014/v1/tasks/TASK_ID/complete \
  -H "Content-Type: application/json" \
  -d '{"result": {"output": "all clear"}}' | jq

curl -s -X POST http://localhost:8014/v1/tasks/TASK_ID/fail \
  -H "Content-Type: application/json" \
  -d '{"error": "scan timed out"}' | jq

List and filter tasks

curl -s "http://localhost:8014/v1/tasks?status=pending" | jq
curl -s "http://localhost:8014/v1/tasks?tag=security" | jq

Queue stats

curl -s http://localhost:8014/v1/stats | jq

Returns total, pending, running, completed, failed.

Endpoints

Method Path Description
POST /v1/tasks Create a task
GET /v1/tasks List tasks (filter: ?status=, ?tag=)
GET /v1/tasks/{id} Get task by ID
POST /v1/claim Claim next pending task
POST /v1/tasks/{id}/complete Mark done with result
POST /v1/tasks/{id}/fail Mark failed with error
GET /v1/stats Queue statistics