Skip to content

ryukoshi1/agent-bazaar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agent Bazaar

Tests Python Crypto License

An agent-native marketplace inspired by NARA. Agents own ed25519 identities, list Aapps (agent applications) on a registry, call each other over signed envelopes, and settle in NARA tokens. Every call appends a tamper-evident receipt to a hash-chained ledger.

Humans tap screens. Agents call Aapps. Work proves itself.

Agent Bazaar Explorer

What is real here

  • Identity: ed25519 keypair per agent, deterministic JSON canonicalization, signed and verified with cryptography. Tampering with payload or swapping keys is detected.
  • Registry: local JSON-backed registry of agents (with NARA balances) and Aapps (with prices and owners).
  • Aapp protocol: caller signs {aapp, action, params, nonce, ts}. The Aapp verifies, executes, signs the response, and the marketplace settles the transfer.
  • Ledger: append-only, hash-chained (prev_hash + self_hash). The CLI command bazaar verify re-checks the chain end-to-end.
  • Reference Aapp: SummarizeAapp (extractive by default, optionally LLM-backed) charges 0.05 NARA per call.
  • Explorer dashboard: live view of registry + ledger, with chain integrity check performed in the browser from data/*.json.

Architecture

   ┌──── Identity (ed25519) ────┐
   │                            │
[Alice]  ──signed request──▶  [Bob's SummarizeAapp]
   │                                   │
   │ ◀── signed response + receipt ────│
   │                                   │
   ▼                                   ▼
[Registry: balances]      [Ledger: hash-chained receipts]
            ▲                      ▲
            └──── Web Explorer ────┘

Quickstart

pip install -e .[test]            # cryptography + pytest

# 1. Run the end-to-end demo (creates 2 agents, lists 1 Aapp, makes 2 calls)
python3 scripts/demo.py

# 2. Inspect the ledger
python3 -m bazaar.cli ledger

# 3. Verify chain integrity
python3 -m bazaar.cli verify

# 4. Open the explorer dashboard
python3 -m http.server 4174 &
open http://localhost:4174/web/

Sample CLI session

$ python3 -m bazaar.cli register alice --balance 1.0
$ python3 -m bazaar.cli register bob
$ python3 -m bazaar.cli call \
    --caller alice --aapp-owner bob \
    --text "NARA is an agent-native L1 ..."

{
  "ok": true,
  "response": {"aapp": "summarize", "summary": "..."},
  "aapp_signature": "P6OueL68khfkIFe5/...",
  "ledger_index": 0
}

$ python3 -m bazaar.cli verify
{ "intact": true, "size": 1 }

Project layout

agent-bazaar/
├── bazaar/
│   ├── identity.py     # ed25519 keypair, canonical JSON, sign/verify
│   ├── registry.py     # JSON-backed agent + Aapp registry
│   ├── ledger.py       # append-only hash-chained ledger
│   ├── aapp.py         # Aapp protocol + SummarizeAapp reference impl
│   ├── orchestrator.py # caller-side helper to build/sign/dispatch calls
│   └── cli.py          # `bazaar register|list|call|ledger|verify`
├── tests/              # 9 pytest cases
├── data/               # registry.json, ledger.json, identities/
├── web/                # Explorer dashboard (no build step)
├── scripts/
│   ├── demo.py
│   └── generate_proof.py
└── README.md

Why NARA?

NARA argues that the next economic actors aren't human — they are agents. Agent Bazaar is a tiny but faithful slice of that thesis you can run on your laptop:

  • An ID card for every agent. ✅ ed25519 keypair, agent_id derived from key.
  • Aapps callable by agents. ✅ signed envelope protocol.
  • Settlement in NARA. ✅ balance adjustments + signed receipts.
  • Work proves itself. ✅ hash-chained ledger, browser-verifiable.

The blockchain layer is replaced with a local JSON ledger so the demo runs offline; the cryptographic primitives (ed25519, canonical JSON, hash chain) are real and identical to what an on-chain implementation would use.

Tests

python3 -m pytest -v

Covers:

  • ed25519 keypair save/load, sign/verify, tamper rejection
  • canonical JSON hashing
  • end-to-end call flow with balance settlement
  • insufficient-balance rejection
  • unregistered-caller rejection
  • ledger chain integrity + tamper detection

License

MIT License. See LICENSE.

About

Agent Bazaar: an agent-native marketplace inspired by NARA. ed25519 identity, signed Aapp calls, hash-chained ledger, and a live explorer dashboard.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors