bannaha 0.1.0__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.
Files changed (83) hide show
  1. bannaha-0.1.0/.env.example +19 -0
  2. bannaha-0.1.0/.github/workflows/publish.yml +36 -0
  3. bannaha-0.1.0/.github/workflows/test.yml +50 -0
  4. bannaha-0.1.0/.gitignore +15 -0
  5. bannaha-0.1.0/.python-version +1 -0
  6. bannaha-0.1.0/LICENSE +21 -0
  7. bannaha-0.1.0/PKG-INFO +351 -0
  8. bannaha-0.1.0/README.md +293 -0
  9. bannaha-0.1.0/pyproject.toml +70 -0
  10. bannaha-0.1.0/src/bannaha/__init__.py +3 -0
  11. bannaha-0.1.0/src/bannaha/backends.py +46 -0
  12. bannaha-0.1.0/src/bannaha/cli/__init__.py +0 -0
  13. bannaha-0.1.0/src/bannaha/cli/app.py +328 -0
  14. bannaha-0.1.0/src/bannaha/cli/config.py +113 -0
  15. bannaha-0.1.0/src/bannaha/cli/live.py +421 -0
  16. bannaha-0.1.0/src/bannaha/cli/runner.py +136 -0
  17. bannaha-0.1.0/src/bannaha/cli/themes.py +34 -0
  18. bannaha-0.1.0/src/bannaha/cli/transcript.py +471 -0
  19. bannaha-0.1.0/src/bannaha/consensus/__init__.py +1 -0
  20. bannaha-0.1.0/src/bannaha/consensus/ballots.py +16 -0
  21. bannaha-0.1.0/src/bannaha/consensus/clustering.py +138 -0
  22. bannaha-0.1.0/src/bannaha/consensus/quorum.py +19 -0
  23. bannaha-0.1.0/src/bannaha/core/__init__.py +0 -0
  24. bannaha-0.1.0/src/bannaha/core/board.py +266 -0
  25. bannaha-0.1.0/src/bannaha/core/errors.py +22 -0
  26. bannaha-0.1.0/src/bannaha/core/events.py +65 -0
  27. bannaha-0.1.0/src/bannaha/core/fleet.py +96 -0
  28. bannaha-0.1.0/src/bannaha/core/limits.py +18 -0
  29. bannaha-0.1.0/src/bannaha/core/outcome.py +20 -0
  30. bannaha-0.1.0/src/bannaha/core/pricing.py +176 -0
  31. bannaha-0.1.0/src/bannaha/core/registry.py +69 -0
  32. bannaha-0.1.0/src/bannaha/core/runlog.py +55 -0
  33. bannaha-0.1.0/src/bannaha/core/session.py +399 -0
  34. bannaha-0.1.0/src/bannaha/core/text.py +80 -0
  35. bannaha-0.1.0/src/bannaha/core/tools.py +57 -0
  36. bannaha-0.1.0/src/bannaha/features/__init__.py +0 -0
  37. bannaha-0.1.0/src/bannaha/features/base.py +33 -0
  38. bannaha-0.1.0/src/bannaha/features/dropout.py +54 -0
  39. bannaha-0.1.0/src/bannaha/features/peer_updates.py +38 -0
  40. bannaha-0.1.0/src/bannaha/followup.py +328 -0
  41. bannaha-0.1.0/src/bannaha/harnesses/__init__.py +0 -0
  42. bannaha-0.1.0/src/bannaha/harnesses/adk.py +122 -0
  43. bannaha-0.1.0/src/bannaha/harnesses/anthropic_sdk.py +76 -0
  44. bannaha-0.1.0/src/bannaha/harnesses/banna.py +142 -0
  45. bannaha-0.1.0/src/bannaha/harnesses/base.py +99 -0
  46. bannaha-0.1.0/src/bannaha/harnesses/hermes.py +156 -0
  47. bannaha-0.1.0/src/bannaha/harnesses/mock.py +100 -0
  48. bannaha-0.1.0/src/bannaha/harnesses/openai_agents.py +140 -0
  49. bannaha-0.1.0/src/bannaha/strategies/__init__.py +0 -0
  50. bannaha-0.1.0/src/bannaha/strategies/base.py +75 -0
  51. bannaha-0.1.0/src/bannaha/strategies/blackboard.py +199 -0
  52. bannaha-0.1.0/src/bannaha/strategies/single.py +46 -0
  53. bannaha-0.1.0/src/bannaha/strategies/vote.py +46 -0
  54. bannaha-0.1.0/src/bannaha/tools/__init__.py +0 -0
  55. bannaha-0.1.0/src/bannaha/tools/comms.py +229 -0
  56. bannaha-0.1.0/src/bannaha/tools/documents.py +140 -0
  57. bannaha-0.1.0/src/bannaha/tools/research.py +128 -0
  58. bannaha-0.1.0/src/bannaha/tools/sandbox.py +102 -0
  59. bannaha-0.1.0/src/bannaha/tools/toolbox.py +71 -0
  60. bannaha-0.1.0/src/bannaha/tools/web_search.py +83 -0
  61. bannaha-0.1.0/src/bannaha/tui/__init__.py +1 -0
  62. bannaha-0.1.0/src/bannaha/tui/app.py +81 -0
  63. bannaha-0.1.0/src/bannaha/tui/banner.py +238 -0
  64. bannaha-0.1.0/src/bannaha/tui/fleet.py +169 -0
  65. bannaha-0.1.0/src/bannaha/tui/keys.py +156 -0
  66. bannaha-0.1.0/src/bannaha/tui/run.py +418 -0
  67. bannaha-0.1.0/src/bannaha/tui/runs.py +166 -0
  68. bannaha-0.1.0/src/bannaha/tui/setup.py +323 -0
  69. bannaha-0.1.0/src/bannaha/tui/widgets.py +132 -0
  70. bannaha-0.1.0/tests/conftest.py +33 -0
  71. bannaha-0.1.0/tests/test_board.py +43 -0
  72. bannaha-0.1.0/tests/test_cli.py +44 -0
  73. bannaha-0.1.0/tests/test_config.py +28 -0
  74. bannaha-0.1.0/tests/test_consensus.py +36 -0
  75. bannaha-0.1.0/tests/test_fleet.py +29 -0
  76. bannaha-0.1.0/tests/test_followup.py +98 -0
  77. bannaha-0.1.0/tests/test_harness_conformance.py +378 -0
  78. bannaha-0.1.0/tests/test_pricing.py +47 -0
  79. bannaha-0.1.0/tests/test_strategies.py +141 -0
  80. bannaha-0.1.0/tests/test_tools.py +34 -0
  81. bannaha-0.1.0/tests/test_transcript.py +60 -0
  82. bannaha-0.1.0/tests/test_tui.py +206 -0
  83. bannaha-0.1.0/uv.lock +4427 -0
@@ -0,0 +1,19 @@
1
+ # Copy to ~/.config/bannaha/.env (or ./.env) and fill in only the keys you need.
2
+ # Empty values are ignored; variables already set in your shell always win.
3
+ # Never commit a filled-in copy.
4
+
5
+ # Model providers
6
+ ANTHROPIC_API_KEY=
7
+ OPENAI_API_KEY=
8
+ GEMINI_API_KEY=
9
+ OPENROUTER_API_KEY=
10
+
11
+ # AWS Bedrock (uses your normal AWS credentials chain)
12
+ AWS_PROFILE=
13
+ AWS_REGION=
14
+
15
+ # Optional overrides
16
+ # OPENAI_BASE_URL=
17
+ # OPENROUTER_BASE_URL=
18
+ # BANNAHA_RUNS_DIR=
19
+ # BANNAHA_SANDBOX=process
@@ -0,0 +1,36 @@
1
+ name: publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ name: Build wheel + publish to PyPI
11
+ runs-on: ubuntu-latest
12
+ environment:
13
+ name: pypi
14
+ url: https://pypi.org/p/bannaha
15
+ permissions:
16
+ id-token: write # OIDC for PyPI Trusted Publishing — no token needed
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.12"
24
+
25
+ - name: Check tag matches pyproject version
26
+ run: |
27
+ v=$(python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
28
+ [ "v$v" = "$GITHUB_REF_NAME" ] || { echo "tag $GITHUB_REF_NAME != pyproject v$v"; exit 1; }
29
+
30
+ - name: Build sdist + wheel
31
+ run: |
32
+ python -m pip install --upgrade pip build
33
+ python -m build
34
+
35
+ - name: Publish to PyPI
36
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,50 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python ${{ matrix.python-version }}
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+ cache: pip
23
+
24
+ - name: Install
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install -e . pytest
28
+
29
+ - name: Run tests
30
+ run: pytest -q --no-header
31
+
32
+ lint:
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+ - uses: actions/setup-python@v5
37
+ with: { python-version: "3.12", cache: pip }
38
+ - run: pip install ruff
39
+ - run: ruff check src tests
40
+
41
+ build:
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+ - uses: actions/setup-python@v5
46
+ with: { python-version: "3.12" }
47
+ - run: |
48
+ python -m pip install --upgrade pip build twine
49
+ python -m build
50
+ twine check dist/*
@@ -0,0 +1,15 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .env
10
+ .env.*
11
+ !.env.example
12
+ runs/
13
+ .tmp_*/
14
+ .DS_Store
15
+
@@ -0,0 +1 @@
1
+ 3.12
bannaha-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Siavash Monfared
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
bannaha-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,351 @@
1
+ Metadata-Version: 2.5
2
+ Name: bannaha
3
+ Version: 0.1.0
4
+ Summary: A terminal sandbox for comparing multi-agent coordination strategies across agent harnesses and model backends.
5
+ Project-URL: Homepage, https://github.com/siavashmonfared/bannaha
6
+ Project-URL: Repository, https://github.com/siavashmonfared/bannaha
7
+ Project-URL: Issues, https://github.com/siavashmonfared/bannaha/issues
8
+ Author-email: Siavash Monfared <monfared@alum.mit.edu>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: agents,anthropic,blackboard,consensus,coordination,gemini,llm,multi-agent,openai
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: google-genai>=1.0
25
+ Requires-Dist: httpx>=0.27
26
+ Requires-Dist: rich>=13.7
27
+ Requires-Dist: textual>=1.0
28
+ Requires-Dist: tomli-w>=1.0
29
+ Requires-Dist: typer>=0.12
30
+ Provides-Extra: adk
31
+ Requires-Dist: google-adk>=1.0; extra == 'adk'
32
+ Provides-Extra: all
33
+ Requires-Dist: anthropic>=0.40; extra == 'all'
34
+ Requires-Dist: anthropic[bedrock]>=0.40; extra == 'all'
35
+ Requires-Dist: banna>=0.5; extra == 'all'
36
+ Requires-Dist: boto3>=1.34; extra == 'all'
37
+ Requires-Dist: google-adk>=1.0; extra == 'all'
38
+ Requires-Dist: hermes-agent>=0.19; extra == 'all'
39
+ Requires-Dist: litellm>=1.50; extra == 'all'
40
+ Requires-Dist: mcp>=1.0; extra == 'all'
41
+ Requires-Dist: openai-agents>=0.2; extra == 'all'
42
+ Provides-Extra: anthropic
43
+ Requires-Dist: anthropic>=0.40; extra == 'anthropic'
44
+ Provides-Extra: banna
45
+ Requires-Dist: banna>=0.5; extra == 'banna'
46
+ Provides-Extra: bedrock
47
+ Requires-Dist: anthropic[bedrock]>=0.40; extra == 'bedrock'
48
+ Requires-Dist: boto3>=1.34; extra == 'bedrock'
49
+ Requires-Dist: litellm>=1.50; extra == 'bedrock'
50
+ Provides-Extra: hermes
51
+ Requires-Dist: hermes-agent>=0.19; extra == 'hermes'
52
+ Requires-Dist: mcp>=1.0; extra == 'hermes'
53
+ Provides-Extra: litellm
54
+ Requires-Dist: litellm>=1.50; extra == 'litellm'
55
+ Provides-Extra: openai
56
+ Requires-Dist: openai-agents>=0.2; extra == 'openai'
57
+ Description-Content-Type: text/markdown
58
+
59
+ # bannaha
60
+
61
+ A terminal sandbox for multi-agent coordination. Give a fleet of LLM agents a question, pick how they
62
+ coordinate, and watch it happen live: who searches what, which claims get posted, endorsed or challenged,
63
+ how the group reaches an answer, and what happens when part of the fleet goes dark.
64
+
65
+ - **Any harness, any backend.** Mix agents built on different agent loops (Anthropic SDK, OpenAI Agents
66
+ SDK, Google ADK, Hermes Agent, banna) reaching models through different routes (direct API, OpenRouter,
67
+ Amazon Bedrock) in one fleet.
68
+ - **Pluggable strategies.** A single-agent baseline, independent voting, and a shared blackboard where
69
+ peers cross-check evidence until they agree. Adding one is one file.
70
+ - **Follow-ups with memory.** When a run ends, keep asking about it; the answers come from an agent that
71
+ has the whole run as memory.
72
+ - **Same tools everywhere.** One tool spec, translated per harness: web search, page fetch, document
73
+ search, sandboxed Python, and a set of communication tools for the shared board.
74
+ - **Fault injection.** Drop a fraction of the fleet mid-run and compare how strategies cope.
75
+ - **Everything is an event.** The live view and the JSONL run log are subscribers to one event stream.
76
+
77
+ ## Install
78
+
79
+ ```bash
80
+ uv tool install "bannaha[all]" # or: pipx install "bannaha[all]"
81
+ ```
82
+
83
+ From a clone:
84
+
85
+ ```bash
86
+ git clone https://github.com/siavashmonfared/bannaha && cd bannaha
87
+ uv sync --all-extras
88
+ uv run bannaha --help
89
+ ```
90
+
91
+ Extras: `anthropic`, `openai` (OpenAI Agents SDK), `adk` (Google ADK), `hermes` (Hermes Agent), `banna`,
92
+ `litellm` (ADK and OpenAI-SDK access to OpenRouter/Bedrock models), `bedrock` (boto3 + LiteLLM), `all`.
93
+ Install only what you use; `hermes` in particular pulls in a large dependency tree.
94
+
95
+ ## Quickstart
96
+
97
+ No API keys needed for a first look; the `mock` harness is a scripted offline agent whose model field
98
+ is the answer it gives:
99
+
100
+ ```bash
101
+ bannaha run "What is the answer?" -s blackboard -f "mock@local:42*2,mock@local:41*2,mock@local:40" --no-web
102
+ ```
103
+
104
+ With real models (keys in the environment or a `.env` file, see [API keys](#api-keys)):
105
+
106
+ ```bash
107
+ bannaha run "Which element has the highest melting point, and what is it in kelvin?" \
108
+ -s blackboard -f "anthropic@direct:claude-haiku-4-5*3,openai@openrouter:google/gemini-2.5-flash*2"
109
+ ```
110
+
111
+ ## API keys
112
+
113
+ Put keys in `~/.config/bannaha/.env` (read from any directory, and never inside a project you might
114
+ commit), in a `.env` in the directory you run from, or in your shell environment. Variables already set
115
+ in the environment win; empty values are ignored. `.env.example` lists every variable.
116
+
117
+ ```bash
118
+ ANTHROPIC_API_KEY=... # anthropic@direct, banna@direct:anthropic/...
119
+ OPENAI_API_KEY=... # openai@direct, hermes@direct, banna@direct:openai/...
120
+ GEMINI_API_KEY=... # adk@direct, banna@direct:gemini/..., and web search
121
+ OPENROUTER_API_KEY=... # any harness @openrouter
122
+ AWS_REGION=us-east-1 # any harness @bedrock, plus AWS credentials: AWS_PROFILE,
123
+ AWS_PROFILE=default # or AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY, or `aws sso login`
124
+ ```
125
+
126
+ `bannaha list` reports whether the web search key was found, and every run checks the keys its fleet
127
+ needs before starting.
128
+
129
+ ## How a run is shown
130
+
131
+ Runs are shown as one continuous transcript, in time order, the way Claude Code and Codex show work:
132
+ a header when the speaking agent changes, one line per finished tool call with a short preview of its
133
+ result, answers, proposals and votes in full, round boundaries and decisions, and a
134
+ live status line at the bottom with what each agent is doing, the round, tokens and cost.
135
+
136
+ - `bannaha run` prints the transcript into the terminal, so it stays in your
137
+ scrollback. `--full` shows tool results in full; `--dashboard` gives the boxed dashboard instead;
138
+ `--plain` prints one line per event.
139
+ - In the full-screen app (Run page, and replays on the Runs page): `ctrl+o` expands or shortens tool
140
+ results, `ctrl+g` follows one agent at a time, `ctrl+t` switches between the transcript and the dashboard.
141
+
142
+ ## Follow-ups: ask about a finished run
143
+
144
+ When a run finishes, what you type next is a follow-up question about it, not a new task. It goes to one
145
+ agent, by default the strongest model in the fleet (the one with the highest per-token price), together
146
+ with the run's memory: the task, how the strategy decided, what every agent submitted, the key tool
147
+ results, and a `search_run` tool over the full trace. The agent can also use web search and Python to
148
+ check things. The conversation builds turn by turn and is saved with the run (`followups.jsonl`).
149
+
150
+ | command | what it does |
151
+ |---|---|
152
+ | plain text | after a run: a follow-up question about it; before any run: a new task |
153
+ | `/new <task>` | a fresh run that knows nothing of the current one |
154
+ | `/rerun <clarification>` | the same strategy and fleet again, told the previous answer and your clarification |
155
+ | `/to <agent>` | send follow-ups to another fleet agent (`a3`) or any model (`harness@backend:model`) |
156
+ | `/agents` | the fleet, and who answers follow-ups |
157
+ | `/forget` | clear the follow-up conversation (the run's memory stays) |
158
+ | `/help` | all commands and keys |
159
+
160
+ This works on the Run page of the app, after `bannaha run` in the terminal (an `›` prompt; `--no-followup`
161
+ skips it), and on any saved run (`a` on the Runs page, or `bannaha ask <run folder | last> ["question"]`).
162
+
163
+ ## The app
164
+
165
+ Run `bannaha` with no arguments to open the full-screen app. Number keys switch pages:
166
+
167
+ | page | what it does |
168
+ |---|---|
169
+ | **1 Setup** | the settings dashboard: ↑↓ move, ←/→ toggle a value in place, ↵ open a picker; `s` start, `d` save as default and start. Shows whether the setup is ready to run, and what is missing if not. **Limits** (↵) edits tool calls and model calls per turn, output tokens per reply, wall time, tokens per run, and cost caps per run and per agent |
170
+ | **2 Fleet** | the fleet as a table of agent groups with each group's key status; `a` add, `e`/↵ edit, `x` remove, `+`/`-` count |
171
+ | **3 Keys** | every API key variable: found or missing, where it was found, and which ones your current fleet needs; `e` opens `~/.config/bannaha/.env` in your editor, `r` reloads |
172
+ | **4 Run** | type a question in the `›` box and press Enter; agents (with live tokens and cost), board activity, rounds and the answer update live, and the **activity** panel shows, per agent, the tool call it is running and its last few steps (searches, pages, code, messages, errors). Esc cancels a run, ↑↓ recall earlier questions |
173
+ | **5 Runs** | every saved run; ↵ replays a run's rounds, board and answer |
174
+
175
+ The animated header (a torus and the crew member who builds on it) sits under the page bar; `ctrl+b`
176
+ hides or shows it on any page, and Setup → Banner saves the choice.
177
+
178
+ Settings saved with `d` go to `~/.config/bannaha/config.toml`. `bannaha run …` is the scriptable path
179
+ with no full-screen app; flags override the saved settings for that run.
180
+
181
+ ## Limits and cost
182
+
183
+ | limit | default | `bannaha run` flag |
184
+ |---|---|---|
185
+ | tool calls per agent turn | 16 | `--max-calls` |
186
+ | model calls per agent turn | 24 | – |
187
+ | output tokens per model reply | 16384 | – |
188
+ | wall time per run | 900 s | `--max-wall` |
189
+ | tokens per run | none | `--max-tokens` |
190
+ | cost per run (USD) | none | `--max-cost` |
191
+ | cost per agent (USD) | none | `--max-agent-cost` |
192
+
193
+ Defaults come from the Setup page (saved settings); flags override them for one run. Cost is metered
194
+ live at list prices (`bannaha prices`): each agent's model tokens plus its web searches (Gemini search
195
+ tokens and $0.035 per search). When the run reaches `--max-cost` it stops at the next tool call;
196
+ an agent that reaches `--max-agent-cost` ends its turn and does no more work while the others carry on.
197
+ The Anthropic, OpenAI Agents and ADK harnesses report tokens after every model call, so their limits
198
+ apply mid-turn; Hermes and banna report at the end of a turn, so their spend is checked between turns.
199
+ `result.json` records each agent's tokens, searches and cost, and the run total.
200
+
201
+ Prices come from OpenRouter's public model list, which also lists OpenAI, Anthropic and Google models,
202
+ so it serves as the list price for direct and Bedrock runs too; pin anything else in
203
+ `~/.config/bannaha/prices.toml` (`["model"]` with `input_per_mtok` and `output_per_mtok`). `bannaha
204
+ prices` shows what your fleet will be charged, and `bannaha prices --md prices.md` writes it as a table
205
+ with the pricing links. Caching, batch discounts and long-context surcharges are not modeled.
206
+
207
+ ## Fleets
208
+
209
+ A fleet is `harness@backend:model*count`, comma separated. Count defaults to 1.
210
+
211
+ | harness | backends | notes |
212
+ |---|---|---|
213
+ | `anthropic` | `direct`, `bedrock` | Anthropic SDK, Messages API tool-use loop |
214
+ | `openai` | `direct`, `openrouter`, `bedrock` | OpenAI Agents SDK; tracing disabled; Bedrock via LiteLLM |
215
+ | `adk` | `direct` (Gemini), `openrouter`, `bedrock` | Google ADK; non-Gemini models via LiteLLM |
216
+ | `hermes` | `openrouter`, `direct` (OpenAI), `local` | Nous Research Hermes Agent; `local` is any OpenAI-compatible server at `BANNAHA_HERMES_BASE_URL` |
217
+ | `banna` | `direct`, `openrouter`, `bedrock` | banna's ReAct policy; on `direct` the model is `vendor/model` (`anthropic/…`, `openai/…`, `gemini/…`) |
218
+ | `mock` | `local` | offline scripted agent for demos and tests |
219
+
220
+ | backend | needs |
221
+ |---|---|
222
+ | `direct` | the vendor's key: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or `GEMINI_API_KEY` |
223
+ | `openrouter` | `OPENROUTER_API_KEY` |
224
+ | `bedrock` | `AWS_REGION` and AWS credentials (profile, keys or SSO); model ids such as `us.anthropic.claude-haiku-4-5-20251001-v1:0` |
225
+
226
+ `bannaha list` shows what is installed. The fleet is checked before anything runs: unsupported
227
+ harness/backend pairs, missing packages, keys and AWS credentials are reported up front.
228
+
229
+ Every harness gets the same tools from the same spec, and a conformance test checks each adapter
230
+ (nested arguments arrive unchanged, the turn stops at the finishing tool, a dropped agent really stops).
231
+ Some notes on how the adapters work:
232
+
233
+ - **Hermes**: bannaha's tools are registered in-process in Hermes's tool registry and only the current
234
+ turn's tools are enabled, so Hermes's own terminal, browser and file tools are never offered. Hermes
235
+ keeps state in a private home (`BANNAHA_HERMES_HOME`, default `~/.cache/bannaha/hermes`) with memory,
236
+ context files and persona loading off; your own `~/.hermes` is not read or written.
237
+ - **banna**: banna's loop has its own final-answer step; if a model answers that way instead of calling
238
+ the turn's finishing tool, the answer is submitted through that tool.
239
+ - **ADK**: tools declare their full JSON Schema, and instructions are passed so ADK does not treat
240
+ braces in a prompt as template variables.
241
+
242
+ ## Strategies
243
+
244
+ | strategy | how it works | reference |
245
+ |---|---|---|
246
+ | `single` | one agent answers alone; the baseline | – |
247
+ | `vote` | agents answer independently and never see each other; the most common answer wins | self-consistency, Wang et al. 2022 |
248
+ | `blackboard` | peers research, post claims with evidence to a shared board, endorse or challenge each other, and propose answers; commit when one answer reaches quorum, otherwise revise; if no quorum by the last round, rank the candidates in a ballot | cluster → quorum → revise, Borda ballot |
249
+
250
+ **`blackboard` in detail.** Each round, every live agent reads the shared board, researches, posts the
251
+ facts it establishes as claims (value, short verbatim quote, source), endorses, challenges or
252
+ corroborates its peers' claims, and proposes an answer that cites its supporting claims. Proposals are
253
+ clustered (numbers within `tolerance`, text after normalization). If the top cluster has `quorum` of the
254
+ live agents (and at least `min_quorum`), the group commits. Otherwise everyone sees the candidates with
255
+ the evidence behind each and revises. After the last round with no quorum, agents rank the candidates in
256
+ a ballot (Borda count); `fallback=plurality` then commits the leader, `fallback=fail` reports a failure.
257
+ Proposals carry the board version the agent last read, and a proposal made on a stale board is sent
258
+ back once so the agent can catch up.
259
+
260
+ Options are set with `-o key=value`, for example `-o rounds=4 -o quorum=0.6 -o fallback=fail`.
261
+ `bannaha list strategies` shows every option and its default.
262
+
263
+ ## Tools
264
+
265
+ | pack | tools |
266
+ |---|---|
267
+ | research | `web_search` (Gemini with Google Search grounding), `fetch_page`, `search_documents`, `run_python` |
268
+ | board | `read_board`, `post_claim`, `endorse_claim`, `challenge_claim`, `corroborate`, `send_message`, `read_messages` |
269
+ | finishing | `final_answer` (single, vote), `propose_answer` and `cast_vote` (blackboard), `reply` (follow-ups) |
270
+
271
+ Each strategy decides which tools an agent gets. `--no-web` removes the web tools; `--no-python`
272
+ removes `run_python`. Web search needs `GEMINI_API_KEY` even when no agent uses a Gemini model.
273
+
274
+ `run_python` runs in a host subprocess by default (`--sandbox process`): it has a wall-time limit but
275
+ shares your filesystem, network and credentials. Use `--sandbox docker` for a throwaway container with
276
+ no network, a read-only root filesystem, dropped capabilities and resource caps.
277
+
278
+ Anything one agent writes and another reads (board entries, messages, peer updates) is sanitized,
279
+ length-capped and labelled as peer data, never as instructions.
280
+
281
+ ## Features
282
+
283
+ - **Peer updates** (`--peer-updates`, on by default for board strategies): every tool result carries the
284
+ peers' new board activity since the agent last looked, so agents stay aware of each other mid-turn.
285
+ - **Dropout** (`--drop 0.5 --drop-after 2 --seed 1`): silently remove agents mid-run. `--drop` below 1
286
+ is a fraction, otherwise a count; a chosen agent goes dark when it tries tool call number
287
+ `drop-after + 1`.
288
+
289
+ Example: how much does independent voting lose, compared with the blackboard, when half the fleet goes dark?
290
+
291
+ ```bash
292
+ Q="Which five rivers are the longest in the world, and how long is each in km?"
293
+ F="anthropic@direct:claude-haiku-4-5*7"
294
+ bannaha run "$Q" -s vote -f "$F" --drop 0.5 --seed 7
295
+ bannaha run "$Q" -s blackboard -f "$F" --drop 0.5 --seed 7
296
+ ```
297
+
298
+ ## Runs
299
+
300
+ Every run is saved to `~/.local/share/bannaha/runs/<timestamp>-<strategy>/` (override with
301
+ `--runs-dir` or `BANNAHA_RUNS_DIR`, disable with `--no-save`):
302
+
303
+ - `events.jsonl`: every event, one per line
304
+ - `result.json`: the question, fleet, options, outcome and per-agent stats
305
+ - `followups.jsonl`: the follow-up conversation, if any
306
+
307
+ `--plain` prints one line per event instead of the live view; `--json` prints the outcome as JSON.
308
+
309
+ ## Extending
310
+
311
+ **A strategy** is a module in `bannaha/strategies/` (or any package, via the `bannaha.strategies` entry
312
+ point):
313
+
314
+ ```python
315
+ from bannaha.core.outcome import Outcome
316
+ from bannaha.core.registry import register_strategy
317
+ from bannaha.core.session import TurnJob
318
+ from bannaha.strategies.base import Strategy
319
+ from bannaha.tools.toolbox import RESEARCH
320
+
321
+ @register_strategy
322
+ class FirstAnswer(Strategy):
323
+ name = "first"
324
+ summary = "Everyone answers; the first finished answer wins."
325
+
326
+ def run(self, session):
327
+ tools = session.tools(*RESEARCH, "final_answer")
328
+ results = session.run_turns([TurnJob(a, "Answer the question.", session.question, tools, "answer")
329
+ for a in session.alive()])
330
+ done = [r for r in results if r.finished]
331
+ return Outcome("committed", done[0].payload["answer"]) if done else Outcome("no_answer")
332
+ ```
333
+
334
+ Built-ins are discovered by importing every module in their package, so adding or removing a strategy,
335
+ harness or feature is adding or deleting a file.
336
+
337
+ **A harness** subclasses `bannaha.harnesses.base.Harness`, declares its backends and required
338
+ environment variables, and implements `run_turn(req)`: drive the model, call `req.call_tool(tool, args)`
339
+ for every tool call, stop when `req.is_done()`. `tests/test_harness_conformance.py` checks that nested
340
+ arguments arrive unchanged and that control signals end the turn.
341
+
342
+ **A feature** subclasses `bannaha.features.base.Feature` and hooks `before_tool` / `after_tool`.
343
+
344
+ ## Roadmap
345
+
346
+ Ideas, not commitments: an MCP server so external agents can join a fleet; a batch runner for sweeping
347
+ strategies × fleets × dropout over a question set; more coordination strategies.
348
+
349
+ ## License
350
+
351
+ MIT