Skip to content

About

An autonomous multi-agent research network where AI agents hire, collaborate, and pay each other in real-time using USDC and Circle Nanopayments on the Arc blockchain.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AgentSourcing β€” Autonomous Research Agent Network

AI agents hire AI agents. They pay each other in USDC. On-chain. In seconds.

Arc Blockchain Circle USDC Python FastAPI


πŸ’‘ What Is AgentSourcing?

AgentSourcing is an autonomous multi-agent research network where AI agents hire other AI agents and pay each other in real-time USDC on the Arc blockchain via Circle Nanopayments.

A user submits a research task for $0.05 USDC. A Manager Agent breaks it into sub-tasks, hires 6 Specialist Agents at $0.002 USDC each, and they in turn call premium data APIs at $0.0005 USDC per call β€” all settled on-chain, autonomously.


πŸ—οΈ Tech Stack

Layer Technology Why
Blockchain Arc (EVM-compatible, USDC gas) Sub-cent gas fees β€” makes $0.002 payments viable
Payments Circle Programmable Wallets (Developer-Controlled) Automated agent treasury, no key management
Payment Standard x402 / Circle Nanopayments Per-API-call monetisation at $0.0005 each
Currency USDC Stable, no volatility risk for agent commerce
Reputation ERC-8004 Trust Layer (Vyper) On-chain agent trust scores for agent selection
Smart Contracts Vyper 0.4.3 on Arc Testnet Escrow + reputation + payment release logic
AI / LLM Featherless.ai (LLaMA 3.1 70B, Qwen, Mistral, DeepSeek) Per-agent specialised model routing
Backend FastAPI + Python 3.12 + SSE Real-time event streaming to UI
Frontend React + TypeScript + Tailwind CSS (Vite) Glassmorphism dashboard with real-time SSE feed

⚑ Why Arc + Circle Nanopayments?

Network Gas per Tx Our Payment Gas as % Viable?
Ethereum Mainnet $2 – $8 $0.002 100,000%+ ❌ Impossible
Polygon / L2 $0.01 – $0.05 $0.002 500–2,500% ❌ Unprofitable
Arc + Nanopayments $0.000x $0.002 < 1% βœ… Fully viable

The math is simple: every other blockchain makes sub-cent agent payments economically impossible. Arc + Circle fix this.


πŸš€ Quick Start

Prerequisites

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/AgentSourcing.git
cd AgentSourcing

2. Install dependencies

pip install -r requirements.txt

# Build the frontend UI
cd frontend && npm install && npm run build && cd ..

3. Configure environment

# Windows
copy .env.example .env

# Linux / Mac
cp .env.example .env

Edit .env with your API keys β€” see Setup Guide for full instructions.

4. Generate Circle entity secret

# Step 1: Generate and save to .env as CIRCLE_ENTITY_SECRET
python circle/entity_secret.py generate

# Step 2: Get cipher text and register at console.circle.com
# β†’ Developer Controlled Wallets β†’ Configurator β†’ paste cipher text
python circle/entity_secret.py ciphertext

5. Create agent wallets on Arc Testnet

python circle/setup.py
# Prints all wallet IDs and addresses β€” copy to .env

6. Fund the Manager wallet

Visit faucet.circle.com β†’ send test USDC to your Manager wallet address.

7. Deploy ERC-8004 Vyper contract (optional)

python scripts/deploy_contract.py
# Saves contract address to .env as ERC8004_CONTRACT_ADDRESS

8. Start the server

python main.py
# Open: http://localhost:8000

πŸ“ Project Structure

AgentSourcing/
β”‚
β”œβ”€β”€ main.py                    # FastAPI app β€” all routes, SSE streaming, x402 endpoints
β”œβ”€β”€ config.py                  # Centralised config loaded from .env
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .env.example               # ← copy this to .env and fill in your keys
β”‚
β”œβ”€β”€ agents/
β”‚   β”œβ”€β”€ base_agent.py          # Abstract base β€” timing, ERC-8004 hooks, x402 integration
β”‚   β”œβ”€β”€ llm_client.py          # Featherless.ai LLM wrapper with per-agent model routing
β”‚   β”œβ”€β”€ manager_agent.py       # Tier-1 β€” orchestrator, hires specialists, pays USDC
β”‚   β”œβ”€β”€ scraper_agent.py       # Tier-2 β€” real-time web research (DuckDuckGo + BS4)
β”‚   β”œβ”€β”€ analyst_agent.py       # Tier-2 β€” market data analysis and trend detection
β”‚   β”œβ”€β”€ summarizer_agent.py    # Tier-2 β€” executive summaries and report writing
β”‚   β”œβ”€β”€ fact_checker_agent.py  # Tier-2 β€” claim verification and source checking
β”‚   β”œβ”€β”€ translator_agent.py    # Tier-2 β€” multilingual output + cultural relevance
β”‚   β”œβ”€β”€ validator_agent.py     # Tier-2 β€” LLM-powered quality validation
β”‚   └── data_agent.py          # Tier-3 β€” x402 nanopayment data fetcher
β”‚
β”œβ”€β”€ circle/
β”‚   β”œβ”€β”€ entity_secret.py       # RSA-OAEP entity secret generation and encryption
β”‚   β”œβ”€β”€ wallet_manager.py      # Wallet set / wallet CRUD + USDC balance queries
β”‚   β”œβ”€β”€ payment_processor.py   # USDC transfers + fee estimation + Arc explorer links
β”‚   β”œβ”€β”€ setup.py               # One-time provisioning of 8 agent wallets
β”‚   β”œβ”€β”€ x402_client.py         # x402 payment protocol client for data API calls
β”‚   └── wallets.json.example   # Example wallet structure (real wallets.json in .gitignore)
β”‚
β”œβ”€β”€ reputation/
β”‚   β”œβ”€β”€ erc8004.py             # ERC-8004 reputation scoring (in-memory + on-chain)
β”‚   β”œβ”€β”€ erc8004.vy             # Vyper 0.4.3 smart contract β€” deployed on Arc Testnet
β”‚   └── erc8004_abi.json       # Contract ABI for Web3 integration
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.tsx            # Main app β€” SSE streaming, payment events, routing
β”‚   β”‚   β”œβ”€β”€ components/        # AgentRoster, ReportViewer, TransactionFeed, etc.
β”‚   β”‚   └── index.css          # Tailwind + glassmorphism design system
β”‚   └── dist/                  # Production build (served by FastAPI)
β”‚
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ setup_guide.md         # Full setup walkthrough
β”‚   β”œβ”€β”€ agent_workflow.md      # How agents collaborate
β”‚   β”œβ”€β”€ agent_economy.md       # Circle wallets and payment architecture
β”‚   β”œβ”€β”€ architecture.md        # System architecture overview
β”‚   └── api_reference.md       # Full API endpoint reference
β”‚
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ deploy_contract.py     # Deploy Vyper contract to Arc Testnet
β”‚   β”œβ”€β”€ generate_wallet.py     # Generate new Circle wallets
β”‚   β”œβ”€β”€ check_deploy_ready.py  # Pre-deployment readiness check
β”‚   └── test_*.py              # Test scripts for individual components

πŸ“‘ API Reference

Method Endpoint Description
GET / Dashboard UI
GET /api/health System health + config status
POST /api/research Submit a research task
GET /api/research/{id}/stream SSE real-time event stream
GET /api/research/{id}/result Full research result
GET /api/research List all runs
GET /api/agents All agent ERC-8004 reputation profiles
GET /api/agents/{id} Single agent profile
POST /api/agents/register-wallet Register agent wallet address
GET /api/wallets List Circle wallets
GET /api/wallets/{id}/balance Wallet USDC balance
GET /api/transactions/{id} Circle transaction status
GET /api/x402/payments All x402 nanopayment records
GET /api/x402/endpoints 13 available premium data APIs
GET /data/{slug} x402-gated data endpoint (402 β†’ pay β†’ 200)

πŸ… ERC-8004 Reputation Formula

Agents build trust scores over time based on their track record:

score = 50
      + (completion_rate Γ— 25)     # reliability  β†’ max +25
      + (avg_quality / 10 Γ— 20)    # output quality β†’ max +20
      + min(completions, 10)        # experience    β†’ max +10
      βˆ’ (failures Γ— 5)             # failure penalty
      βˆ’ min(avg_latency_s, 5)      # speed penalty

Score clamped to [0, 100]. Manager uses scores to select best available agent per task.


🌍 Supported Languages (Translator Agent)

English Β· French Β· German Β· Hindi Β· Italian Β· Portuguese Β· Spanish Β· Thai


πŸ“š Documentation


πŸ”’ Security Notes

  • Never commit .env β€” it is in .gitignore
  • Your CIRCLE_ENTITY_SECRET and ARC_DEPLOYER_PRIVATE_KEY must stay local
  • Use Circle sandbox environment for development (no real money)
  • Rotate your API keys immediately if accidentally exposed

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -m 'Add my feature'
  4. Push: git push origin feature/my-feature
  5. Open a Pull Request

πŸ“„ License

Proprietary License β€” All rights reserved.


AgentSourcing β€” Built with ❀️ for the Agentic Economy on Arc

Powered by Arc + Circle + Featherless.ai

About

An autonomous multi-agent research network where AI agents hire, collaborate, and pay each other in real-time using USDC and Circle Nanopayments on the Arc blockchain.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages