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

agentjs-core

v1.0.1

Published

A comprehensive agent-based modeling framework with built-in p5.js visualization

Readme

AgentJS Core

npm version CI codecov License: MIT

A comprehensive agent-based modeling framework with built-in p5.js visualization, designed for social impact research and education.

🎯 Mission

Created in partnership with Apne Aap Women Worldwide, AgentJS enables educational tools that illuminate trafficking dynamics and demonstrate pathways to empowerment, supporting the vision of "a world where no child is bought or sold."

✨ Features

  • 🤖 Multi-Agent Systems - BaseAgent, MovingAgent, NetworkAgent with extensible properties
  • 🌍 Flexible Environments - Continuous space and grid-based environments with spatial indexing
  • 🔗 Social Networks - Dynamic network formation, influence propagation, and community detection
  • 📊 Data Analysis - Real-time metrics collection, statistical analysis, and export capabilities
  • 🎨 Rich Visualizations - p5.js integration with customizable agent rendering and animations
  • Performance Optimized - Spatial indexing, object pooling, and efficient algorithms
  • 📱 Cross-Platform - Works in browsers, Node.js, and modern bundlers
  • 🔬 Educational Focus - Designed for social impact research and complex systems education
  • 🧠 ML Integration - Built-in support for machine learning models and behavior trees

🚀 Quick Start

Installation

npm install @agentjs/core p5

Basic Usage

import { BaseAgent, ContinuousSpace, AgentManager, Visualizer } from '@agentjs/core';
import p5 from 'p5';

// Create environment and agents
const environment = new ContinuousSpace({ 
  width: 800, 
  height: 600, 
  boundaryType: 'periodic' 
});

const agentManager = new AgentManager();

// Create agents with custom properties
for (let i = 0; i < 50; i++) {
  const agent = new BaseAgent(`agent-${i}`, {
    autonomy: Math.random() * 100,
    resources: Math.random() * 100,
    type: 'community_member'
  });
  
  agentManager.addAgent(agent);
  environment.addAgent(agent, {
    x: Math.random() * 800,
    y: Math.random() * 600
  });
}

// Set up visualization
const sketch = (p: p5) => {
  p.setup = () => {
    p.createCanvas(800, 600);
  };
  
  p.draw = () => {
    p.background(240);
    
    // Step simulation
    agentManager.stepAll();
    
    // Visualize agents
    const agents = agentManager.getAllAgents();
    agents.forEach(agent => {
      const pos = agent.getPosition();
      const autonomy = agent.getProperty('autonomy') as number;
      
      p.fill(255 - autonomy * 2.55, autonomy * 2.55, 100);
      p.circle(pos.x, pos.y, 10);
    });
  };
};

new p5(sketch);

Social Network Example

import { NetworkAgent, NetworkManager, ConnectionType } from '@agentjs/core';

// Create network manager
const networkManager = new NetworkManager();

// Create network agents
const agent1 = new NetworkAgent('person1', { trust: 80, vulnerability: 30 }, networkManager);
const agent2 = new NetworkAgent('person2', { trust: 60, vulnerability: 70 }, networkManager);

// Form supportive connection
networkManager.addConnection(
  agent1.id,
  agent2.id,
  ConnectionType.SUPPORTIVE,
  0.8  // connection strength
);

// Analyze network
const analysis = networkManager.getNetworkAnalysis();
console.log(`Network has ${analysis.nodeCount} nodes and ${analysis.edgeCount} connections`);

🏗️ Architecture

@agentjs/core
├── core/
│   ├── agents/          # Agent classes and behaviors
│   ├── environment/     # Spatial environments
│   ├── scheduling/      # Agent activation patterns
│   └── interactions/    # Agent interactions and networks
├── visualization/       # p5.js rendering system
├── analysis/           # Data collection and statistics
├── examples/           # Interactive demos and ML models
└── utils/              # Utility functions

🧪 Development Status

Current Version: 1.0.0

This framework is actively developed as part of the EmptyAddress Network Autonomy Game project for social impact research and education.

Completed Features

✅ Core agent system (BaseAgent, MovingAgent, NetworkAgent) with property management
✅ Environment systems (ContinuousSpace, Grid2D) with spatial indexing
✅ Scheduling systems (RandomScheduler, SequentialScheduler)
✅ Network system (NetworkManager) with social influence and analysis
✅ Interaction engine for agent-to-agent interactions
✅ Behavior trees for complex agent behaviors
✅ Performance benchmarking and optimization
✅ Visualization system with p5.js integration, animations, and effects
✅ Machine learning model integration with TensorFlow.js
✅ TypeScript configuration with strict type checking
✅ Build system with Vite and comprehensive exports
✅ Comprehensive test suite validating all features

In Progress

🚧 Interactive demonstration examples
🚧 Documentation website and tutorials
🚧 Advanced ML model training examples

🤝 Contributing

This project is developed as part of the EmptyAddress educational initiative. Please see our contribution guidelines for details on how to participate.

📄 License

MIT License - see LICENSE file for details.

🙏 Acknowledgments

  • Apne Aap Women Worldwide for partnership and guidance
  • p5.js Community for visualization framework
  • Agent-Based Modeling Community for research foundations

Educational Impact: Every technical decision in this framework supports learning about trafficking dynamics, community empowerment, and social network effects in vulnerable populations.