in reviewhumanPR #340Registry

Bazaaro: add registry integration (bazaroo.v1) with name-taken refusal scenario

Bazaaro is a marketplace where AI agents discover, evaluate and hire specialized intelligence (currently medical specialist agents, plus a primary-care agent that assembles a team).

Author

leyregarridoi-source avatar

@leyregarridoi-source

github profile →
Status
In review
Opened on
Nov 11
Branch
integration/bazaroo-discovery

Description

The pitch.

## Summary

Bazaaro is a marketplace where AI agents discover, evaluate and hire specialized intelligence (currently medical specialist agents, plus a primary-care agent that assembles a team). Agents interact with it by registering and being found through its marketplace.

This PR adds a Town `registry` plugin, `bazaroo.v1`, that sends Town's publish and lookup calls to Bazaaro's HTTP API, so that **Bazaaro, not Town, decides who owns a name**. It also adds two scenarios (success path and a refusal case), validators, offline tests, and a verify helper. Everything is under `integrations/bazaroo/`. No existing Town file is changed.

Bazaaro is our team's own project, so this is a team-authored integration, not independently adopted compatibility. (Naming: the app is "Bazaaro"; the plugin id, folder and env var names use the spelling "bazaroo".)

## Integration

- **Separately hosted service:** `https://bazaaro.ryan-teo.com`, a TanStack Start app built in Lovable. Its code is not in this PR. Project version: Lovable commit `7c722a58e70ba53498f10faac077e5499ff23efe` (last edited 2026-11-10T02:47Z).
- **API added for this assignment** (Bazaaro had no outside-facing agent API):
  - `POST /api/public/agents/register` with `Authorization: Bearer <key>` and `{name, capabilities[], description}` returns `201 {agent_id}`, or `409 {"error":"name_taken"}` if a different key owns the name (or it is a reserved built-in name), `401` for a bad key, `400` for a bad body.
  - `GET /api/public/agents/search?q=...` with the same Bearer key returns `{agents:[...]}`.
  - Each agent has its own key, which is its identity. Keys are stored only as SHA-256 hashes.
- **Plugin behavior** (`registry_bazaroo_v1.py`, subclass of `TownIndex`):
  - `201` accepts the card; `409` refuses it and leaves the existing listing untouched; `401`/`400` refuse; a timeout or network error stores nothing and is recorded as `outcome: unknown`, never as an accept.
  - Lookups go to Bazaaro search and keep exact capability matches. A failed lookup returns `[]` and emits `registry_lookup_failed`, so "nobody found" and "could not ask" are distinguishable.
  - Town's own signature check still runs and is recorded as `town_signature_verified`, but it does not gate the decision. Bazaaro's key is the authority.
- **Keys** come from environment variables only: `BAZAROO_KEY_<PUBLISHER>` (for example `BAZAROO_KEY_HW8_SELLER`) and `BAZAROO_KEY_LOOKUP`. No keys are in this PR.

## Reproduce

- Nanda Town commit: `6f9a7c064486c4a0ae9242f1ff341b8a4aad0244` (`main`; this branch adds two commits on top)
- Bazaaro version: Lovable commit `7c722a58e70ba53498f10faac077e5499ff23efe`
- Environment used: Windows, Python 3.14.8, nandatown 0.2.0, evaluator lab-0.2.6

Offline tests (no network, no keys):

```
python -m pip install -e ".[dev]"
python -m unittest discover -s integrations/bazaroo -v
```

Expected: 27 tests, `OK (skipped=1)`; the skipped test is the live one.

End-to-end scenarios against the live Bazaaro service need three Bazaaro API keys, which the team holds (ask us for test keys, or point `BAZAROO_BASE_URL` at your own deployment). Set them without quotes or spaces inside the value:

```
$env:BAZAROO_KEY_HW8_SELLER = "<key 1>"
$env:BAZAROO_KEY_HW8_BUYER  = "<key 2>"
$env:BAZAROO_KEY_LOOKUP     = "<key 3>"
nandatown run integrations/bazaroo/bazaroo-discovery.yaml
python integrations/bazaroo/verify_bazaroo.py runs/<run-id>
```

Failure case (Bazaaro has no delete, so after the run above the name `hw8-seller` belongs to key 1; run with a different key):

```
$env:BAZAROO_KEY_HW8_SELLER = "<key 2>"
nandatown run integrations/bazaroo/bazaroo-name-taken.yaml
python integrations/bazaroo/verify_bazaroo.py runs/<run-id>
```

## Results and limitations

| Check | Expected | Observed |
|---|---|---|
| `bazaroo-discovery` (run `sim-9d05f578e95b`) | Both agents accepted by Bazaaro; buyer finds seller through it | PASSED: `bazaroo_regist

…

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/340/head:pr-340
git checkout pr-340