360 Secure SkillHub
360 安全技能中心

Taskqueue

这是AI代理工作流的轻量内存优先任务队列,核心功能包括:创建带优先级、标签的任务,认领最高优先级待处理任务,标记任务完成/失败,按状态或标签筛选任务,获取队列统计数据。通过HTTP API以JSON格式交互,适用于AI代理的任务调度场景,可作为轻量版Celery使用。

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

安装技能

复制下面的话术发给你的 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