Skip to main content

ABM Framework

PyPI version Python 3.9+ License: MIT

A service-centric agent-based modeling framework for social systems and public health applications.

Features

✨ Service-Centric Architecture - Agents are data containers, services contain all behavior logic 🔄 Event-Driven - Flexible event scheduling for complex interactions 🕸️ Network-Based - Built-in support for social networks using NetworkX 🎯 Zero Circular Dependencies - Clean, maintainable architecture 📊 Research-Ready - Designed for epidemiology and public health research 🚀 Extensible - Easy to add custom agents, services, and behaviors

Installation

pip install abm-framework

Quick Example

from layer1_core.entities.agent import Agent
from layer1_core.managers.service import Service
from layer2_simulation.world_builder import WorldBuilder
from layer2_simulation.single_runner import SingleRunner
from layer1_core.managers.schedule import Schedule

# 1. Define agents (data only)
class Student(Agent):
    def __init__(self, agent_id, mood=0.5):
        super().__init__(agent_id)
        self.mood = mood

# 2. Define services (behavior logic)
class InteractionService(Service):
    def interact(self, student1, student2):
        student1.mood += 0.1
        student2.mood += 0.1

    def schedule_interactions(self, schedule, students, steps):
        for step in range(1, steps):
            s1, s2 = random.sample(students, 2)
            schedule.add_event(
                step=step,
                event=lambda: self.interact(s1, s2)
            )

# 3. Build world
class SchoolWorld(WorldBuilder):
    def __init__(self, params):
        super().__init__(params)
        self.schedule = Schedule()

        # Register services
        self.interaction_service = InteractionService()
        self.services.register(self.interaction_service)

        # Create agents
        self.students = [Student(f"s{i}") for i in range(params['n_students'])]

    def setup_events(self):
        self.interaction_service.schedule_interactions(
            self.schedule, self.students, 1000
        )

# 4. Run simulation
world = SchoolWorld({'n_students': 50})
world.setup_events()

runner = SingleRunner(world)
runner.run(stopping_condition=lambda s: s.get_current_step() >= 1000)

print(f"Average mood: {sum(s.mood for s in world.students) / len(world.students):.2f}")

Architecture

The framework follows a layered service-centric architecture:

Core Principles

  1. Agents are data containers - Hold state (age, mood, etc.) with no behavior methods
  2. Services contain all behavior - All logic, interactions, and computations
  3. Services schedule events - Only services add events to the schedule
  4. Zero circular dependencies - Clean imports and dependencies

Layers

  • Layer 1: Core - Agents, Services, Networks, Schedules
  • Layer 2: Simulation - WorldBuilder, SingleRunner, Parameters
  • Layer 3: Parallel - Batch execution (planned)
  • Layer 4: Analysis - Parameter sweeps, calibration, workflows (planned)

Documentation

Use Cases

Perfect for modeling:

  • 🏥 Disease transmission and interventions
  • 🏫 Educational systems and outcomes
  • 🏘️ Neighborhood effects and segregation
  • 👥 Social network dynamics
  • 📊 Policy impact analysis

Requirements

  • Python 3.9+
  • NetworkX 3.0+

Contributing

Contributions welcome! Please read our contributing guidelines.

Citation

If you use this framework in your research, please cite:

@software{abm_framework_2026,
  title = {ABM Framework: Service-Centric Agent-Based Modeling},
  author = {Your Name},
  year = {2026},
  url = {https://github.com/yourusername/abm-framework}
}

License

MIT License - see LICENSE file for details.

Support


Note: This is an early-stage framework under active development. APIs may change.

Metadata

Release files for abm-framework 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for abm-framework 0.1.0
File Size Uploaded Provenance Actions
abm_framework-0.1.0.tar.gz 82.5 kB Without provenance Details for abm_framework-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for abm-framework 0.1.0
File Interpreter ABI Platform Actions
abm_framework-0.1.0-py3-none-any.whl Python 3 none any Details for abm_framework-0.1.0-py3-none-any.whl

Total release size: 93.7 kB

Release files / abm_framework-0.1.0.tar.gz

Download URL abm_framework-0.1.0.tar.gz
Size 82.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a08f5751ea1a571f907b8a576b55805b8e8f6fc77512c95610e4869fdfefb30e
BLAKE2b-256 checksum
How to use checksums
5d12cf540ee63fbd2c73ee82f60d6e0aeef0c6b7af5453bcfc9f8e5d85524668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / abm_framework-0.1.0-py3-none-any.whl

Download URL abm_framework-0.1.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c3e1f9023acc1117f07163f242258110bf0f063740947b9cdc3a68638b2f494
BLAKE2b-256 checksum
How to use checksums
8debcd040bc388e60174346b49f24585afbee55d9abdbddf86521e5543d087ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for abm-framework 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page