hani 0.1.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hani-0.2.2/CHANGELOG.md +218 -0
- hani-0.2.2/MANIFEST.in +20 -0
- hani-0.2.2/PKG-INFO +373 -0
- hani-0.2.2/README.md +338 -0
- {hani-0.1.0 → hani-0.2.2}/pyproject.toml +54 -7
- hani-0.2.2/src/hani/app.py +2920 -0
- hani-0.2.2/src/hani/auth.py +269 -0
- hani-0.2.2/src/hani/color_palettes.py +114 -0
- hani-0.2.2/src/hani/common.py +357 -0
- hani-0.2.2/src/hani/config/default.yaml +4 -0
- hani-0.2.2/src/hani/default_settings/consent.md +15 -0
- hani-0.2.2/src/hani/default_settings/env.json +5 -0
- hani-0.2.2/src/hani/default_settings/scenario_order.txt +3 -0
- hani-0.2.2/src/hani/event_analytics.py +542 -0
- hani-0.2.2/src/hani/event_tracking.py +363 -0
- hani-0.2.2/src/hani/events.py +653 -0
- hani-0.2.2/src/hani/experiment_selector.py +208 -0
- hani-0.2.2/src/hani/find_scenario_source.py +193 -0
- hani-0.2.2/src/hani/helpers/negotiators.py +2098 -0
- hani-0.2.2/src/hani/images/hani.JPG +0 -0
- hani-0.2.2/src/hani/images/hani1.JPG +0 -0
- hani-0.2.2/src/hani/images/hani2.JPG +0 -0
- hani-0.2.2/src/hani/images/hani3.JPG +0 -0
- hani-0.2.2/src/hani/images/hani4.JPG +0 -0
- hani-0.2.2/src/hani/llm_service.py +914 -0
- hani-0.2.2/src/hani/make_scenarios.py +86 -0
- hani-0.2.2/src/hani/register.py +219 -0
- hani-0.2.2/src/hani/run.py +112 -0
- hani-0.2.2/src/hani/runanalytics.py +43 -0
- hani-0.2.2/src/hani/runapp.py +175 -0
- hani-0.2.2/src/hani/runexperiment.py +236 -0
- hani-0.2.2/src/hani/runguest.py +72 -0
- hani-0.2.2/src/hani/runregister.py +130 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Grocery/Grocery.yml +24 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Grocery/_info.yaml +23 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Grocery/agent.yml +21 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Grocery/display.py +30 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Grocery/human.yml +17 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Island/Island.yml +44 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Island/_info.yaml +29 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Island/agent.yml +45 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Island/display.py +30 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Island/human.yml +45 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Trade/Buyer.yml +25 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Trade/Seller.yml +25 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Trade/Trade.yml +15 -0
- hani-0.2.2/src/hani/sample_scenarios/Default/Trade/_info.yaml +34 -0
- hani-0.2.2/src/hani/scenarios/__init__.py +0 -0
- hani-0.2.2/src/hani/scenarios/common.py +48 -0
- hani-0.2.2/src/hani/scenarios/grocery.py +180 -0
- hani-0.2.2/src/hani/scenarios/island.py +184 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/scenarios/trade.py +7 -49
- hani-0.2.2/src/hani/static/theme.css +414 -0
- hani-0.2.2/src/hani/templates/basic_login.html +112 -0
- hani-0.2.2/src/hani/templates/logout.html +93 -0
- hani-0.2.2/src/hani/tools/generator.py +311 -0
- hani-0.2.2/src/hani/tools/helpers/__init__.py +0 -0
- hani-0.2.2/src/hani/tools/histograms.py +184 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/tools/history.py +7 -1
- {hani-0.1.0 → hani-0.2.2}/src/hani/tools/outcome_plot.py +26 -12
- hani-0.2.2/src/hani/tools/preferences.py +237 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/tools/results.py +119 -13
- {hani-0.1.0 → hani-0.2.2}/src/hani/tools/scenario_info.py +5 -5
- {hani-0.1.0 → hani-0.2.2}/src/hani/tools/tool.py +77 -10
- {hani-0.1.0 → hani-0.2.2}/src/hani/tools/urange.py +9 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/tools/utility_plot2d.py +36 -13
- hani-0.2.2/src/hani.egg-info/PKG-INFO +373 -0
- hani-0.2.2/src/hani.egg-info/SOURCES.txt +86 -0
- hani-0.2.2/src/hani.egg-info/entry_points.txt +7 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani.egg-info/requires.txt +6 -1
- hani-0.2.2/tests/test_auth.py +226 -0
- hani-0.2.2/tests/test_event_tracking.py +607 -0
- hani-0.2.2/tests/test_registration.py +170 -0
- hani-0.2.2/tests/test_scenario_loading.py +192 -0
- hani-0.2.2/tests/test_tools.py +339 -0
- hani-0.1.0/PKG-INFO +0 -50
- hani-0.1.0/README.md +0 -20
- hani-0.1.0/src/hani/app.py +0 -1316
- hani-0.1.0/src/hani/common.py +0 -82
- hani-0.1.0/src/hani/run.py +0 -37
- hani-0.1.0/src/hani/tools/histograms.py +0 -146
- hani-0.1.0/src/hani/tools/preferences.py +0 -123
- hani-0.1.0/src/hani.egg-info/PKG-INFO +0 -50
- hani-0.1.0/src/hani.egg-info/SOURCES.txt +0 -31
- hani-0.1.0/src/hani.egg-info/entry_points.txt +0 -2
- {hani-0.1.0 → hani-0.2.2}/setup.cfg +0 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/__init__.py +0 -0
- /hani-0.1.0/src/hani/scenarios/__init__.py → /hani-0.2.2/src/hani/announcements.md +0 -0
- {hani-0.1.0/src/hani/tools → hani-0.2.2/src/hani}/helpers/__init__.py +0 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/helpers.py +0 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/negotiator.py +0 -0
- {hani-0.1.0/src/hani/sample_scenarios → hani-0.2.2/src/hani/sample_scenarios/Default}/Trade/display.py +0 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/scenario_makers.py +0 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/scenarios/base.py +0 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/tools/__init__.py +0 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani/tools/random.py +0 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani.egg-info/dependency_links.txt +0 -0
- {hani-0.1.0 → hani-0.2.2}/src/hani.egg-info/top_level.txt +0 -0
hani-0.2.2/CHANGELOG.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the HANI (Human-Agent Negotiation Interface) project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.2.2] - 2026-03-16
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Action Panel UX Improvements**:
|
|
12
|
+
- Confirmation dialogs for Accept and End actions showing utility values
|
|
13
|
+
- Utility values displayed in button labels: "Accept (X%)" and "End & Leave (X%)"
|
|
14
|
+
- "Reject and counter" button that hides partner offer section for focused counter-offer creation
|
|
15
|
+
- "Undo decision" button to restore partner offer section
|
|
16
|
+
- Validation alert for text-only mode when no text is entered
|
|
17
|
+
- **CLI Service Flags**: Added `--no-main`, `--no-reg`, `--no-guest` flags to selectively disable services
|
|
18
|
+
- **Agent Group Selection**: Added `--agents` group selection with `:llm`, `:template`, `:negmas`, `:hani`, `:genius` syntax
|
|
19
|
+
- **Default Settings Fallback**: App now works without settings folder by using built-in defaults
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- Partner text removed from action panel (shown in history panel only)
|
|
23
|
+
- Button colors updated: End=danger (red), Reject and counter=primary (blue), Accept=success (green)
|
|
24
|
+
- All action buttons (Reject and counter, Accept, End) now displayed in one row
|
|
25
|
+
- Renamed "Inverter" tool to "Utility-based Selector"
|
|
26
|
+
- LLM and Random negotiator tools now admin-only
|
|
27
|
+
- Default configuration changed to only enable Template-Based negotiators
|
|
28
|
+
- **Dependencies Updated**:
|
|
29
|
+
- `negmas` updated to `>=0.15.2`
|
|
30
|
+
- `negmas-llm` updated to `>=0.4.2`
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
- Preferences panel layout: single-line disagreement value, shorter bar chart with smaller font
|
|
34
|
+
- Handle `*WithTextNegotiator` classes from negmas_llm in `get_agent_type()`
|
|
35
|
+
|
|
36
|
+
## [0.2.0] - 2026-03-09
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
- **Command-line Agent Configuration**: Added ability to pass negotiator types via `--agents` command-line argument
|
|
40
|
+
- New `--agents` flag accepts comma-separated list of negotiator types (e.g., `hani --agents "AspirationNegotiator,helpers.AgentK"`)
|
|
41
|
+
- Command-line agents take precedence over environment variable configuration
|
|
42
|
+
- Added "Command Line/Env" checkbox in partner selection UI
|
|
43
|
+
- Checkbox is enabled and checked by default when agents are configured via CLI or environment variable
|
|
44
|
+
- When enabled, all other negotiator category checkboxes (LLM, NegMAS, HANI, Genius) default to unchecked
|
|
45
|
+
- **Environment Variable Agent Configuration**: Added `HANI_AGENT_TYPES` environment variable support
|
|
46
|
+
- Accepts comma-separated list of negotiator type strings
|
|
47
|
+
- Automatically resolves class names using `get_class()` with namespace support
|
|
48
|
+
- Supports NegMAS, HANI helpers, Genius, and LLM negotiator namespaces
|
|
49
|
+
- **Agent Types Documentation**: Added `AGENT_TYPES_USAGE.md` with comprehensive usage examples
|
|
50
|
+
- New `agent_types` field in `AppConfig` class for programmatic configuration
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
- **Action Panel UI Redesign**: Improved action panel layout and user experience
|
|
54
|
+
- Partner offers now displayed at the top with color-coded utility indicators
|
|
55
|
+
- Green: Rational offers (above reservation value)
|
|
56
|
+
- Red: Irrational offers (below reservation value)
|
|
57
|
+
- Added text message display for partner offers when available
|
|
58
|
+
- Reorganized button layout: Accept and End buttons positioned with offer display
|
|
59
|
+
- Send button separated into its own row
|
|
60
|
+
- Adjusted grid layout for better space utilization
|
|
61
|
+
- **Dependencies Updated**:
|
|
62
|
+
- `negmas` updated from `>=0.10.23` to `>=0.15.0`
|
|
63
|
+
- `negmas-llm` updated from `>=0.2.2` to `>=0.4.0`
|
|
64
|
+
- Partner selection logic now prioritizes command-line agents when configured
|
|
65
|
+
- Default partner checkbox values now respond to agent configuration source
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
- Modal dialogs for LLM prompt editors now correctly positioned in sidebar
|
|
69
|
+
- Theme inheritance issues resolved for modal components
|
|
70
|
+
- Width constraints fixed for modal dialogs
|
|
71
|
+
|
|
72
|
+
## [0.1.0] - 2025-01-XX
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
- **Event Tracking System**: Comprehensive event logging for user interactions and negotiations
|
|
76
|
+
- Database-backed event storage with SQLAlchemy
|
|
77
|
+
- Track negotiation events (offers, acceptances, rejections, timeouts)
|
|
78
|
+
- Track scenario events (loading, generation, selection)
|
|
79
|
+
- Track page views and user sessions
|
|
80
|
+
- Track button clicks and UI interactions
|
|
81
|
+
- Integration guide for accessing event data
|
|
82
|
+
- **Experiment Management**: Multi-experiment support with user assignment
|
|
83
|
+
- Experiment selector UI for admins
|
|
84
|
+
- Automatic experiment assignment for users
|
|
85
|
+
- Database schema for experiments and user assignments
|
|
86
|
+
- **LLM Negotiator Support**: Integration with LLM-based negotiation agents
|
|
87
|
+
- Support for multiple LLM providers (Ollama, OpenAI, Anthropic)
|
|
88
|
+
- Configurable LLM settings via UI and settings file
|
|
89
|
+
- LLM prompt editor modals with template tags reference
|
|
90
|
+
- Three LLM prompt types: extraction, generation, and instruction
|
|
91
|
+
- Outcome extraction from natural language messages
|
|
92
|
+
- Text generation for counter-offers with strategic reasoning
|
|
93
|
+
- Instruction-based response generation
|
|
94
|
+
- **Dual Authentication System**: Support for both OAuth and password-based authentication
|
|
95
|
+
- OAuth support (GitHub, Google, Azure)
|
|
96
|
+
- Password-based authentication with bcrypt hashing
|
|
97
|
+
- Automatic password hash migration from plain text
|
|
98
|
+
- Admin user management via environment variables
|
|
99
|
+
- Multi-environment configuration (local, production)
|
|
100
|
+
- **Registration System**: User registration and management
|
|
101
|
+
- Separate registration server (`hani-reg`)
|
|
102
|
+
- Admin dashboard for user management
|
|
103
|
+
- Password reset functionality
|
|
104
|
+
- User information tracking
|
|
105
|
+
- **Guest Mode**: Playground/guest mode for unauthenticated users (`hani-guest`)
|
|
106
|
+
- **Comprehensive Test Suite**:
|
|
107
|
+
- Playwright-based end-to-end tests
|
|
108
|
+
- Scenario generation and loading tests
|
|
109
|
+
- Tool initialization and interaction tests
|
|
110
|
+
- Authentication flow tests
|
|
111
|
+
- **Analysis Tools**: Data analysis and reporting utilities (`hani-analysis`)
|
|
112
|
+
- **Experiment Runner**: Batch experiment execution (`hani-experiment`)
|
|
113
|
+
|
|
114
|
+
### Changed
|
|
115
|
+
- **UI Improvements**:
|
|
116
|
+
- Compact UI with reduced font sizes and spacing
|
|
117
|
+
- White background with transparent plot backgrounds
|
|
118
|
+
- ChatFeed-based history display with auto-scroll
|
|
119
|
+
- Improved utility display formatting
|
|
120
|
+
- Better tool organization in sidebar (LLM tools prioritized)
|
|
121
|
+
- Removed double borders and cleaned up styling
|
|
122
|
+
- **History Display**:
|
|
123
|
+
- Replaced custom history pane with Panel's ChatFeed component
|
|
124
|
+
- Automatic scrolling to latest messages
|
|
125
|
+
- Improved message formatting and styling
|
|
126
|
+
- Better handling of negotiation outcomes
|
|
127
|
+
- **Timer Implementation**:
|
|
128
|
+
- Switched from threading.Timer to Panel's periodic callbacks
|
|
129
|
+
- More reliable timer behavior
|
|
130
|
+
- Better integration with Panel's async event loop
|
|
131
|
+
- **Tool System**:
|
|
132
|
+
- Reorganized sidebar tools (LLM first, then Inverter, Random)
|
|
133
|
+
- Fixed parameter handling to prevent widget overwriting
|
|
134
|
+
- Removed opacity feature to fix Plotly resize errors
|
|
135
|
+
- Improved plot tool robustness
|
|
136
|
+
|
|
137
|
+
### Fixed
|
|
138
|
+
- Password comparison bug in registration app login
|
|
139
|
+
- Redundant `pn.bind()` calls after `on_click()` events
|
|
140
|
+
- Column/Row spacing parameter errors in Panel components
|
|
141
|
+
- Plotly resize errors related to plot opacity
|
|
142
|
+
- History pane auto-scroll behavior
|
|
143
|
+
- Logout callback functionality
|
|
144
|
+
- Threading timer issues with Panel's async architecture
|
|
145
|
+
- Authentication patching initialization
|
|
146
|
+
- Panel extension loading order
|
|
147
|
+
- Scenario loading from file system
|
|
148
|
+
- Tool parameter attributes being overwritten by widgets
|
|
149
|
+
|
|
150
|
+
### Security
|
|
151
|
+
- Implemented bcrypt password hashing
|
|
152
|
+
- Secure session management with cookies
|
|
153
|
+
- OAuth encryption key support
|
|
154
|
+
- CSRF protection for authentication flows
|
|
155
|
+
|
|
156
|
+
### Infrastructure
|
|
157
|
+
- SQLite database for event tracking and user management
|
|
158
|
+
- Alembic migrations for database schema updates
|
|
159
|
+
- Multi-process architecture (app, registration, playground)
|
|
160
|
+
- Environment-based configuration management
|
|
161
|
+
- Settings directory structure (`~/negmas/hani/settings/`)
|
|
162
|
+
|
|
163
|
+
### Documentation
|
|
164
|
+
- Added integration guide for event tracking
|
|
165
|
+
- Updated README with authentication setup instructions
|
|
166
|
+
- Added developer documentation for testing
|
|
167
|
+
- Created database schema documentation
|
|
168
|
+
|
|
169
|
+
## [0.0.1] - 2024-XX-XX (Initial Development)
|
|
170
|
+
|
|
171
|
+
### Added
|
|
172
|
+
- Initial HANI framework
|
|
173
|
+
- Basic negotiation interface with Panel web UI
|
|
174
|
+
- Scenario management (Trade, Colored Chips)
|
|
175
|
+
- Human negotiator interface
|
|
176
|
+
- Integration with NegMAS negotiation framework
|
|
177
|
+
- Support for HANI custom negotiators (AgentK, Atlas3, CUHKAgent, HardHeaded, etc.)
|
|
178
|
+
- Support for Genius negotiators via bridge
|
|
179
|
+
- Basic utility visualization tools
|
|
180
|
+
- Offer history tracking
|
|
181
|
+
- Negotiation timer and step management
|
|
182
|
+
- Multi-user support with basic authentication
|
|
183
|
+
- Scenario generation and loading
|
|
184
|
+
- Configurable negotiation parameters (time limits, steps, etc.)
|
|
185
|
+
- Admin mode with additional controls
|
|
186
|
+
- Consent form system
|
|
187
|
+
- Settings persistence
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Version History Summary
|
|
192
|
+
|
|
193
|
+
- **0.2.0** (Current): Command-line agent configuration, improved action panel UI, dependency updates
|
|
194
|
+
- **0.1.0**: Event tracking, LLM support, dual authentication, experiment management, comprehensive testing
|
|
195
|
+
- **0.0.1**: Initial HANI framework with basic negotiation interface
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Upgrade Notes
|
|
200
|
+
|
|
201
|
+
### Upgrading to 0.2.0
|
|
202
|
+
- No breaking changes
|
|
203
|
+
- New optional `--agents` command-line argument for configuring negotiator types
|
|
204
|
+
- New optional `HANI_AGENT_TYPES` environment variable
|
|
205
|
+
- Updated dependencies may require `pip install --upgrade negmas negmas-llm`
|
|
206
|
+
|
|
207
|
+
### Upgrading to 0.1.0
|
|
208
|
+
- Database migration required for event tracking (automatic on first run)
|
|
209
|
+
- Authentication configuration required (see environment variables in README)
|
|
210
|
+
- Existing plain-text passwords will be automatically migrated to bcrypt hashes
|
|
211
|
+
- LLM settings file created at `~/negmas/hani/settings/llm_settings.json`
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Links
|
|
216
|
+
- [Repository](https://github.com/autoneg/hani)
|
|
217
|
+
- [Documentation](https://github.com/autoneg/hani/blob/main/README.md)
|
|
218
|
+
- [Issue Tracker](https://github.com/autoneg/hani/issues)
|
hani-0.2.2/MANIFEST.in
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
include README.md
|
|
2
|
+
include CHANGELOG.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
recursive-include src/hani/images *.JPG *.jpg *.png
|
|
5
|
+
recursive-include src/hani/templates *.html
|
|
6
|
+
recursive-include src/hani/sample_scenarios *.yml *.yaml
|
|
7
|
+
recursive-include src/hani/config *.yaml *.yml
|
|
8
|
+
recursive-include src/hani/static *.css *.js
|
|
9
|
+
include src/hani/announcements.md
|
|
10
|
+
|
|
11
|
+
# Exclude temporary and local files
|
|
12
|
+
global-exclude *.local
|
|
13
|
+
global-exclude .env.local
|
|
14
|
+
global-exclude .envrc.local
|
|
15
|
+
global-exclude *.pyc
|
|
16
|
+
global-exclude __pycache__
|
|
17
|
+
global-exclude .DS_Store
|
|
18
|
+
global-exclude *.backup
|
|
19
|
+
global-exclude *_old.*
|
|
20
|
+
global-exclude *.working_backup
|
hani-0.2.2/PKG-INFO
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hani
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Run Human-Agent Negotiations
|
|
5
|
+
Author-email: Yasser Mohammad <yasserfarouk@gmail.com>
|
|
6
|
+
License: GNU Affero General Public License v3 (AGPL-3.0)
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
11
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
12
|
+
Requires-Python: >=3.13
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: cryptography>=44.0.2
|
|
15
|
+
Requires-Dist: hvplot>=0.11.2
|
|
16
|
+
Requires-Dist: negmas>=0.15.2
|
|
17
|
+
Requires-Dist: negmas-llm>=0.4.2
|
|
18
|
+
Requires-Dist: panel>=1.6.1
|
|
19
|
+
Requires-Dist: plotly>=6.0.0
|
|
20
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
21
|
+
Requires-Dist: rich>=13.0.0
|
|
22
|
+
Requires-Dist: sqlalchemy>=2.0.39
|
|
23
|
+
Requires-Dist: typer>=0.9.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: bumpversion>=0.6.0; extra == "dev"
|
|
26
|
+
Requires-Dist: watchfiles>=1.0.4; extra == "dev"
|
|
27
|
+
Provides-Extra: doc
|
|
28
|
+
Requires-Dist: mkdocs-gen-files>=0.5.0; extra == "doc"
|
|
29
|
+
Requires-Dist: mkdocs-include-markdown-plugin>=7.1.4; extra == "doc"
|
|
30
|
+
Requires-Dist: mkdocs-material>=9.6.5; extra == "doc"
|
|
31
|
+
Requires-Dist: mkdocs>=1.6.1; extra == "doc"
|
|
32
|
+
Requires-Dist: mkdocstrings-python>=1.16.1; extra == "doc"
|
|
33
|
+
Provides-Extra: docs
|
|
34
|
+
Requires-Dist: mkdocs-jupyter>=0.25.1; extra == "docs"
|
|
35
|
+
|
|
36
|
+
# Human-Agent Negotiation Interface (HANI)
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
HANI is a web-based interface for conducting negotiations between humans and AI agents. It provides a rich set of tools for analyzing negotiation dynamics, making offers, and understanding your negotiation partner's behavior.
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
### Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install hani
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Configuration
|
|
51
|
+
|
|
52
|
+
1. Copy the example environment file:
|
|
53
|
+
```bash
|
|
54
|
+
cp .env.example .env
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
2. Edit `.env` to set your admin password:
|
|
58
|
+
```
|
|
59
|
+
ADMIN_PASS=your-secure-password
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
3. (Optional) Add your OpenAI API key for LLM features:
|
|
63
|
+
```
|
|
64
|
+
OPENAI_API_KEY=sk-your-api-key
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Running the App
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
hani
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Then open your browser to `http://localhost:5006` and log in:
|
|
74
|
+
- **Username:** `admin`
|
|
75
|
+
- **Password:** The value you set in `ADMIN_PASS` (default: `admin`)
|
|
76
|
+
|
|
77
|
+
## Features
|
|
78
|
+
|
|
79
|
+
### Negotiation Interface
|
|
80
|
+
|
|
81
|
+
- **Action Panel**: Make offers by setting values for each negotiation issue
|
|
82
|
+
- **History View**: See the full negotiation history with offers from both parties
|
|
83
|
+
- **Utility Display**: Real-time feedback on how good each offer is for you
|
|
84
|
+
|
|
85
|
+
### AI-Powered Tools
|
|
86
|
+
|
|
87
|
+
When configured with an LLM API key, HANI provides:
|
|
88
|
+
|
|
89
|
+
- **Text-to-Outcome Extraction**: Extract structured offers from natural language messages
|
|
90
|
+
- **Outcome-to-Text Generation**: Generate natural language descriptions of your offers
|
|
91
|
+
- **Response Generator**: Describe what you want to say and let AI generate both the message and offer
|
|
92
|
+
|
|
93
|
+
### Analysis Tools
|
|
94
|
+
|
|
95
|
+
- **Utility Plot**: Visualize utility over time
|
|
96
|
+
- **Outcome Plot**: See where offers fall in the outcome space
|
|
97
|
+
- **Preferences View**: Understand your preferences for the negotiation
|
|
98
|
+
- **Negotiation Trace**: Detailed log of all negotiation events
|
|
99
|
+
|
|
100
|
+
## Authentication
|
|
101
|
+
|
|
102
|
+
HANI supports two authentication modes:
|
|
103
|
+
|
|
104
|
+
### Password Authentication (Default)
|
|
105
|
+
|
|
106
|
+
Best for local development and small deployments.
|
|
107
|
+
|
|
108
|
+
```env
|
|
109
|
+
HANI_AUTH_MODE=password
|
|
110
|
+
ADMIN_PASS=your-secure-password
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- Users are stored in `~/negmas/hani/settings/users_hashed.json`
|
|
114
|
+
- New users can register via the registration app (`hani-reg`)
|
|
115
|
+
- The `admin` user is automatically created with the `ADMIN_PASS` password
|
|
116
|
+
|
|
117
|
+
### OAuth Authentication
|
|
118
|
+
|
|
119
|
+
Best for production deployments with external identity providers.
|
|
120
|
+
|
|
121
|
+
```env
|
|
122
|
+
HANI_AUTH_MODE=oauth
|
|
123
|
+
HANI_OAUTH_PROVIDER=github
|
|
124
|
+
HANI_OAUTH_KEY=your-client-id
|
|
125
|
+
HANI_OAUTH_SECRET=your-client-secret
|
|
126
|
+
HANI_OAUTH_REDIRECT_URI=https://your-domain.com
|
|
127
|
+
HANI_OAUTH_ENCRYPTION_KEY=<generate-with-secrets>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Supported providers: `github`, `google`, `azure`, `okta`, and others supported by Panel.
|
|
131
|
+
|
|
132
|
+
#### OAuth Admin Access
|
|
133
|
+
|
|
134
|
+
In OAuth mode, admin access is granted to users whose email is in the `ADMIN_EMAILS` list:
|
|
135
|
+
|
|
136
|
+
```env
|
|
137
|
+
ADMIN_EMAILS=admin@example.com,another-admin@example.com
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Auto Mode
|
|
141
|
+
|
|
142
|
+
When `HANI_AUTH_MODE=auto` (the default):
|
|
143
|
+
- Uses OAuth if OAuth credentials are configured
|
|
144
|
+
- Falls back to password authentication otherwise
|
|
145
|
+
|
|
146
|
+
## Environment Variables
|
|
147
|
+
|
|
148
|
+
| Variable | Description | Default |
|
|
149
|
+
|----------|-------------|---------|
|
|
150
|
+
| `ADMIN_PASS` | Password for the admin user | `admin` |
|
|
151
|
+
| `ADMIN_EMAILS` | Comma-separated admin emails (OAuth mode) | `` |
|
|
152
|
+
| `HANI_AUTH_MODE` | Authentication mode: `auto`, `password`, `oauth` | `auto` |
|
|
153
|
+
| `HANI_OAUTH_PROVIDER` | OAuth provider name | `github` |
|
|
154
|
+
| `HANI_OAUTH_KEY` | OAuth client ID | `` |
|
|
155
|
+
| `HANI_OAUTH_SECRET` | OAuth client secret | `` |
|
|
156
|
+
| `HANI_OAUTH_REDIRECT_URI` | OAuth redirect URI | `http://localhost:5006` |
|
|
157
|
+
| `HANI_OAUTH_ENCRYPTION_KEY` | OAuth encryption key | `` |
|
|
158
|
+
| `HANI_COOKIE_SECRET` | Session cookie secret | (default value) |
|
|
159
|
+
| `HANI_ENV` | Environment: `local` or `production` | `local` |
|
|
160
|
+
| `HANI_AGENT_TYPES` | Comma-separated list of negotiator types | `` |
|
|
161
|
+
| `OPENAI_API_KEY` | OpenAI API key for LLM features | `` |
|
|
162
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key (alternative to OpenAI) | `` |
|
|
163
|
+
|
|
164
|
+
## Configuring Agent/Negotiator Types
|
|
165
|
+
|
|
166
|
+
HANI allows you to specify which negotiator types the AI opponent can use. This can be configured via command-line arguments or environment variables.
|
|
167
|
+
|
|
168
|
+
### Method 1: Command-Line Argument (Recommended)
|
|
169
|
+
|
|
170
|
+
Use the `--agents` flag to specify a comma-separated list of negotiator types:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Use specific NegMAS negotiators
|
|
174
|
+
hani --agents "AspirationNegotiator,BoulwareTBNegotiator,ConcederTBNegotiator"
|
|
175
|
+
|
|
176
|
+
# Mix of different negotiator types
|
|
177
|
+
hani --agents "AspirationNegotiator,helpers.AgentK,helpers.Atlas3,LLMHybridNegotiator"
|
|
178
|
+
|
|
179
|
+
# Use only HANI custom negotiators
|
|
180
|
+
hani --agents "helpers.AgentK,helpers.HardHeaded,helpers.AverageTitForTat"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Note:** Command-line arguments take precedence over environment variables.
|
|
184
|
+
|
|
185
|
+
### Method 2: Environment Variable
|
|
186
|
+
|
|
187
|
+
Set the `HANI_AGENT_TYPES` environment variable:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Example: Use specific NegMAS negotiators
|
|
191
|
+
export HANI_AGENT_TYPES="AspirationNegotiator,BoulwareTBNegotiator,ConcederTBNegotiator"
|
|
192
|
+
|
|
193
|
+
# Then start HANI
|
|
194
|
+
hani
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Supported Negotiator Namespaces
|
|
198
|
+
|
|
199
|
+
HANI automatically resolves negotiator class names from different namespaces:
|
|
200
|
+
|
|
201
|
+
#### NegMAS Negotiators (default namespace)
|
|
202
|
+
```bash
|
|
203
|
+
# No prefix needed - automatically resolved to negmas.sao.*
|
|
204
|
+
hani --agents "AspirationNegotiator,BoulwareTBNegotiator,NaiveTitForTatNegotiator"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### HANI Helper Negotiators
|
|
208
|
+
```bash
|
|
209
|
+
# Use "helpers." prefix - resolved to hani.helpers.negotiators.*
|
|
210
|
+
hani --agents "helpers.AgentK,helpers.Atlas3,helpers.CUHKAgent,helpers.HardHeaded"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### Genius Negotiators
|
|
214
|
+
```bash
|
|
215
|
+
# Use "genius." prefix - resolved to negmas.genius.gnegotiators.*
|
|
216
|
+
hani --agents "genius.Atlas3,genius.AgentK,genius.HardHeaded"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
#### LLM-based Negotiators
|
|
220
|
+
```bash
|
|
221
|
+
# Special handling for LLM negotiators
|
|
222
|
+
hani --agents "LLMHybridNegotiator,LLMBoulwareTBNegotiator,LLMConcederTBNegotiator"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### Custom Negotiators from Files
|
|
226
|
+
```bash
|
|
227
|
+
# Use "file:" prefix to load a class from a Python file
|
|
228
|
+
# Format: file:path/to/filename.ClassName
|
|
229
|
+
|
|
230
|
+
# Simple file in current directory
|
|
231
|
+
hani --agents "file:mynegotiator.MyNegotiator"
|
|
232
|
+
|
|
233
|
+
# Relative path with subdirectories (use / - works on all platforms including Windows!)
|
|
234
|
+
hani --agents "file:agents/custom/myneg.MyNegotiator"
|
|
235
|
+
|
|
236
|
+
# Absolute path (Unix/Mac)
|
|
237
|
+
hani --agents "file:/home/user/agents/myneg.MyNegotiator"
|
|
238
|
+
|
|
239
|
+
# Absolute path (Windows - both / and \ work)
|
|
240
|
+
hani --agents "file:C:/Users/user/agents/myneg.MyNegotiator"
|
|
241
|
+
hani --agents "file:C:\Users\user\agents\myneg.MyNegotiator"
|
|
242
|
+
|
|
243
|
+
# Mix with other negotiator types
|
|
244
|
+
hani --agents "AspirationNegotiator,file:agents/custom/myneg.MyNegotiator,helpers.AgentK"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Example custom negotiator file (`mynegotiator.py` or `agents/custom/myneg.py`):**
|
|
248
|
+
```python
|
|
249
|
+
from negmas.sao import SAONegotiator
|
|
250
|
+
|
|
251
|
+
class MyNegotiator(SAONegotiator):
|
|
252
|
+
def propose(self, state):
|
|
253
|
+
# Your custom negotiation logic here
|
|
254
|
+
return self.nmi.random_outcome()
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Notes:**
|
|
258
|
+
- Use forward slashes (`/`) for paths - they work cross-platform (recommended)
|
|
259
|
+
- On Windows, backslashes (`\`) also work but may need escaping in some shells
|
|
260
|
+
- Paths can be relative (to current working directory) or absolute
|
|
261
|
+
|
|
262
|
+
### UI Behavior
|
|
263
|
+
|
|
264
|
+
When agent types are configured via `--agents` or `HANI_AGENT_TYPES`:
|
|
265
|
+
|
|
266
|
+
- ✅ **"Command Line/Env"** checkbox: **Enabled and checked** by default
|
|
267
|
+
- ❌ **"Allow LLM Negotiators"** checkbox: **Unchecked** by default
|
|
268
|
+
- ❌ **"Allow NegMAS Negotiators"** checkbox: **Unchecked** by default
|
|
269
|
+
- ❌ **"Allow HANI Negotiators"** checkbox: **Unchecked** by default
|
|
270
|
+
- ❌ **"Allow Genius Negotiators"** checkbox: **Unchecked** by default
|
|
271
|
+
|
|
272
|
+
This ensures that **by default**, the opponent will **ALWAYS be one of the configured negotiators**.
|
|
273
|
+
|
|
274
|
+
Users can uncheck "Command Line/Env" and check other categories to mix configured agents with other agent types.
|
|
275
|
+
|
|
276
|
+
### Examples
|
|
277
|
+
|
|
278
|
+
**Only use time-based negotiators:**
|
|
279
|
+
```bash
|
|
280
|
+
hani --agents "BoulwareTBNegotiator,ConcederTBNegotiator,LinearTBNegotiator"
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Mix of custom and standard negotiators:**
|
|
284
|
+
```bash
|
|
285
|
+
hani --agents "AspirationNegotiator,helpers.AgentK,helpers.Atlas3"
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Use LLM negotiators only:**
|
|
289
|
+
```bash
|
|
290
|
+
hani --agents "LLMHybridNegotiator,LLMBoulwareTBNegotiator"
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Application Commands
|
|
294
|
+
|
|
295
|
+
| Command | Description |
|
|
296
|
+
|---------|-------------|
|
|
297
|
+
| `hani` | Start the main negotiation interface |
|
|
298
|
+
| `hani-reg` | Start the user registration app |
|
|
299
|
+
| `hani-analysis` | Start the analytics dashboard |
|
|
300
|
+
| `hani-experiment` | Run experiments |
|
|
301
|
+
|
|
302
|
+
## How It Works
|
|
303
|
+
|
|
304
|
+
1. **Scenario Loading**: A negotiation scenario is loaded with defined issues (e.g., price, quantity) and preferences for each party.
|
|
305
|
+
|
|
306
|
+
2. **Turn-Based Negotiation**: You and the AI agent take turns making offers. Each offer specifies values for all issues.
|
|
307
|
+
|
|
308
|
+
3. **Decision Making**: On each turn, you can:
|
|
309
|
+
- **Send an offer**: Propose specific values for each issue
|
|
310
|
+
- **Accept**: Accept the current offer from your partner
|
|
311
|
+
- **End Negotiation**: Terminate without agreement
|
|
312
|
+
|
|
313
|
+
4. **Text Messages**: Optionally include natural language messages with your offers to communicate intent.
|
|
314
|
+
|
|
315
|
+
5. **Analysis**: Use the built-in tools to understand the negotiation dynamics and make informed decisions.
|
|
316
|
+
|
|
317
|
+
## LLM Configuration (Admin)
|
|
318
|
+
|
|
319
|
+
Administrators can configure LLM settings in the sidebar under "LLM Settings":
|
|
320
|
+
|
|
321
|
+
- **Provider**: OpenAI or Anthropic
|
|
322
|
+
- **Model**: The model to use (e.g., `gpt-4o-mini`, `claude-3-haiku`)
|
|
323
|
+
- **Temperature**: Controls response randomness (0.0-2.0)
|
|
324
|
+
- **Prompts**: Customize extraction and generation prompts
|
|
325
|
+
|
|
326
|
+
## Development
|
|
327
|
+
|
|
328
|
+
### Contributing
|
|
329
|
+
|
|
330
|
+
To contribute, clone this repo and install development dependencies:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
git clone https://github.com/yasserfarouk/hani.git
|
|
334
|
+
cd hani
|
|
335
|
+
pip install -e ".[dev]"
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Running in Development Mode
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
hani dev
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
This enables auto-reload when files change.
|
|
345
|
+
|
|
346
|
+
### Project Structure
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
src/hani/
|
|
350
|
+
├── app.py # Main application
|
|
351
|
+
├── auth.py # Authentication utilities
|
|
352
|
+
├── common.py # Shared configuration
|
|
353
|
+
├── llm_service.py # LLM integration
|
|
354
|
+
├── register.py # Registration app
|
|
355
|
+
├── run*.py # Entry points
|
|
356
|
+
├── tools/ # Analysis tools
|
|
357
|
+
│ ├── generator.py # Response generator tool
|
|
358
|
+
│ ├── preferences.py # Preferences viewer
|
|
359
|
+
│ ├── utility_plot2d.py
|
|
360
|
+
│ └── ...
|
|
361
|
+
└── scenarios/ # Negotiation scenarios
|
|
362
|
+
├── trade.py
|
|
363
|
+
├── island.py
|
|
364
|
+
└── grocery.py
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## License
|
|
368
|
+
|
|
369
|
+
GNU Affero General Public License v3 (AGPL-3.0)
|
|
370
|
+
|
|
371
|
+
## Author
|
|
372
|
+
|
|
373
|
+
Yasser Mohammad (yasserfarouk@gmail.com)
|