Architecture

How the protocol layers fit together.

1 — System Overview

Three layers: on-chain Base Sepolia, the Parley Protocol platform API, and OpenServ SDK agents.

Base Sepolia — On-Chain

ERC-8004 AgentRegistry0xb0088…D305
USDC0x036C…F7e
x402.org Facilitatorverify + settle
verify + settle on-chain

Parley Protocol Platform

/api/content/:id402 → verify → settle
/api/agent/negotiateClaude AI engine
/api/dashboardpublisher stats
MongoDB Atlasvia Prisma
capabilities
capabilities

Publisher Agent — OpenServ SDK

· negotiate_access
· check_reputation
· evaluate_content
· update_reputation

Consumer Agent — OpenServ SDK

· browse_articles
· negotiate_content_access
· purchase_content (x402)
· autonomous_content_purchase

2 — x402 Payment Flow

How real USDC moves from a consumer agent to a publisher wallet, settled on Base Sepolia.

Consumer Agent
GET /api/content/:id
Platform API
verify + settle
x402 Facilitator
transferWithAuth
USDCBase Sepolia
1.
Consumer AgentGET /api/content/:id — no payment header
2.
Platform APIHTTP 402 Payment Required

{ x402Version:1, network:"base-sepolia", asset:"0x036C…", maxAmountRequired:"1000", extra:{name:"USDC",version:"2"} }

3.
Consumer AgentSign EIP-3009 TransferWithAuthorization

ExactEvmSchemeV1 creates EIP-712 typed data signature

4.
Consumer AgentGET /api/content/:id with X-PAYMENT header
5.
x402 Facilitatorverify → transferWithAuthorization on-chain

Executes USDC transfer on Base Sepolia

6.
Platform APIAccessLog saved to MongoDB — tx hash recorded
7.
Consumer AgentHTTP 200 — full content + txHash

3 — Negotiation Flow

How the Claude AI engine reads on-chain reputation and settles on a price.

Consumer Agent
POST /api/agent/negotiate
Claude AI Engine
readContract
ERC-8004Base Sepolia
1.
Consumer AgentPOST { articleId, consumerAddress, offer: 0.0005 }
2.
Platform APIfind article + publisher settings in MongoDB
3.
Claude AI EnginegetReputation(consumerAddress) on ERC-8004

Returns { score: 50, totalDeals: 0, exists: true }

4.
Claude AI EngineApply reputation multiplier + check use-case keywords

Use-case match

keyword match → free or discount

decision: accept, price: 0

Offer ≥ minPrice

meets floor with rep adjustment

decision: accept, price: offer

Offer < minPrice

too low — publisher counters

decision: counter, price: minPrice

5.
Platform APINegotiationSession.create/update in MongoDB
6.
Consumer AgentReceives { decision, price, reasoning, sessionId }
7.
Consumer AgentIf counter → submit new offer with sessionId (up to 4 rounds)