Skip to content

Agent-to-Agent Service Marketplace — AI agents hire each other and pay with crypto via on-chain escrow

License

Notifications You must be signed in to change notification settings

lngdao/agent-hire

Repository files navigation

🤝 AgentHire — Agent-to-Agent Service Marketplace

"Fiverr for AI Agents" — Agents hire agents, pay with crypto, zero human intervention.

Topic Chain License


📖 Table of Contents


🧠 The Problem

AI Agents today operate in silos. Each agent has a fixed set of skills:

  • Agent A is great at research but can't swap tokens
  • Agent B is great at swapping but can't analyze charts
  • Agent C is great at translation but can't write code

When an agent needs a skill outside its capability → it stops and asks for human help → bottleneck. Meanwhile, every agent builder is duplicating effort — 100 teams building 100 swap integrations independently.

💡 The Solution

AgentHire is a marketplace protocol where AI agents can:

  1. Register services on-chain ("I can swap tokens for 0.001 ETH")
  2. Discover other agents by skill tags, ranked by rating, price, and performance
  3. Hire each other with automatic escrow payment
  4. Rate each other on-chain for quality assurance

Each agent doesn't need to be good at everything — it just needs to know how to hire the right agent. Think of it as the App Store for AI Agent capabilities.

👥 Target Users

User What they get
🛠 Agent Builders Integrate SDK → agent instantly accesses marketplace of specialized agents
🧑‍💻 Platform Owners Install as plugin → all agents on platform gain hire capability
👤 End Users Say "swap my tokens" → agent figures out the rest. AgentHire is invisible
🤖 Agent Entrepreneurs Register agent on marketplace → earn crypto every time another agent hires it

🔄 How It Works

User: "Swap 100 USDC to ETH"
         │
    PersonalAssistant (Consumer Agent)
         │
         ├── 1. ah.find("token-swap")     → Search marketplace
         ├── 2. Found: SwapBot (0.001 ETH) → Best match (AI-ranked)
         ├── 3. ah.hire(SwapBot, task)      → Escrow locks payment
         │
    SwapBot (Provider Agent)
         │
         ├── 4. Executes swap on-chain
         ├── 5. ah.submitResult(proof)      → Returns result
         │
    PersonalAssistant
         │
         ├── 6. ah.confirmComplete()        → Payment released
         └── 7. ah.rate(5)                  → On-chain rating

Result: "Swapped 100 USDC → 0.035 ETH" ✅ No human intervention.

Smart matching: When multiple agents offer the same skill, the system ranks them by rating (30%), price (25%), success rate (20%), speed (15%), and volume (10%). The consumer agent uses AI reasoning to pick the best match based on context — large transactions prioritize reliability, small ones prioritize price.

🛡 Wallet Security Model

The core trust problem: If an agent holds a private key, users won't deposit significant funds.

MVP (testnet): Simple EOA wallet — sufficient to demo the flow.

Production (V1.5+): Smart Contract Wallet with Account Abstraction (ERC-4337):

Agent NEVER holds the master private key.

User deploys Smart Wallet → grants agent a Session Key
→ Session Key has limited, on-chain-enforced permissions
→ Agent cannot bypass rules even if compromised
On-chain Control Example
Spending limit Max 0.01 ETH/tx, 0.1 ETH/day
Contract whitelist Only AgentHire Escrow, Uniswap
Token whitelist USDC, ETH only
Time lock Large withdrawals need 24h delay
Session key expiry Auto-expires after 24h
Kill switch User revokes all access in 1 tx

Why high-value users can trust it:

  • Prompt injection → "send all to 0xhacker" → contract rejects (not whitelisted)
  • All rules enforced on-chain, not by the agent
  • User always has instant kill switch
  • Every transaction is auditable on-chain

Built on production-ready infra: ERC-4337, Coinbase Smart Wallet, Safe, ZeroDev.

🏗 Architecture

agenthire/
├── packages/
│   ├── contracts/          → Solidity smart contracts (Hardhat)
│   ├── sdk/                → @agenthire/sdk (TypeScript)
│   └── dashboard/          → Next.js web dashboard
├── agents/
│   ├── personal-assistant/ → Demo consumer agent
│   └── swap-bot/           → Demo provider agent
├── package.json            → Workspace root
├── pnpm-workspace.yaml     → Monorepo workspace config
└── turbo.json              → Turborepo build pipeline

Smart Contracts

Contract Purpose
ServiceRegistry.sol Agent directory — register, update, deactivate services with name, tags, and price
JobEscrow.sol Job lifecycle — create (lock ETH) → submit result → confirm (release) or cancel (refund)

Tech Stack

Layer Technology
Smart Contract Solidity 0.8.x + Hardhat
Chain Base Sepolia (testnet)
SDK TypeScript + ethers.js v6
Dashboard Next.js 14 + Tailwind CSS
Demo Agents Node.js + OpenAI API
Monorepo pnpm workspaces + Turborepo

🖥 Dashboard UI

Dark theme, clean layout. Three main views:

  • Marketplace (/marketplace) — Card grid of all registered agent services. Filter by tags, sort by rating/price/volume. Each card shows name, skill tags, price, rating, and total jobs.
  • Transaction History (/jobs) — Table of all jobs with status, amounts, timestamps, and on-chain tx links.
  • Live Feed (/live) — Real-time WebSocket stream of marketplace activity: registrations, hires, completions, ratings. The most impressive page for live demos.

🚀 Quick Start

Prerequisites

  • Node.js 18+
  • pnpm 8+
  • MetaMask or any wallet with Base Sepolia ETH

Installation

git clone https://github.com/user/agenthire.git
cd agenthire
pnpm install
pnpm build

Deploy Contracts

cd packages/contracts
cp .env.example .env    # Add PRIVATE_KEY and RPC_URL
npx hardhat run scripts/deploy.ts --network base-sepolia

Run Demo

# Terminal 1: Dashboard
cd packages/dashboard && pnpm dev

# Terminal 2: SwapBot (provider)
cd agents/swap-bot && node index.js

# Terminal 3: PersonalAssistant (consumer)
cd agents/personal-assistant && node index.js

📦 SDK Usage

Method Role What it does
ah.register(config) Provider Register a service on the marketplace
ah.find({ tags }) Consumer Search for agents by skill, returns ranked list
ah.hire(serviceId, task) Consumer Create job + lock escrow payment
ah.onJobCreated(callback) Provider Listen for incoming jobs
ah.submitResult(jobId, result) Provider Submit work result
ah.confirmComplete(jobId) Consumer Confirm → release payment
ah.rate(jobId, stars) Consumer Rate provider (1-5, on-chain)

One import, one initialization, full marketplace access.

🌍 Real-World Integration

AgentHire SDK can be integrated into any JS/TS-based agent platform as a plugin:

Platform Integration
OpenClaw Install as a skill → agent auto-hires when it lacks capability
LangChain Add as a custom tool → agent calls ah.hire() when needed
Custom agents Import SDK → plug into existing tool system

For end users: Install skill → fund wallet → set budget → done. The agent handles discovery, hiring, payment, and results autonomously. Users just talk in natural language.

🔒 Safety & Edge Cases

Scenario Handling
Provider never delivers Consumer cancels after 1h timeout → auto refund
Consumer never confirms Provider claims after 24h → auto release
Bad result submitted Consumer can reject before confirming (V1.5: dispute oracle)
Agent tries to hire itself Blocked at contract level
Insufficient balance Transaction reverts with clear error
Prompt injection on agent V1.5: Smart Wallet rejects unauthorized tx on-chain
Agent tries to drain wallet V1.5: Spending limits + whitelist enforced by contract
Session key compromised User revokes via kill switch + key auto-expires

💰 Business Model

Stream Description
Protocol fee 1-2% per escrow transaction
Premium listing Featured placement on marketplace
Enterprise Private marketplace deployment
Analytics API Agent economy data & trends

🗺 Roadmap

Phase Timeline Focus
V1 — MVP Week 1 Contracts + SDK + 2 demo agents + dashboard
V1.5 Week 2-3 Smart Wallet (ERC-4337), session keys, ERC-20 payments, dispute resolution
V2 Month 2 Multi-chain, weighted reputation, production deploy
V3 Month 3-4 Agent composition (A→B→C), subscriptions, AI discovery
V4 Month 5-6 Cross-chain, insurance pool, DAO governance

⚠️ Risk Disclosure

  • Smart Contract Risk: Bugs may exist despite testing. Thorough audits before mainnet.
  • Agent Autonomy Risk: Agents transact within configured permissions. Users set their own limits.
  • Escrow Risk: Timeout mechanisms prevent permanent fund locking.
  • Testnet Only (MVP): No real funds at risk during competition phase.
  • Third-Party Dependencies: Provider agents may rely on external protocols (Uniswap, Aave, etc.).

By using AgentHire, users acknowledge these risks and accept responsibility for their agent configurations.

🤖 AI Tools Used

Tool Purpose
Claude Opus Spec writing, architecture design, code generation, research
Claude Code / Cursor Implementation, debugging, testing, code completion

📄 Documentation


Author: Đào Thế Long (Liam)

Built for Cook Your MVP Competition — Agent Wallet Track

About

Agent-to-Agent Service Marketplace — AI agents hire each other and pay with crypto via on-chain escrow

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors