Skip to main content

HANI2

HANI2 is a web interface for human–agent negotiation studies. People negotiate in the browser against automated agents built with negmas, optionally helped by an AI support agent, while HANI2 records every offer, message, click and questionnaire answer. It runs the human–agent negotiation and hybrid intelligence tracks of the ANAC competition.

HANI2 is a Python package: a FastAPI backend plus a React frontend that ships pre-built inside the wheel.

Documentation: https://autoneg.github.io/hani2/

Install and run

Requires Python 3.11 or newer (tested up to 3.15).

pip install hani2
hani2 setup      # creates ~/negmas/hani2/settings with defaults, users and sample scenarios
hani2            # http://localhost:5006

One port (default 5006) serves:

URL What
/app The negotiation interface for logged-in users (user / userpass, admin / adminpass).
/play The no-login playground. Prolific participants arrive at /play?PROLIFIC_PID=....
/admin The admin console.
/api The REST and WebSocket API.

The support agent and LLM opponents need a language model. The defaults use a local Ollama model:

ollama pull qwen3:4b-instruct

Any provider supported by litellm works too; see Language models.

Features

  • Negotiation desk: the partner's offer on the table, a counter-offer editor, utility gauges with a no-deal marker, a conversation-style history, confirmation before accepting or ending, three layouts and a phone layout.
  • Tools: preferences, plots, histograms, the offer trace, an offer picker and more, in panes participants can rearrange. Write new ones in Python.
  • Support agent: an assistant that chats, highlights and annotates the interface, rearranges tools, shows interactive panels and, with permission, makes offers. It can also find, use and add tools. Sixteen capabilities and three autonomy levels.
  • Autopilot: the support agent or any negotiator plays the human's seat.
  • WebMCP: browser AI agents can read and (optionally) negotiate through the page's tools.
  • Opponents: any negmas, Genius or negmas-llm negotiator, your own classes, and named groups.
  • Studies: self-contained experiments, questionnaires, results CSV files and an event log with analytics.
  • Prolific: practice rounds, counted rounds and completion links.
  • Admin console: live sessions, results, analytics, users and all settings in the browser.
  • Accounts: password, GitHub and Google OAuth, or no login; optional consent form.

A custom support agent

# my_agent.py
from hani2.support_agent.runtime import SupportAgent


class RulesAgent(SupportAgent):
    def handle_user_message(self, text: str) -> None:
        actions = self.session_state.get("actions")
        if not actions:
            self.post("Load a scenario and start a negotiation first.")
            return
        ctx = self.run_on_doc(actions["context"])
        if ctx["partner_offer"] is None:
            self.post("Your partner has not made an offer yet.")
        elif ctx["partner_offer_utility"] < ctx["reserved_value"]:
            self.post("That offer is worse than walking away.")
        else:
            self.post("That offer beats your reserved value.")

Point agent_class in ~/negmas/hani2/settings/support_agent_settings.json at it and start the server from the folder that holds my_agent.py:

{"agent_class": "my_agent:RulesAgent"}
PYTHONPATH=$PWD hani2 --page play

The support agent tutorial goes from this to LLM agents that highlight the interface and show their own panels.

A custom tool

# my_tools.py
from hani2.tools import Tool, ui


class OfferCounter(Tool):
    name = "Offer Counter"
    description = "How many offers each side made so far."
    icon = "hash"
    pane = "side"

    def view(self):
        trace = self.trace()
        me = self.session_state.get("human_id")
        mine = sum(1 for row in trace if row[3] == me)
        return [ui.stats(ui.stat("Your offers", mine), ui.stat("Partner offers", len(trace) - mine))]

Register it in ~/negmas/hani2/settings/env.json:

{"tools": {"extra": ["my_tools:OfferCounter"]}}

See the tools tutorial.

Development

git clone https://github.com/autoneg/hani2
cd hani2
uv venv
uv pip install -e '.[dev]'
pytest

# the web app (writes the bundle to src/hani2/web)
cd frontend
npm install
npm run build

For frontend work, run hani2 --no-browser --dev and npm run dev in frontend/ (port 5173, proxied to the backend). To build the documentation, install .[docs] and run mkdocs serve.

License

AGPL-3.0-or-later. See LICENSE.

Metadata

Release files for hani2 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 hani2 0.1.0
File Size Uploaded Provenance Actions
hani2-0.1.0.tar.gz 5.2 MB With provenance Details for hani2-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 8.1 MB

Release files / hani2-0.1.0.tar.gz

Download URL hani2-0.1.0.tar.gz
Size 5.2 MB
Tags Source
SHA-256 checksum
How to use checksums
5f9ad737249d40c72c7e86bf7edc1d1cb1eec6262b81e3d5e89eddc61dd80add
BLAKE2b-256 checksum
How to use checksums
3ed74a944ee29f69a2ffa00ff21ccf08e1c7a6d0e2db4a68e4227b671dca127b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

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

Download URL hani2-0.1.0-py3-none-any.whl
Size 2.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
18d401cad852e6426f294cbdf5e5befc820bb3dd4c6213f338aa88ca3306abc8
BLAKE2b-256 checksum
How to use checksums
2dcd418ffe0fcd06bc9bf1d2ee7badcfebbaa748697810574c0b8da79f6ea46c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for hani2 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hani2-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

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 Full 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