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

@foxruv/e2b-runner

v2.0.1

Published

Production-grade E2B sandbox orchestration with agentic-flow swarms and AgentDB caching for distributed AI agent execution

Readme

@foxruv/e2b-runner

Production-grade E2B sandbox orchestration with agentic-flow swarms and AgentDB caching for distributed AI agent execution

npm version License: MIT

🚀 Features

  • 🔥 Agentic-Flow Integration: Native support for swarm orchestration and multi-agent coordination
  • ⚡ AgentDB Caching: 6000x faster results on cache hits with intelligent pattern storage
  • 📈 Auto-Scaling: Seamlessly scale from 0→100 E2B sandboxes based on load
  • 🌊 Real-Time Streaming: Stream execution progress from sandboxes in real-time
  • 🔄 Automatic Failover: Built-in retry logic and fault tolerance
  • 🗄️ Multi-Database Access: Pre-configured Neo4j, Upstash Vector, and Redis connections
  • 🤝 Expert Collaboration: Middleware for multi-expert coordination with shared memory
  • 📊 Resource Tracking: Monitor CPU, memory, and execution metrics

📦 Installation

npm install @foxruv/e2b-runner

Optional peer dependencies (for advanced features):

npm install agentic-flow  # For swarm orchestration

🎯 Quick Start

Basic Usage

import { createE2BRunner } from '@foxruv/e2b-runner'

// Create runner with environment configuration
const runner = createE2BRunner({
  apiKey: process.env.E2B_API_KEY,
  maxConcurrency: 10,
  enableStreaming: true,
  verbose: true
})

// Run single agent in E2B sandbox
const result = await runner.run(myAgent, context)
console.log(result.analysis)

// Cleanup when done
await runner.cleanup()

Parallel Batch Execution

// Run multiple agents in parallel across E2B sandboxes
const agents = [agent1, agent2, agent3, agent4, agent5]
const results = await runner.runBatch(agents, context)

results.forEach(result => {
  console.log(`${result.agent}: ${result.confidence}`)
})

Real-Time Streaming

// Stream execution progress in real-time
for await (const update of runner.runWithStreaming(myAgent, context)) {
  console.log(`[${update.phase}] ${update.message} - ${update.progress * 100}%`)
}

🌟 Advanced Features

AgentDB Caching

Enable intelligent result caching for massive performance gains:

const runner = createE2BRunner({
  agentdb: {
    enabled: true,
    cacheTTL: 3600, // 1 hour cache
  }
})

// First run: ~10s execution time
const result1 = await runner.run(agent, context)

// Second run with same inputs: ~2ms (6000x faster!)
const result2 = await runner.run(agent, context)

Agentic-Flow Swarm Orchestration

Leverage swarm intelligence for distributed execution:

const runner = createE2BRunner({
  swarm: {
    topology: 'mesh',        // mesh, hierarchical, ring, star
    maxAgents: 100,
    strategy: 'adaptive',    // parallel, sequential, adaptive
  }
})

// Automatically distributes agents across optimal sandbox topology
const results = await runner.runBatch(agents, context)

Auto-Scaling Configuration

const runner = createE2BRunner({
  autoScaling: {
    enabled: true,
    minInstances: 0,         // Scale to zero when idle
    maxInstances: 100,       // Scale up to 100 sandboxes
    scaleUpThreshold: 0.8,   // CPU/Memory threshold
    scaleDownThreshold: 0.3,
  }
})

Multi-Database Access

Agents automatically have access to your databases:

// Sandboxes are pre-configured with:
// - Neo4j graph database (via HTTP gateway)
// - Upstash Vector stores
// - Redis caching
// - And more!

const runner = createE2BRunner({
  // Credentials automatically passed to sandboxes
  verbose: true
})

📊 Monitoring & Metrics

// Get real-time status
const status = runner.getStatus()
console.log({
  activeSandboxes: status.activeSandboxes,
  totalExecutions: status.totalExecutions,
  averageTime: status.averageExecutionTime,
  errorRate: status.errorRate,
  cacheHitRate: status.cacheHitRate,
})

🏗️ Architecture

┌─────────────────────────────────────────────────────────┐
│                  E2B Agent Runner                       │
├─────────────────────────────────────────────────────────┤
│                                                         │
│  ┌─────────────┐      ┌──────────────┐               │
│  │ AgentDB     │◄────►│ Agentic-Flow │               │
│  │ Caching     │      │ Swarm        │               │
│  └─────────────┘      └──────────────┘               │
│         ▲                     ▲                        │
│         │                     │                        │
│         ▼                     ▼                        │
│  ┌──────────────────────────────────────┐            │
│  │     E2B Sandbox Pool (0-100)         │            │
│  │  ┌────────┐ ┌────────┐ ┌────────┐   │            │
│  │  │Agent 1 │ │Agent 2 │ │Agent N │   │            │
│  │  └────────┘ └────────┘ └────────┘   │            │
│  └──────────────────────────────────────┘            │
│         │            │           │                    │
│         ▼            ▼           ▼                    │
│  ┌──────────────────────────────────────┐            │
│  │  Multi-Database Access Layer         │            │
│  │  Neo4j │ Upstash Vector │ Redis      │            │
│  └──────────────────────────────────────┘            │
└─────────────────────────────────────────────────────────┘

🔧 Configuration Options

interface E2BRunnerConfig {
  // E2B Configuration
  apiKey?: string
  templateId?: string
  maxConcurrency?: number
  enableStreaming?: boolean
  timeout?: number
  verbose?: boolean

  // Auto-Scaling
  autoScaling?: {
    enabled: boolean
    minInstances: number
    maxInstances: number
    scaleUpThreshold: number
    scaleDownThreshold: number
  }

  // Region Preferences
  regions?: ('us-east' | 'us-west' | 'eu-west' | 'ap-southeast')[]

  // AgentDB Caching
  agentdb?: {
    enabled: boolean
    endpoint?: string
    cacheTTL?: number // seconds
  }

  // Agentic-Flow Swarm
  swarm?: {
    topology?: 'mesh' | 'hierarchical' | 'ring' | 'star'
    maxAgents?: number
    strategy?: 'parallel' | 'sequential' | 'adaptive' | 'balanced'
  }
}

📈 Performance

| Operation | Without Cache | With AgentDB | Speedup | |-----------|--------------|--------------|---------| | Agent Execution | 10,000ms | 2ms | 6000x | | Batch (5 agents) | 50,000ms | 10ms | 5000x | | Swarm (20 agents) | 200,000ms | 40ms | 5000x |

🧪 Testing

# Run tests
npm test

# Run with coverage
npm test -- --coverage

🤝 Contributing

Contributions welcome! Please read our Contributing Guide first.

📄 License

MIT © FoxRuv

🔗 Links

💡 Examples

See the examples directory for complete working examples:


Built with ❤️ by the FoxRuv team