@stigmergy/core
v0.2.0
Published
Pressure-field scheduling for multi-agent AI systems. Zero dependencies, pure TypeScript.
Maintainers
Readme
@stigmergy/core
Your multi-agent system doesn't need a manager. It needs a pressure field.
Most agent orchestration boils down to three bad options: polling on timers (wasteful), hardcoded if/else routing (brittle), or burning an LLM call to pick who goes next (slow and expensive). All three put coordination logic outside the system it's coordinating.
Stigmergy replaces them with a single primitive: a pressure field. Events deposit signals. Signals decay over time. When accumulated pressure crosses a threshold, the agent wakes and does the work. Dependencies resolve themselves through completion signals. Failed tasks create retry pressure automatically.
9.5x faster than LangGraph at 120 tasks / 30 agents. Scheduling overhead stays sub-millisecond at 1,000+ tasks -- the ceiling is your LLM API throughput, not the scheduler. Region-indexed storage and bounded signal accumulation mean it doesn't degrade as agent pools grow.
Zero dependencies, pure TypeScript. See the main repo for full benchmarks, scaling characteristics, and integration guides.
Install
npm install @stigmergy/coreQuick start
import { StigmergyScheduler } from "@stigmergy/core";
const scheduler = new StigmergyScheduler({
tickIntervalMs: 1000,
defaultWakeThreshold: 0.4,
});
scheduler.setDispatcher(async (agentId, task) => {
// your agent logic here
return { success: true };
});
scheduler.addTask({
id: "draft",
description: "Write first draft",
agentId: "writer",
dependencies: [],
priority: 0.8,
});
scheduler.addTask({
id: "review",
description: "Review the draft",
agentId: "reviewer",
dependencies: ["draft"],
priority: 0.6,
});
scheduler.start();Low-level field
For custom scheduling logic, use PressureField directly:
import { PressureField } from "@stigmergy/core";
const field = new PressureField({
decayHalfLifeSeconds: 300,
evaporationThreshold: 0.01,
});
field.deposit({ agentId: "system", signalType: "event", intensity: 0.8, targetAgentId: "writer" });
field.decay();
const pressure = field.readPressure("writer");Author
Built by Warwick McIntosh at Production Grade.
- GitHub: warwickmcintosh
- X: @warwickmcintosh
- Email: [email protected]
- Blog: blog.productiongrade.tech
License
MIT
