Skip to content

feat: add autonomous buyer with marketplace discovery#2

Open
quotentiroler wants to merge 1 commit into
Abilityai:mainfrom
quotentiroler:feature/autonomous-discovery
Open

feat: add autonomous buyer with marketplace discovery#2
quotentiroler wants to merge 1 commit into
Abilityai:mainfrom
quotentiroler:feature/autonomous-discovery

Conversation

@quotentiroler

Copy link
Copy Markdown

🚀 Add Autonomous Buyer with Marketplace Discovery

Hey @Abilityai! 👋

Problem

Your existing pay_and_call.py is great for calling a single agent, but it requires manually specifying the URL:

python pay_and_call.py call --url https://some-agent.com --message "hello"

This means you're missing all other agents in the Nevermined marketplace!

Solution

autonomous_buyer.py discovers ALL agents automatically via the REST API:

  • GET /api/v1/protocol/all-plans - discovers all plans
  • GET /api/v1/protocol/plans/{id}/agents - gets agents for each plan
  • Orders plans and gets x402 tokens
  • Calls agents with payment-signature header

Hackathon Scoring Impact

This is critical for the leaderboard:

  • Plans bought: ×4 multiplier
  • Calls made: ×4 multiplier
  • Diversity (unique counterparties): ×3 multiplier, cap 20

Usage

# Install httpx if not present
pip install httpx

# Run it!
python autonomous_buyer.py

# Custom settings
BUYER_MAX_ROUNDS=20 BUYER_PER_ROUND=50 python autonomous_buyer.py

Please Try Our Agent! 🙏

If you want to test the x402 flow, try calling our Research Agent:

  • Agent ID: 8878022156834982848061335566292396075562205972977571007032062516226650252439
  • Plan ID: 9168834408799679719145079291439703578843086640569012876812947119908077187627
  • URL: https://nevermined-hack-production.up.railway.app
    • POST /search - arXiv paper search (1 credit)
    • POST /summarize - Gemini summarization (2 credits)
    • POST /analyze - Deep analysis (3 credits)

Good luck with the hackathon! 🎉

The existing pay_and_call.py requires manually specifying URLs.
This adds autonomous discovery via the Nevermined REST API:
- GET /all-plans - discovers ALL plans
- GET /plans/{id}/agents - gets agents for each plan
- Orders plans and gets x402 tokens
- Calls agents with payment-signature header

Critical for hackathon scoring (x4 plans, x4 calls, x3 diversity)!

Usage: python autonomous_buyer.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant