npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cdzzy/agent-kernel

v0.7.0

Published

Multi-Agent traffic control layer - resource scheduling, priority arbitration, deadlock detection, and concurrency primitives for AI agent systems

Downloads

167

Readme

agent-kernel ⚙️

Part of the Agent OS suite — kernel · network · memory · policy · audit · testing

The operating system kernel for multi-agent systems.

Like an OS kernel manages processes, agent-kernel manages concurrent AI agents — scheduling, resource allocation, deadlock detection, and message routing.

TypeScript License: MIT Tests


The Problem

Running multiple AI agents concurrently is hard. Without coordination:

  • Agents compete for shared resources (API rate limits, memory, tools)
  • Long-running tasks block short, urgent ones
  • Agents can deadlock waiting for each other's output
  • No visibility into what's running, what's waiting, what failed

agent-kernel solves this. It's the runtime that gives multi-agent systems the same reliability guarantees that OS kernels give to processes.


Features

  • ⚡ Priority scheduler — agents run by priority (CRITICAL → HIGH → NORMAL → LOW → BACKGROUND)
  • 🔒 Resource manager — cap concurrent LLM calls, tool invocations, and memory usage
  • 💰 Resource budgets — per-agent token / wall-time / tool-call limits (v0.2.0)
  • 💬 Message bus — pub/sub and point-to-point messaging between agents
  • 🔁 Rate limiter — token bucket rate limiting per agent or globally
  • 🔍 Deadlock detector — detect and resolve circular wait conditions
  • 🎯 Priority arbiter — resolve resource conflicts between competing agents
  • 🔄 Concurrency primitives — mutex, semaphore, and barrier for agent coordination
  • ❤️ Health monitoring — fleet health checks with auto-recovery (v0.2.0)
  • 🐝 Swarm mode — decentralized capability-aware routing (v0.2.0)
  • 🧠 Model router — complexity-aware routing to fast/standard/reasoning models (v0.2.0)
  • 📊 Observability — Prometheus-style metrics + alerting (v0.2.0)
  • 🗂️ Task decomposition — hierarchical task breakdown with Mermaid/DOT graphs (v0.2.0)
  • 🔌 A2A registry — Agent Card service discovery (v0.2.0)
  • 🛠️ MCP tool registry — centralized tool management with access control (v0.2.0)

Installation

npm install agent-kernel

Quick Start

import { Kernel } from 'agent-kernel';

// Create a kernel with resource limits
const kernel = new Kernel({
  maxConcurrentAgents: 10,
  globalRateLimit: { tokensPerSecond: 100 },
  deadlockCheckInterval: 5000,
});

// Register an agent task
const taskId = await kernel.schedule({
  agentId: 'researcher',
  priority: 'HIGH',
  resources: ['llm:gpt-4o', 'tool:web-search'],
  run: async (ctx) => {
    const result = await ctx.tools.webSearch('latest AI news');
    return { summary: result.topResults };
  },
});

// Wait for result
const result = await kernel.waitFor(taskId);
console.log(result.summary);

Core Concepts

Priority Levels

type Priority = 'CRITICAL' | 'HIGH' | 'NORMAL' | 'LOW' | 'BACKGROUND';
  • CRITICAL — user-facing, blocks UI, must complete immediately
  • HIGH — important background work, preempts NORMAL
  • NORMAL — default for most agent tasks
  • LOW — non-urgent, runs when system is idle
  • BACKGROUND — maintenance tasks (memory sweep, log archival)

Resource Manager

Prevent agents from overwhelming external APIs:

kernel.setResourceLimit('llm:gpt-4o', {
  maxConcurrent: 5,       // max 5 simultaneous calls
  maxPerMinute: 60,       // 60 calls per minute
  maxTokensPerHour: 1_000_000, // token budget
});

Message Bus

Agents communicate without direct coupling:

import { MessageBus } from 'agent-kernel';

const bus = new MessageBus();

// Subscribe
bus.subscribe('research.complete', async (msg) => {
  console.log(`Research done: ${msg.payload.summary}`);
});

// Publish
await bus.publish('research.complete', {
  agentId: 'researcher',
  payload: { summary: '...' },
});

// Point-to-point
await bus.send('writer-agent', {
  type: 'REQUEST',
  content: 'Please summarize this research',
  replyTo: 'coordinator-agent',
});

Deadlock Detection

const kernel = new Kernel({
  deadlockDetection: {
    enabled: true,
    checkInterval: 5000,     // check every 5 seconds
    resolution: 'abort-lowest-priority', // or 'timeout' | 'manual'
    onDeadlock: (cycle) => {
      console.error(`Deadlock detected: ${cycle.map(a => a.agentId).join(' → ')}`);
    },
  },
});

Scheduler

The scheduler implements priority-based preemptive scheduling:

import { Scheduler } from 'agent-kernel';

const scheduler = new Scheduler({
  algorithm: 'priority-preemptive',
  timeSlice: 1000,  // ms before checking for higher-priority tasks
  agingEnabled: true,  // prevent starvation of low-priority tasks
});

Comparison

| Feature | agent-kernel | LangGraph | AutoGen | CrewAI | |---------|-------------|-----------|---------|--------| | Priority scheduling | ✅ | ❌ | ❌ | ❌ | | Resource limits | ✅ | ⚠️ | ❌ | ❌ | | Deadlock detection | ✅ | ❌ | ❌ | ❌ | | Framework-agnostic | ✅ | ❌ | ❌ | ❌ | | Concurrency primitives | ✅ | ❌ | ❌ | ❌ |


Roadmap

  • [x] Agent health checks and auto-restart policies ✅ (src/health-check.ts, v0.2.0)
  • [x] Resource budget system ✅ (src/resource-budget.ts, v0.2.0)
  • [x] Swarm mode (decentralized routing) ✅ (src/swarm.ts, v0.2.0)
  • [x] A2A native support (Agent Card discovery) ✅ (src/a2a-registry.ts, v0.2.0)
  • [x] MCP tool integration layer ✅ (src/mcp-registry.ts, v0.2.0)
  • [x] Reasoning model routing ✅ (src/model-router.ts, v0.2.0)
  • [x] Observability dashboard + metrics ✅ (src/observability.ts, v0.2.0)
  • [x] Task decomposition + dependency graph ✅ (src/decomposition.ts, v0.2.0)
  • [x] Docker Compose deployment ✅ (docker-compose.yml, v0.2.0)
  • [x] TraceShield audit bridge (attachTraceShield — every task, deadlock, budget, and health event lands in the tamper-evident audit trail) ✅ (v0.5.0)
  • [x] Distributed mode (KernelHttpEndpoint + RemoteKernelClient — expose a kernel over HTTP, execute tasks on remote machines with named handlers) ✅ (v0.7.0)
  • [ ] OpenTelemetry tracing integration
  • [x] Kernel inspection CLI (agent-kernel status, agent-kernel agents, agent-kernel top) ✅ (v0.3.0)
  • [x] Work-stealing scheduler (WorkStealingPool — idle workers steal from the busiest queue, rebalanced through the kernel) ✅ (v0.4.0)
  • [x] Persistent task queue (PersistentTaskQueue — write-ahead journal, at-least-once recovery, dependency remapping) ✅ (v0.6.0)

Examples

examples/
  01_quickstart.ts         # Single agent with kernel
  02_priority_demo.ts      # Mixed-priority agents
  03_resource_limits.ts    # Rate limiting in action
  04_message_bus.ts        # Agent communication patterns
  05_deadlock_scenario.ts  # Deadlock detection and resolution

Flagship Example

See examples/flagship/ — a complete Agent OS walkthrough wiring three layers of the stack together: agent-kernel schedules a researcher → writer → reviewer pipeline, traceshield audits every task into a hash-chain-verified log (rendered as a Mermaid attribution graph), and engram provides the shared long-term memory the agents collaborate through.

cd examples/flagship
npm install   # builds the git-installed stack automatically
npm start

License

MIT © cdzzy