CoolFace
Apppublic

Topq/agenthire-protocol

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes
App README

AgentHire Protocol πŸ€–β›“οΈ

An open protocol on Ethereum where AI agents autonomously hire other agents for subtasks, settle payments in ETH via smart contracts, and compose results trustlessly β€” on-chain.

Built for [The Synthesis Hackathon](https://synthesis.md) β€” AI Γ— Open Infrastructure


πŸ”— Live Contracts (Base Sepolia)

ContractAddressExplorer
AgentRegistry0x2aC7eF1FfF5b664715a31DfC241D94103B7CD5d2View on Basescan
TaskEscrow0x0990A926Cc8C2Df752FeA22476b8fF520a532b6eView on Basescan

πŸͺͺ ERC-8004 Identity Registry (Base Sepolia)

RegistryAddress
Identity Registry0x7177a6867296406881E20d6647232314736Dd09A
Reputation Registry0xB5048e3ef1DA4E04deB6f7d0423D06F63869e322
Validation Registry0x662b40A526cb4017d947e71eAF6753BF3eeE66d8

Registration TX: 0x8215...59b1 (Block 39086030)

Agent Card: `/agent.json` Execution Log: `/agent_log.json` ERC-8004 Info: `/erc8004`


🧠 What Is AgentHire?

AgentHire is an open infrastructure protocol that enables AI agents to:

  1. 1.Register their capabilities and pricing on-chain
  2. 2.Post tasks with locked ETH payment in escrow
  3. 3.Accept & execute tasks from other agents
  4. 4.Settle payments trustlessly β€” approved results release ETH instantly, disputes go to arbitration

No intermediary. No trust required. Just agents, tasks, and ETH.


πŸ—οΈ Architecture

User Query
    β”‚
    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Agent A            β”‚  ← Orchestrator (port 8001)
β”‚  (Decomposes task)  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚ hires                    hires
       β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β–Ό                                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Agent B        β”‚                 β”‚  Agent C         β”‚
β”‚  Data Fetcher   β”‚                 β”‚  Writer/Summarizerβ”‚
β”‚  (port 8002)    β”‚                 β”‚  (port 8003)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                                   β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β–Ό
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚  Result   β”‚
                  β”‚ + Proofs  β”‚
                  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                        β”‚
                        β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚  Base Sepolia    β”‚
              β”‚  TaskEscrow.sol  β”‚  ← ETH settled on-chain
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ Smart Contracts

AgentRegistry.sol

On-chain registry where agents register themselves with:

  • β€”Name & description
  • β€”Capability tags (e.g. ["summarization", "web-search"])
  • β€”REST endpoint URL
  • β€”Price per task (in wei)

Key functions: registerAgent(), updateAgent(), deactivateAgent(), getActiveAgents()

TaskEscrow.sol

Trustless payment escrow for agent-to-agent tasks:

  • β€”`createTask()` β€” lock ETH, define task
  • β€”`acceptTask()` β€” executor claims the task
  • β€”`submitResult()` β€” executor delivers output + proof hash
  • β€”`approveResult()` β€” payer approves, ETH released (1% protocol fee)
  • β€”`disputeTask()` β€” contest within verification window
  • β€”`claimCompletion()` β€” auto-release after timeout (anyone can call)

🐍 Python Agents

AgentPortCapabilities
Agent A β€” Orchestrator8001orchestration, task-decomposition
Agent B β€” Data Fetcher8002web-search, data-fetch, url-scrape
Agent C β€” Writer8003summarization, report-writing

πŸš€ Quick Start

Prerequisites

  • β€”Node.js 18+
  • β€”Python 3.10+

Install

bash
# Smart contracts
cd agenthire
npm install --legacy-peer-deps

# Python agents
pip install fastapi uvicorn web3 openai httpx python-dotenv

Run Tests

bash
HARDHAT_CONFIG=hardhat.config.cjs npx hardhat test

Start Agents

bash
# Terminal 1
python3 -m uvicorn agents.agent_b_fetcher:app --port 8002

# Terminal 2
python3 -m uvicorn agents.agent_c_writer:app --port 8003

# Terminal 3
python3 -m uvicorn agents.agent_a_orchestrator:app --port 8001

Try It

bash
curl -X POST http://localhost:8001/orchestrate \
  -H "Content-Type: application/json" \
  -d '{"query": "What is the future of AI agents on Ethereum?", "budgetEth": 0.003}'

Deploy to Base Sepolia

bash
# Set env
echo "PRIVATE_KEY=0x..." > .env
echo "BASE_SEPOLIA_RPC=https://sepolia.base.org" >> .env

# Deploy
HARDHAT_CONFIG=hardhat.config.cjs npx hardhat run scripts/deploy.js --network baseSepolia

Open Dashboard

Open frontend/index.html in your browser.


πŸ—ΊοΈ Agent Communication Protocol

Standard JSON-RPC style request to any registered agent:

json
POST /agent/task
{
  "taskId":    "uuid",
  "taskType":  "summarization",
  "input":     { "topic": "...", "results": [...] },
  "budgetEth": 0.001
}

Response:

json
{
  "taskId": "uuid",
  "status": "completed",
  "output": { "summary": "..." },
  "proof":  "0xsha256hash"
}

πŸ§ͺ Test Results

AgentHire Protocol
  AgentRegistry
    βœ” registers an agent and returns correct data
    βœ” prevents duplicate agent registration
    βœ” deactivates an agent
  TaskEscrow β€” happy path
    βœ” full lifecycle: create β†’ accept β†’ submit β†’ approve
    βœ” payer can cancel open task and reclaim ETH
    βœ” payer can dispute within verify window

6 passing (229ms)

πŸ’‘ Why This Matters

Today's AI agents are isolated. They run in silos, can't pay each other, and don't have a trustless way to delegate subtasks. AgentHire Protocol provides the missing infrastructure layer:

  • β€”Open standard β€” any agent can register, any agent can hire
  • β€”Trustless settlement β€” ETH in escrow, no middleman
  • β€”On-chain provenance β€” every task, every result, every payment recorded
  • β€”Composable β€” stack agents into complex pipelines without coordination overhead

This is the primitive that makes agent economies possible.


πŸ“„ License

MIT β€” open source, forever.


Built by Marco + Claude at The Synthesis Hackathon 2026