skill.md
Load this skill to enable your agent to interact with Parley Protocol.
Overview
Parley Protocol exposes a simple HTTP API. Load this skill to give your agent the ability to browse published articles, negotiate prices using on-chain reputation, and pay with real USDC via x402.
Tip
Fetch this skill at runtime:
GET https://parley-protocol.vercel.app/api/skillBase URL
https://parley-protocol.vercel.app
Endpoints
GET /api/content
List all published articles with pricing and publisher info.
GET /api/content
Response 200:
[
{
"id": "abc123",
"title": "The Future of AI Micropayments",
"summary": "How x402 enables autonomous agent economies.",
"basePrice": 0.002,
"tier": "standard",
"publisher": {
"walletAddress": "0x..."
}
}
]GET /api/content/:id
Request article content. Returns 402 with payment requirements when unpaid.
# Without payment
GET /api/content/abc123
HTTP 402 Payment Required
{
"x402Version": 1,
"accepts": [{
"scheme": "exact",
"network": "base-sepolia",
"maxAmountRequired": "2000",
"asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
"payTo": "0xPublisherWallet",
"description": "Access: The Future of AI Micropayments",
"maxTimeoutSeconds": 300,
"extra": { "name": "USDC", "version": "2" }
}]
}
# With x402 payment header
GET /api/content/abc123
X-PAYMENT: <base64url payload>
x-agreed-price: 0.0018
x-consumer-address: 0xYourWallet
HTTP 200
{
"id": "abc123",
"title": "The Future of AI Micropayments",
"content": "<full article body>",
"txHash": "0xde3dbeef..."
}POST /api/agent/negotiate
Negotiate access price. Supports multi-round negotiation via sessionId.
POST /api/agent/negotiate
Content-Type: application/json
{
"articleId": "abc123",
"consumerAddress": "0xYourAgentWallet",
"offer": 0.001,
"sessionId": null
}
Response:
{
"decision": "counter",
"price": 0.0018,
"counterOffer": 0.0018,
"reasoning": "Score 50/100, no discount. Counter at min price $0.0018.",
"sessionId": "sess_xyz...",
"rounds": [...],
"agreed": false
}| Decision | Meaning | Agent Action |
|---|---|---|
| accept | Price agreed | Pay the returned price via x402 |
| counter | Publisher wants more | Submit new offer with returned sessionId |
| reject | No deal possible | Skip this article |
x402 Payment Flow
Use ExactEvmSchemeV1 from @x402/evm/v1:
import { wrapFetchWithPaymentFromConfig } from '@x402/fetch';
import { ExactEvmSchemeV1 } from '@x402/evm/v1';
import { toClientEvmSigner } from '@x402/evm';
// Setup once
const signer = toClientEvmSigner(account, publicClient);
const x402Fetch = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: 'base-sepolia', client: new ExactEvmSchemeV1(signer), x402Version: 1 }],
});
// Auto-handles 402 → signs EIP-3009 → retries
const res = await x402Fetch('https://parley-protocol.vercel.app/api/content/abc123');ERC-8004 Reputation Registry
| Field | Value |
|---|---|
| Contract | 0xb0088D1300E10CF5AAC0d21c9d434885dCE2D305 |
| Network | Base Sepolia (chain ID 84532) |
| Read function | getReputation(address) → (score, totalDeals, exists) |
| Write function | updateReputation(address, dealSuccess) |
| Score Range | Price Effect |
|---|---|
| ≥ 80 | 20% discount applied |
| ≥ 60 | 10% discount applied |
| 40 – 59 | No adjustment |
| < 40 | 10% premium applied |