Agent-Weave
Master-Worker Agent Cluster with parallel task execution and secure parent-child communication.
When to Use This Skill
Use agent-weave when you need to:
- - Build distributed agent systems with parallel processing
- Orchestrate multiple agents working together
- Implement MapReduce-style workflows
- Scale task execution across worker agents
- Build master-worker architectures
Quick Start
Installation
CODEBLOCK0
Basic Usage
CODEBLOCK1
CLI Commands
CODEBLOCK2
Features
- - Master-Worker Architecture: Orchestrate multiple worker agents
- Parallel Execution: Distribute tasks across workers
- Secure Communication: Parent-child relationship enforcement
- MapReduce Support: Built-in map-reduce workflows
- Auto-scaling: Dynamic worker management
- Event-driven: EventEmitter-based communication
API Reference
Loom
Factory for creating and managing agents.
Master
Manages a cluster of worker agents.
Worker
Executes tasks assigned by the master.
Thread
Secure communication layer between agents.
Tapestry
Task orchestration engine for MapReduce workflows.
License
MIT
Agent-Weave
主从代理集群,支持并行任务执行与安全的父子通信。
适用场景
当您需要以下功能时,请使用 agent-weave:
- - 构建具备并行处理能力的分布式代理系统
- 编排多个协同工作的代理
- 实现 MapReduce 风格的工作流
- 跨工作代理扩展任务执行能力
- 构建主从架构
快速开始
安装
bash
npm install agent-weave
基本用法
javascript
const { Loom } = require(agent-weave);
// 创建集群
const loom = new Loom();
const master = loom.createMaster(my-cluster);
// 创建工作代理
const workers = loom.spawnWorkers(master.id, 5, async (data) => {
// 处理数据
return { result: data * 2 };
});
// 执行任务
const results = await master.dispatch([1, 2, 3, 4, 5]);
console.log(results);
CLI 命令
bash
创建主节点
weave loom create-master --name my-cluster
生成工作代理
weave loom spawn --parent
--count 5
列出代理
weave loom list --tree
功能特性
- - 主从架构:编排多个工作代理
- 并行执行:跨工作代理分发任务
- 安全通信:强制父子关系约束
- MapReduce 支持:内置映射归约工作流
- 自动扩缩容:动态管理工作代理
- 事件驱动:基于 EventEmitter 的通信机制
API 参考
Loom
用于创建和管理代理的工厂类。
Master
管理工作代理集群的主节点。
Worker
执行主节点分配的任务。
Thread
代理间的安全通信层。
Tapestry
用于 MapReduce 工作流的任务编排引擎。
许可证
MIT