不预置固定拓扑
- 执行与隔离沉入底座,协作逻辑留在你的代码里。
- 树形委派、平级竞速或任务池,几十行 TypeScript 自由切换。
AnySwarm
让多个编程 Agent 在各自的沙箱里工作,用 TypeScript 定义它们如何协作,并回放整个过程。
只保留隔离、会话控制与归档原语,没有框架包袱
自由组合任意协作结构与自定义插件,无需改动底座
分区轨迹与可重放插件状态,动态协作问题一眼定位
// 1. Register host-enforced Services
const services = new ServiceRegistry();
services.register('handoff', handoff.service, { toolMode: 'cli' });// 2. Define Profiles & per-role Service permissions
const runtime = await createRuntime({
sandbox: createSandbox(config.sandbox),
models: config.models,
services,
outputDir: './runs',
profiles: {
publisher: { model: 'default', image, writable: false, services: { handoff: ['publish'] } },
writer: { model: 'default', image, writable: true, services: { handoff: ['take'] } },
},
});// 3. Spawn, drive via agent.id, verify on host, then close
const writer = await runtime.spawn({
requestId: 'spawn-writer', profile: 'writer',
collect: { paths: ['delivery.txt'], maxBytes: 4096, required: true },
});
await runInput(runtime, writer.id, 'Fetch handoff and write delivery.txt.', {
requestId: 'writer-turn', timeoutMs: 120_000,
});
const snap = await runtime.files.snapshot(writer.id, {
requestId: 'verify-delivery', paths: ['delivery.txt'],
});
await runtime.close({ timeoutMs: 60_000 }); // Stop → Export → DeleteWHY ANYSWARM
TRACE VIEWER
4 peers · 60分35秒 · 1,200 次模型请求 · 583 次 Service 调用 · 终评 53.071242 strict PASSMENTAL MODEL
createRuntime({ sandbox, models, connection, profiles, services, maxAgents, outputDir })EXAMPLES
多沙箱并行审阅仓库、补写测试并经宿主门禁验证后导出。
多路并行探索证明策略,通过共享引文库复用有效引理。
多只平级 Agent 提出补丁、互相评审,按客观评测分数收敛。