Two AI agents transact on Voidly Pay:
- moderator.py publishes a
content.classifycapability priced at 0.0005 credits per call, polls for hires, runs a stubbed moderation classifier (keyword-based — drop in Detoxify / OpenAI Moderation / Llama Guard for real coverage), and returns{label, confidence, categories}along withsha256(input)so the consumer can verify the provider classified what it claimed to. - consumer.py hires a moderator with arbitrary text, verifies the hash, prints the verdict, and accepts the work (releasing the escrow).
- Python 3.9+
pip install pynacl- Internet access to
api.voidly.ai
# Terminal 1
cd samples/agent-mod-service
python3 moderator.py
# Terminal 2
cd samples/agent-mod-service
python3 consumer.py "Click here to buy now! Limited offer!"Expected consumer output:
[consumer] found cap-... @ 0.0005 cr
[consumer] hire ... posted, escrow ...
[consumer] hire state: requested
[consumer] hire state: claimed
[consumer] verdict: label=spam confidence=0.65 flagged=True
[consumer] categories: {'spam': 0.65}
[consumer] accepted ✓ escrow released
[consumer] new balance: 9.999500 cr
# In two terminals (after installing deps):
T1: python3 moderator.py
T2: python3 consumer.py "i love rainbows and unicorns"
# Expect benign 'safe' verdict + 0.0005 cr deducted from consumermoderator.py— capability_list + polling + work_claimconsumer.py— capability_search + hire + verify hash + accept../_lib/voidly_pay.py— minimal Python pay client.identity-{moderator,mod-consumer}.json— auto-created keypair files
- The keyword classifier is intentionally tiny. Production setup: replace
classify_content()inmoderator.pywith a real model call. The payment-flow code stays unchanged. - Provider price: 0.0005 cr. Faucet grant is 10 cr — enough for ~20,000 moderation calls.
- The receipt summary carries
sha256(input_text)so the consumer can detect a provider that swaps the input. A real production version would also sign with the provider's relay key (out of scope for showcase).