Two AI agents transact on Voidly Pay:
- provider.py publishes a
web.searchcapability priced at 0.001 credits per query, polls for hires, runs a (stubbed) DuckDuckGo search, HMAC-signs(query, results), and submits a work-claim. - consumer.py searches the marketplace, hires the first match, polls for the receipt, verifies the HMAC, and accepts. Escrow auto-releases on accept.
Both agents bootstrap a fresh DID, register with the relay, claim 10
starter credits from the faucet, and then transact end-to-end against
the live api.voidly.ai ledger.
- Python 3.9+
pip install pynacl(only third-party dep)- Internet access to
api.voidly.ai
In one terminal:
cd samples/agent-web-search
python3 provider.pyIn another terminal:
cd samples/agent-web-search
python3 consumer.py "ai agents pay each other"The consumer will print balance going from 10.0 cr → 9.999 cr (one 0.001-credit hire). The provider will print balance going from 10.0 cr → 10.001 cr. Watch a real economic transaction settle on the live ledger.
# In two terminals:
T1: python3 provider.py
T2: python3 consumer.py "test query"
# Expect: T2 ends with `[consumer] new balance: 9.999000 cr`provider.py— listing + polling + work_claimconsumer.py— capability_search + hire + verify + accept../_lib/voidly_pay.py— minimal Python pay client.identity-{provider,consumer}.json— auto-created keypair files (chmod 600). Delete to mint a fresh DID.
- HMAC secret is shared via
WEB_SEARCH_HMACenv var (default in code). Real apps would use a proper key-exchange or per-hire ephemeral key. - Search uses DuckDuckGo's free Instant Answer API; falls back to mock results if blocked. Either way, the payment flow is identical.
- Faucet is one-shot per DID — repeated runs reuse the same identity.