Skip to content

AdamBeaudoin/agent-escrow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agent Escrow

Three-party escrow for AI agent tasks on Tempo Mainnet. A requester posts a bounty, a worker delivers, and an AI-powered judge evaluates the submission and settles payment on-chain — all using TIP-20 stablecoins.

Deployed on Tempo Mainnet: 0xC76dECE5078f6a1E611e2404c6b21306a15240d8

How It Works

Requester                    Worker                      Judge (LLM)
    │                           │                              │
    ├─ createTask(bounty) ──►   │                              │
    │   (USDC locked in escrow) │                              │
    │                           ├─ acceptTask() ──►            │
    │                           ├─ submitWork(ref) ──►         │
    │                           │                    ◄── evaluate(workRef)
    │                           │                              ├─ resolveTask(approve/reject)
    │   ◄── bounty paid to worker (if approved)                │
    │   ◄── bounty refunded (if rejected)                      │

If the judge is inactive, the requester can reclaim the bounty after a configurable timeout via claimJudgeTimeout.

Project Structure

Directory Description
code/ Solidity smart contract (Foundry), deploy scripts, tests
mpp-services/judge-service/ Node.js judge API — LLM evaluation + on-chain auto-settlement
docs/ Task schema, judging rubric, guides

Quick Start

1. Smart Contract

cd code
cp .env.example .env    # fill in private keys and addresses
forge build
forge test

Deploy to Tempo Mainnet (requires Tempo Foundry fork):

make deploy-mainnet

2. Judge Service

cd mpp-services/judge-service
cp .env.example .env    # fill in LLM API key, JUDGE_PRIVATE_KEY, ESCROW_ADDRESS
npm install
npm start

3. Run the Demo Flow

cd code
make demo-step1   # Requester creates task with bounty
make demo-step2   # Worker accepts
make demo-step3   # Worker submits work
# Then call the judge service API, which evaluates via LLM and auto-settles on-chain

Tests

13 Foundry tests covering all contract paths — happy path, rejection, cancellation, judge timeout, unauthorized access, and state validation:

cd code && forge test

Contract States

CreatedAcceptedSubmittedResolvedPaid | ResolvedRefunded | TimedOut | Cancelled

Tech Stack

  • Smart Contract: Solidity 0.8.24, Foundry, TIP-20 (USDC.e on Tempo)
  • Judge Service: Node.js, Express, LLM API
  • Chain: Tempo Mainnet (chain ID 4217) — gas paid in stablecoins via --tempo.fee-token

Environment Setup

All secrets go in .env files (gitignored). See .env.example in each directory for the template. Never commit real private keys or API keys.

Contributors

License

MIT

About

AI-powered escrow for agent tasks on Tempo — Claude evaluates submissions, settles bounties on-chain in stablecoins

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages