Skip to main content
Python Pypi License Downloads Code Quality Pypi Build Status Coverage Status Coding style black https://static.pepy.tech/personalized-badge/negmas?period=total&units=international_system&left_color=black&right_color=blue&left_text=Downloads

NegMAS is a Python library for developing autonomous negotiation agents embedded in simulation environments. It supports bilateral and multilateral negotiations, multiple negotiation protocols, and complex multi-agent simulations with interconnected negotiations.

Documentation: https://negmas.readthedocs.io/

Installation

pip install negmas

For additional features:

# With Genius bridge support (Java-based agents)
pip install negmas[genius]

# With visualization support
pip install negmas[plots]

# All optional dependencies
pip install negmas[all]

Quick Start

Run a simple negotiation in 10 lines:

from negmas import SAOMechanism, TimeBasedConcedingNegotiator, make_issue
from negmas.preferences import LinearAdditiveUtilityFunction as LUFun

# Define what we're negotiating about
issues = [make_issue(name="price", values=100)]

# Create negotiation session (Stacked Alternating Offers)
session = SAOMechanism(issues=issues, n_steps=50)

# Add buyer (prefers low price) and seller (prefers high price)
session.add(
    TimeBasedConcedingNegotiator(name="buyer"),
    ufun=LUFun.random(issues=issues, reserved_value=0.0),
)
session.add(
    TimeBasedConcedingNegotiator(name="seller"),
    ufun=LUFun.random(issues=issues, reserved_value=0.0),
)

# Run and get result
result = session.run()
print(f"Agreement: {result.agreement}, Rounds: {result.step}")

Multi-issue negotiation with custom preferences:

from negmas import SAOMechanism, AspirationNegotiator, make_issue
from negmas.preferences import LinearAdditiveUtilityFunction

# Create a 2-issue negotiation domain
issues = [
    make_issue(name="price", values=10),
    make_issue(name="quantity", values=5),
]

# Define utility functions
buyer_ufun = LinearAdditiveUtilityFunction(
    values={
        "price": lambda x: 1.0 - x / 10.0,  # lower price = better
        "quantity": lambda x: x / 5.0,  # more quantity = better
    },
    issues=issues,
)
seller_ufun = LinearAdditiveUtilityFunction(
    values={
        "price": lambda x: x / 10.0,  # higher price = better
        "quantity": lambda x: 1.0 - x / 5.0,  # less quantity = better
    },
    issues=issues,
)

# Run negotiation
session = SAOMechanism(issues=issues, n_steps=100)
session.add(AspirationNegotiator(name="buyer"), ufun=buyer_ufun)
session.add(AspirationNegotiator(name="seller"), ufun=seller_ufun)
session.run()

# Visualize
session.plot()

Command Line Interface

NegMAS includes a negotiate CLI for quick experimentation:

# Run with default negotiators
negotiate -s 50

# Specify negotiators and steps
negotiate -n AspirationNegotiator -n NaiveTitForTatNegotiator -s 100

# Use Python-native Genius agents (no Java required)
negotiate -n GBoulware -n GConceder -s 50

# Use custom BOA components
negotiate -n "boa:offering=GTimeDependentOffering(e=0.2),acceptance=GACNext" -n AspirationNegotiator

# Save results and plot
negotiate -s 100 --save-path ./results

See negotiate --help for all options, or the CLI documentation.

Architecture Overview

NegMAS is built around four core concepts:

┌─────────────────────────────────────────────────────────────────┐
│                           WORLD                                 │
│  (Simulation environment where agents interact)                 │
│                                                                 │
│   ┌─────────┐     ┌─────────┐         ┌─────────────────────┐  │
│   │  Agent  │     │  Agent  │   ...   │  BulletinBoard      │  │
│   │         │     │         │         │  (Public info)      │  │
│   └────┬────┘     └────┬────┘         └─────────────────────┘  │
│        │               │                                        │
│        │ creates       │ creates                                │
│        ▼               ▼                                        │
│   ┌─────────────────────────────────────────────────────────┐  │
│   │                    MECHANISM                             │  │
│   │  (Negotiation protocol: SAO, SingleText, Auction, etc.) │  │
│   │                                                          │  │
│   │   ┌────────────┐  ┌────────────┐  ┌────────────┐        │  │
│   │   │ Negotiator │  │ Negotiator │  │ Negotiator │        │  │
│   │   │  + UFun    │  │  + UFun    │  │  + UFun    │        │  │
│   │   └────────────┘  └────────────┘  └────────────┘        │  │
│   └─────────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────────┘

Core Components:

  1. Outcome Space (outcomes module) - Issues: Variables being negotiated (price, quantity, delivery date, etc.) - Outcomes: Specific assignments of values to issues - Supports discrete, continuous, and categorical issues

  2. Preferences (preferences module) - UtilityFunction: Maps outcomes to utility values - Built-in types: LinearAdditiveUtilityFunction, MappingUtilityFunction, NonLinearAggregationUtilityFunction, and more - Supports probabilistic and dynamic utility functions

  3. Negotiators (negotiators, sao modules) - Implement negotiation strategies - Built-in: AspirationNegotiator, TitForTatNegotiator, NaiveTitForTatNegotiator, BoulwareTBNegotiator, etc. - Easy to create custom negotiators

  4. Mechanisms (mechanisms, sao modules) - Implement negotiation protocols - SAOMechanism: Stacked Alternating Offers (most common) - Also: Single-text protocols, auction mechanisms, etc.

For Situated Negotiations (World Simulations):

  1. Worlds (situated module) - Simulate environments where agents negotiate - Agents can run multiple concurrent negotiations - Example: Supply chain simulations (SCML)

  2. Controllers (sao.controllers module) - Coordinate multiple negotiators - Useful when negotiations are interdependent

Key Features

  • Multiple Protocols: SAO (Alternating Offers), Single-Text, Auctions, and custom protocols

  • Rich Utility Functions: Linear, nonlinear, constraint-based, probabilistic, dynamic

  • Bilateral & Multilateral: Support for 2+ party negotiations

  • Concurrent Negotiations: Agents can participate in multiple negotiations simultaneously

  • World Simulations: Build complex multi-agent simulations with situated negotiations

  • Genius Integration: Run Java-based Genius agents via the built-in bridge

  • Visualization: Built-in plotting for negotiation analysis

  • Extensible: Easy to add new protocols, negotiators, and utility functions

Creating Custom Negotiators

NegMAS offers two approaches to creating custom negotiators:

  1. Inheritance: Subclass a base negotiator and override methods

  2. Composition: Combine multiple negotiators using MetaNegotiator

Inheritance (Traditional Approach)

Subclass a base negotiator and implement the required methods:

from negmas.sao import SAONegotiator, ResponseType


class MyNegotiator(SAONegotiator):
    """A simple negotiator using inheritance."""

    def propose(self, state, dest=None):
        # Propose a random outcome above reservation value
        return self.nmi.random_outcome()

    def respond(self, state, source=None):
        offer = state.current_offer
        # Accept any offer with utility > 0.8
        if offer is not None and self.ufun(offer) > 0.8:
            return ResponseType.ACCEPT_OFFER
        return ResponseType.REJECT_OFFER

Using the negotiator:

session = SAOMechanism(issues=issues, n_steps=100)
session.add(MyNegotiator(name="custom"), ufun=my_ufun)
session.add(AspirationNegotiator(name="opponent"), ufun=opponent_ufun)
session.run()

Composition (Ensemble Approach)

Use SAOAggMetaNegotiator to combine multiple negotiators and aggregate their decisions:

from negmas.sao import SAOMechanism, ResponseType
from negmas.sao.negotiators import (
    SAOAggMetaNegotiator,
    BoulwareTBNegotiator,
    NaiveTitForTatNegotiator,
)


class MajorityVoteNegotiator(SAOAggMetaNegotiator):
    """An ensemble negotiator that uses majority voting."""

    def aggregate_proposals(self, state, proposals, dest=None):
        # Use the proposal from the first negotiator that offers something
        for neg, proposal in proposals:
            if proposal is not None:
                return proposal
        return None

    def aggregate_responses(self, state, responses, offer, source=None):
        # Majority vote: accept if more than half accept
        accept_count = sum(1 for _, r in responses if r == ResponseType.ACCEPT_OFFER)
        if accept_count > len(responses) / 2:
            return ResponseType.ACCEPT_OFFER
        return ResponseType.REJECT_OFFER


# Create an ensemble of different strategies
ensemble = MajorityVoteNegotiator(
    negotiators=[
        BoulwareTBNegotiator(),  # Tough strategy
        NaiveTitForTatNegotiator(),  # Reactive strategy
        BoulwareTBNegotiator(),  # Another tough vote
    ],
    name="ensemble",
)

# Use in a negotiation
session = SAOMechanism(issues=issues, n_steps=100)
session.add(ensemble, ufun=my_ufun)
session.add(AspirationNegotiator(name="opponent"), ufun=opponent_ufun)
session.run()

The ensemble approach is useful for:

  • Voting strategies: Combine multiple negotiators via majority/weighted voting

  • Dynamic delegation: Switch between strategies at runtime

  • A/B testing: Compare strategies within the same negotiation

Composition (BOA Components)

Use BOANegotiator to build negotiators from reusable components following the Bidding-Opponent modeling-Acceptance (BOA) pattern:

from negmas.gb.negotiators.modular import BOANegotiator
from negmas.gb.components import (
    GSmithFrequencyModel,  # Opponent modeling
    GACTime,  # Acceptance strategy
    GTimeDependentOffering,  # Offering strategy
)

# Create a BOA negotiator with Genius-style components
negotiator = BOANegotiator(
    offering=GTimeDependentOffering(e=0.2),  # Boulware-style offering
    acceptance=GACTime(t=0.95),  # Accept after 95% of time
    model=GSmithFrequencyModel(),  # Opponent frequency model
    name="my_boa_agent",
)

The BOA approach is useful for:

  • Mix-and-match: Combine different strategies from the Genius library

  • Research: Easily swap components to compare different strategies

  • Extensibility: Create custom components that integrate with existing ones

Creating Custom Protocols

from negmas import Mechanism, MechanismStepResult


class MyProtocol(Mechanism):
    def __call__(self, state, action=None):
        # Implement one round of your protocol
        # Return MechanismStepResult with updated state
        ...
        return MechanismStepResult(state=state)

Running World Simulations

For complex scenarios with multiple agents and concurrent negotiations:

from negmas.situated import World, Agent


class MyAgent(Agent):
    def step(self):
        # Called each simulation step
        # Request negotiations, respond to events, etc.
        pass


# See SCML package for a complete example
# pip install scml

Citation

If you use NegMAS in your research, please cite:

@inproceedings{mohammad2021negmas,
  title={NegMAS: A Platform for Automated Negotiations},
  author={Mohammad, Yasser and Nakadai, Shinji and Greenwald, Amy},
  booktitle={PRIMA 2020: Principles and Practice of Multi-Agent Systems},
  pages={343--351},
  year={2021},
  publisher={Springer},
  doi={10.1007/978-3-030-69322-0_23}
}

Reference:

Mohammad, Y., Nakadai, S., Greenwald, A. (2021). NegMAS: A Platform for Automated Negotiations. In: PRIMA 2020. LNCS, vol 12568. Springer. https://doi.org/10.1007/978-3-030-69322-0_23

The NegMAS Ecosystem

NegMAS is the core of a broader ecosystem for automated negotiation research:

NegMAS Ecosystem

Competition Frameworks

  • anl - Automated Negotiation League (ANAC negotiation track)

  • scml - Supply Chain Management League

Agent Repositories

Bridges & Extensions

Visualization & Tools

  • negmas-app - Applications and interfaces for NegMAS

  • scml-vis - SCML visualization

  • jnegmas - Java interface (not maintained)

Specialized Tools

  • negmas-elicit - Preference Elicitation during Negotiation Methods

More Resources

Papers Using NegMAS

Selected papers (see full list):

Core NegMAS Research (by the NegMAS authors)

Competition & Benchmarks

Negotiation Strategies

Applications

Last updated: February 2026

Contributing

Contributions are welcome! Please see the contributing guide.

License

NegMAS is released under the BSD 3-Clause License.

AI Assistance Disclosure

This project uses AI assistance for specific, limited tasks while remaining predominantly human-developed:

  • Publications list: AI assisted in compiling and formatting the publications list

  • Documentation polishing: AI assisted in proofreading and improving documentation clarity

  • gb.components.genius module: AI assisted in reimplementing Genius BOA components in NegMAS

  • Registry feature: AI assisted in developing the negotiator/mechanism registry system

  • Some tests: AI assisted in writing tests, particularly for new features like the registry

  • tournaments.analysis module: AI assisted in implementing the post-tournament game-theoretic and statistical analysis package (EGTA-based evaluation, Sequential Elimination Ranking, replicator dynamics, and pairwise significance/normality testing)

All AI-assisted contributions are reviewed and approved by human maintainers. The core architecture, algorithms, and research direction of NegMAS are human-driven and will remain so.

Acknowledgements

NegMAS was developed at the NEC-AIST collaborative laboratory. It uses scenarios from ANAC 2010-2018 competitions obtained from the Genius Platform.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

negmas-0.16.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

negmas-0.16.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file negmas-0.16.0.tar.gz.

File metadata

  • Download URL: negmas-0.16.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for negmas-0.16.0.tar.gz
Algorithm Hash digest
SHA256 c4bde84532fff62748f468f85704e7a2be0fd85808dccfd0b912548df0209e21
MD5 79ecf47b52453f756ec7de4f885c351f
BLAKE2b-256 72611c12d915e5bed01e346566cf39913c080c3bbcbd861a87f4d522b258190c

See more details on using hashes here.

File details

Details for the file negmas-0.16.0-py3-none-any.whl.

File metadata

  • Download URL: negmas-0.16.0-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for negmas-0.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb5c2b14156a4aabec78df68136b99833ae0eb4075ed8f7525fff2322e72e42d
MD5 b11c453c3ddb494c515f0ad70551e1c3
BLAKE2b-256 ab8a77c1c00af857e9bca45e3c4327499c7b6507ef7d477c1d5e9c852a8d014f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.16.0 This release

2 files

0.15.7

2 files

0.15.6

2 files

0.15.5

2 files

0.15.4

2 files

0.15.3

2 files

0.15.2

2 files

0.15.1.post1

2 files

0.15.1

2 files

0.15.0

2 files

0.14.0

2 files

0.13.1

2 files

0.12.0

2 files

0.11.3

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.23

2 files

0.10.22

2 files

0.10.21

2 files

0.10.20

2 files

0.10.19

2 files

0.10.18

2 files

0.10.17

2 files

0.10.16

2 files

0.10.15

2 files

0.10.14

2 files

0.10.13

2 files

0.10.12

2 files

0.10.11

2 files

0.10.10

2 files

0.10.9

2 files

0.10.8

2 files

0.10.7

2 files

0.10.6

2 files

0.10.5

2 files

0.10.4

2 files

0.10.3

2 files

0.10.1

2 files

0.10.0

2 files

0.9.8

2 files

0.9.7

2 files

0.9.6

2 files

0.9.5

2 files

0.9.4

2 files

0.9.3

2 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.8.9

2 files

0.8.8

2 files

0.8.7

2 files

0.8.6

2 files

0.8.5

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.14

2 files

0.6.13

2 files

0.6.12

2 files

0.6.11

2 files

0.6.10

2 files

0.6.9

2 files

0.6.8

2 files

0.6.7

2 files

0.6.6

2 files

0.6.5

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.1

2 files

0.5.0

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.2.25

2 files

0.2.24

2 files

0.2.23

2 files

0.2.22

2 files

0.2.21

2 files

0.2.20

2 files

0.2.19

2 files

0.2.17

2 files

0.2.16

2 files

0.2.15

2 files

0.2.14

2 files

0.2.12

2 files

0.2.11

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.46

2 files

0.1.45

2 files

0.1.44

2 files

0.1.41

2 files

0.1.39

2 files

0.1.38

2 files

0.1.37

2 files

0.1.36

2 files

0.1.35

2 files

0.1.34

2 files

0.1.32

2 files

0.1.31

2 files

0.1.30

2 files

0.1.29

2 files

0.1.25

1 file

0.1.24

1 file

0.1.23

1 file

0.1.18

1 file

0.1.17

1 file

0.1.16

1 file

0.1.15

1 file

0.1.14

1 file

0.1.13

1 file

0.1.12

1 file

0.1.11

1 file

0.1.10

1 file

0.1.7

1 file

0.1.6

1 file

0.1.3

1 file

0.1.2

1 file

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