← 返回
开发者工具 中文

Agent Task Queue

Build and operate a multi-agent task queue in OpenClaw with priority queues, delayed/dead-letter queues, scheduling, retry/timeout control, dependency manage...
在OpenClaw中构建并运行多智能体任务队列,支持优先级队列、延迟/死信队列、调度、重试/超时控制、依赖管理等。
imgolye
开发者工具 clawhub v0.1.0 1 版本 99846.2 Key: 无需
★ 0
Stars
📥 649
下载
💾 9
安装
1
版本
#latest

概述

Agent Task Queue

Use this skill when a task needs queue-based orchestration for multiple agents or workers. The bundled runtime is in src/ and covers:

  • Priority queue, delayed queue, and dead-letter queue behavior
  • Scheduler polling with concurrency limits, retries, and timeouts
  • Dependency validation, dependency gating, and result propagation
  • Task logs and aggregate metrics
  • Pluggable storage through in-memory, SQLite, or Redis backends

Workflow

  1. Import TaskQueue and Scheduler from src/index.ts.
  2. Pick storage:
    • Default InMemoryStorage for local execution or tests
    • SQLiteStorage for single-node persistence
    • RedisStorage for distributed workers
  3. Register handlers with scheduler.register(taskType, handler).
  4. Enqueue tasks with priority, runAt, dependencies, retryPolicy, and timeoutMs as needed.
  5. Drive execution via scheduler.tick() or scheduler.start().
  6. Inspect queue.logs(), queue.metrics(), queue.getSnapshot(), and queue.get(taskId) for state and traceability.

Key Files

  • src/TaskQueue.ts: queue lifecycle, ready/dead-letter snapshots, logs, metrics
  • src/Scheduler.ts: polling loop, concurrency control, retries, timeout handling
  • src/DependencyManager.ts: DAG validation and dependency result propagation
  • src/storage/: storage implementations
  • tests/task-queue.test.ts: behavior coverage
  • examples/basic.ts: end-to-end usage

Implementation Notes

  • Dependency tasks must already exist when a dependent task is enqueued.
  • A task becomes runnable only after all dependencies are completed.
  • Completed dependency results are stored and exposed to downstream handlers through context.dependencies.
  • When retries are exhausted, the task is moved to dead_letter.
  • Timeout cancellation uses AbortSignal; long-running handlers should watch context.signal.

Validation

Run:

npm run check

If Redis or SQLite packages are unavailable in the environment, install dependencies first with npm install.

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-30 15:57 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,462
ai-intelligence

Daily Hot Push

imgolye
每日推送中国热榜TOP10到飞书。从微博、知乎、百度、36氪筛选最重要的新闻,智能排除明星八卦和主观评论。
★ 2 📥 2,564
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,514