
autonomous-service-provider
io.github.AgentsForLives/autonomous-service-provider
Agent output audits and data services. Quote discovers x402 v2 checkout.
Documentation
Agents for Lives · Autonomous Service Provider
Data services and AI Quality Control for humans and agents. Standard services have x402 v2 self-service checkout on Base Sepolia with test USDC. Agents for Lives pledges 90% of net profits to humanitarian causes. For tailored work, subcontracting or recurring invoicing, contact agentsforlives@gmail.com.
| Service ID | Inputs and outputs | x402 pilot price | Manual quote |
|---|---|---|---|
csv-preflight | Comma-separated text → JSON audit of duplicates, missing values, inconsistent keys and widths | 0.05 test USDC | USD 2 |
json-validation | JSON text → syntax and required top-level keys report | 0.01 test USDC | USD 1 |
calendar-to-excel | Calendar CSV → XLSX with Events and Review sheets | 0.10 test USDC | USD 2 |
The Worker executes these services and the five AI Quality Control checks. Free demos use the same bounded execution path, with zero payment and synthetic or redacted data. Any larger job, customized integration, analysis or research is quoted separately and reviewed by Mission Control. For custom work, agree scope, deadline, AI use, acceptance criteria and payment terms in writing.
CSV Preflight ports the core checks from the original project. The calendar converter reuses the existing synthetic demo and its two-sheet layout. It accepts exported rows with local dates and explicit time zones, without a Google account or live calendar access. Dates are represented as Excel numbers and missing dates are flagged. The workbook contains no formulas, macros or external links.
Run and deploy
Use Node.js 24 and npm. The checked-in lockfile pins transitive dependencies.
npm ci
npx wrangler types
npm run typecheck
npm test
npm run dev
node scripts/smoke.mjs http://127.0.0.1:8787
Cloudflare Workers Builds deploys from main using npx wrangler deploy. The deploy uses a SQLite-backed Durable Object and the Workers rate-limit binding. Wrangler handles the initial SQLite migration. After the deployment, use the exact production URL shown under Settings → Domains & Routes and run node scripts/smoke.mjs https://<production-host>. The smoke script sends synthetic jobs, downloads the results, records acceptance and tests cross-order access as well as A2A/MCP discovery. It sends zero funds.
If there is no production build for the new commit, use Deployments → Builds → Retry build where available and confirm the attempt targets the current main commit. If GitHub fetch still fails, first confirm main exists and the Cloudflare GitHub app has access to this repository. For dashboard recovery see Cloudflare's build troubleshooting.
REST API
Discover service prices at GET /services.json, the schema at GET /openapi.json and health at GET /health.
Generate a fresh, cryptographically random 32-byte hex bearer token per order. Retain it privately. Use the same token and same JSON for retries. Order state and results remain accessible only with that token. Use the same hostname for all requests.
export AFL_BASE=http://127.0.0.1:8787
AFL_ORDER_TOKEN="$(openssl rand -hex 32)"
curl -fsS "$AFL_BASE/quote" -H 'Content-Type: application/json' \
-d '{"service":"json-validation"}'
curl -fsS "$AFL_BASE/orders" -H "Authorization: Bearer $AFL_ORDER_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"service":"json-validation","mode":"demo","input":"{\"customer_id\":\"0001\"}","options":{"required":["customer_id"]}}'
With the returned ID, use GET /orders/{id}, GET /orders/{id}/result and POST /orders/{id}/accept. CSV and calendar jobs take the CSV text in input. CSV options are required (headers that must have values) and key (column that identifies each record). JSON validation supports required for top-level names. Calendar format is shown here.
For a custom proposal, submit {"service":"custom","mode":"handoff","input":"Redacted scope under 1,000 characters"}, then email the order ID with deadline and requested deliverable. The operator retrieves the scope in the private queue. The handoff is a request for review.
A2A and MCP
- A2A 1.0 JSON-RPC. Discover
/.well-known/agent-card.json. SendA2A-Version: 1.0toPOST /a2a. CallSendMessagewithparams.message = {"messageId":"<client-generated-id>","role":"ROLE_USER","parts":[{"data":{"service":"json-validation","input":"{}"}}]}. Each order uses its own bearer token.GetTaskandListTasksuse the same token.SendMessagealso supports an indicative quote viadata: {"operation":"quote","service":"json-validation"}. Automatic work returns a completed task and an inline artifact. For stored paid/custom states, follow the order metadata and contact instructions. See the A2A specification. - MCP Streamable HTTP at
POST /mcp.server/discoverandtools/listare public. Modern clients sendMCP-Protocol-Version: 2026-07-28,Mcp-Method,Mcp-Namefor tool calls, and matching protocol metadata. Legacy initialization is available for 2025-11-25 and 2025-06-18. The tools arequote,place_order,get_orderandaccept_order. Pass the per-order bearer token through the transport's HTTP Authorization header, never as a tool argument. Clients that only configure a fixed header can use one token per connection/order, or use REST. See MCP Streamable HTTP.
x402 checkout
The catalog and the MCP/A2A quote include a concrete checkout URL for each standard service. Checkout uses the standard HTTP transport directly. The data in the request body is processed within the existing Worker.
- Generate a new random 32-byte bearer token and keep it private. POST {"input":"…","options":{…}} to /x402/
with Content-Type: application/json and the bearer token. The initial response carries PAYMENT-REQUIRED and the HTTP status 402. A read-only GET/HEAD returns the same offer without creating an order. - Configure the buyer's x402 v2 client for Base Sepolia (eip155:84532), native Circle test USDC and the exact scheme. Parse the offer and sign it. Repeat the same POST, including both the bearer token and the PAYMENT-SIGNATURE header. The service never needs access to the buyer's signing credentials.
- Read the JSON result and PAYMENT-RESPONSE header on HTTP 200. For Excel, decode result.base64 or fetch the binary artifact with GET /orders/{id}/result and the original bearer token. Results are available for 24 hours after order creation.
- On 202, follow Retry-After and resend the original signed request. Use the same token, body and signature on timeouts or 503. On 409, recover the original order and authorization. On 410 or a prolonged pending payment, use /payment-terms for support. Provide the order ID and transaction reference where available. Keep the bearer token, signature and job input private.
Settlement and accounting
The official x402.org facilitator handles Base Sepolia verification and submission. The Worker checks the native USDC receipt independently against the Base RPC, including canonical block, EIP-3009 authorization event, payer, recipient and exact transfer value. Mainnet would additionally require a finalized block. SQLite reserves the authorization for a single order before settlement, holds the result during confirmation and preserves the payment reference across retries and restarts. The settlement request carries payment details only.
The authenticated GET /operator/mission-control/revenue endpoint exposes gross mainnet totals for optional ISO 8601 from and to dates grouped by service in atomic USDC. It uses the existing OPERATOR_TOKEN and excludes testnet and demo orders. Mission Control uses these totals for reconciliation. Store verified fees, EUR accounting valuation, applicable taxes and net profit separately. Apply the 90% pledge to documented net profits. A technical receipt does not issue a tax invoice.
Release and distribution
Pause new payment offers and settlements by setting X402_PAUSE_NEW to "true" and redeploying on the same network. REST order and result endpoints remain available, and a retry can recover an already broadcast payment using the original order details. Reopen offers by removing the pause flag. Keep PayAI on the default free plan with no top-ups or paid credentials. Before any new Base mainnet settlement the Worker requires an available balance from PayAI for the exact receiving address and network. Low or exhausted credits, mismatched responses and upstream failures stop new settlements.
- Base Sepolia is the only enabled network. The listed Ethereum address is checksummed, is not a contract on either Base chain, and is not blacklisted by either native USDC contract, as checked on 26 November 2026. Before accepting real funds, the operator must verify control in a self-custody wallet or confirm that its custodian credits native USDC deposits on Base.
- PayAI supports exact on Base mainnet. Its public lane starts with free credits and stops settlement when exhausted. It is configured without credentials or top-ups. Check the published terms, current costs and the receiving wallet's free-credit status before any activation. x402.org's default facilitator is for test networks.
- Solana is a viable second rail. The official public facilitator supports Devnet and PayAI supports mainnet. Adding Solana requires validating the destination's associated token account (ATA), the canonical USDC mint, fee payer and finalized transaction instructions. PayAI may charge separately for ATA setup. Keep Base as the first rail to avoid this dependency.
- The launch prices of 0.01, 0.05 and 0.10 USDC follow a per-call model. The 0.01 USDC benchmark is observable in x402 listings. Keep pricing fixed during the pilot and consider volume invoicing for recurring customers after demand is measured. No automatic debit or subscription is configured.
- OpenAPI publishes fixed-price x-payment-info and /.well-known/x402 lists the routes. Verify x402scan registration requirements at commercial launch. Base mainnet offers declare x402 v2 Bazaar discovery with synthetic examples. A qualifying client must echo the declaration in its payment payload, and PayAI lists the POST resource after settlement. Coinbase's Bazaar uses its own facilitator/catalog. The testnet pilot does not publish a commercial listing or pay for directory admission.
- Before switching X402_MODE to mainnet, complete a successful incoming Base Sepolia purchase on the real chain and resolve the invoicing, supplier identification, VAT treatment (including B2B/B2C, place of supply and possible OSS), privacy and complaint terms for the intended buyers. For Spanish tax, see the AEAT invoicing guidance and electronic-service VAT guidance. If real payments are paused later, preserve open orders and reconcile any already settled receipts.
Supervised payments and custom handoff
The supervised invoice endpoint defaults to paused and is separate from x402. The published project mailbox handles written quotes and buyer contact. For supervised paid intake, configure a randomly generated 32-byte hexadecimal Worker secret OPERATOR_TOKEN in Settings → Variables and Secrets. Keep it in the operator's private environment. This is a service credential independent from any wallet.
- Confirm the scope and record the paid order ID in the written invoice, with deadline before the order expires. Specify the exact agreed mainnet, asset, address, amount in native units and confirmation threshold. The catalog lists the project's existing Ethereum, Solana and Bitcoin addresses as references.
- Independently verify the transaction against the invoice on the agreed mainnet. Verify success, recipient, asset, amount and finality. A customer-provided hash is only a reference. Use one receipt per order and do not request payment if the order's expiry cannot accommodate settlement.
- As the operator, submit the verified receipt and exact invoice amount in USD cents to
POST /operator/orders/{id}/verify-paymentwith the operator bearer credential. Example body format is{"receipt":"ethereum:0x<lowercase-64-hex>","amountCents":100}. The other prefixes arebitcoin:andsolana:. This is an operator attestation, not an automated blockchain check. The transaction in SQLite locks the unique receipt to one order and releases the result. Repeating the same attestation for that order is safe. Public requests cannot attest. - Register actual settlement with its currency and verified evidence in the private Mission Control record. Demos, customer-submitted hashes, estimates and acceptance alone do not produce revenue.
For custom orders, an authenticated operator can read GET /operator/handoffs, then transfer confirmed demand to the private Mission Control issue queue using asp:<32-hex-order-id> as the deduplication reference. Search open and closed issues before creating a record. Store only a redacted scope and authorized references. Demand Hunter confirms the customer and scope, Agent Business Network manages recurring partnerships, and Opportunity Executor takes accepted work with verified payment terms. Opportunity Radar keeps its existing discovery and queues. The Worker never pushes customer data to GitHub or starts a Work session directly.
Commercial options
- Direct invoicing supports the existing public wallets, with independent operator verification before release. Use it for the first paid pilot and recurring invoices. For recurring work, agree volume, acceptance criteria and one consolidated invoice before starting. For referrals or subcontracts, agree responsibilities and any revenue split in writing before exchanging client data.
- Distribution. Once live, the public Agent Card is eligible for review by A2A Cards. A remote-only listing can be submitted to the official MCP Registry using its GitHub namespace authentication. Existing partner discussions stay in their original threads.
Limits and privacy
The Worker caps request bodies at 16 KiB and input text at 8,192 UTF-16 units. It limits CSV to 200 records and 32 columns and calendar jobs to 100 events. An edge limiter targets 40 requests per minute per IP and location. The SQLite transaction enforces a global maximum of 200 new orders per UTC day. The Cloudflare Free plan quota still applies to all requests, including rejected ones. Production CPU and availability depend on Cloudflare. Workers limits · Durable Objects limits
Order data and results expire after 24 hours and are deleted by a Durable Object alarm. Verified receipt fingerprints and amounts are retained for financial reconciliation and replay protection. Avoid submitting confidential content during a demo or early quote. Result values are escaped or treated as inert data, and no user-provided code, URLs, command strings, external tools or LLM instructions are executed.
Sources: x402 v2 specification · Circle contracts · PayAI pricing · PayAI Bazaar · x402scan discovery.
No installation packages available.