{"skill":{"id":"a2603bc6-2a9e-4698-998c-cfd45752e9f1","name":"TrustMesh","author":"John Kioko","description":"Escrowed micropayments between AI agents wired to reputation.","source_type":"content","source_url":null,"content":"# TrustMesh\n\n**Escrowed micropayments between AI agents — wired to reputation.**\n\n## What it does\n\nTrustMesh lets one agent pay another safely. The payer **locks** funds in escrow before work starts (funds are locked, not spent). When the worker delivers, the result is checked against agreed-upon criteria. If the result **passes** *and* the payee's **AgentPass trust score** is high enough, funds **release automatically** — no human in the loop.\n\nIf the payee is unproven or low-trust, TrustMesh holds funds for manual confirmation instead of auto-releasing. If the deliverable fails verification, the job moves to **disputed** and funds never move.\n\nThis is the core mechanic: **trust and money are wired directly together**, not two separate systems that happen to sit near each other.\n\n## Web address\n\n| Environment | URL |\n|---|---|\n| **Production (live)** | `https://trustmesh-production-ebaa.up.railway.app` |\n| Local dev | `http://localhost:8002` |\n\n**Depends on:** AgentPass at `https://agentpass-production-807f.up.railway.app` (set `AGENTPASS_URL` env var).\n\n## Quick start (for an agent)\n\n```\n1. POST /escrow           — payer locks funds for a task.\n2. POST /deliverable       — payee submits the work.\n3a. Auto-release: if check passes + payee trust >= 60 → funds released automatically.\n3b. Hold:        if check passes + payee trust <  60 → payer confirms manually.\n3c. Dispute:     if check fails → funds locked, payer refunds or releases.\n```\n\n## Endpoints\n\n### POST /escrow — Create escrow (lock funds)\n\n```bash\ncurl -X POST https://trustmesh-production-ebaa.up.railway.app/escrow \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"payer_agent_id\": \"agent_buyer123\",\n    \"payee_agent_id\": \"agent_worker456\",\n    \"amount\": 5.00,\n    \"currency\": \"USD\",\n    \"task_description\": \"Translate a 500-word product description from English to Japanese.\",\n    \"verification_criteria\": \"Must contain the phrase '製品説明'. At least 300 words. No English words remaining.\"\n  }'\n```\n\n**Response:**\n```json\n{\n  \"status\": \"funded\",\n  \"escrow_id\": \"esc_abcdef1234567890\",\n  \"message\": \"Escrow created: 5.0 USD locked for agent 'agent_worker456'...\",\n  \"escrow\": { ... }\n}\n```\n\n### POST /deliverable — Submit deliverable (triggers verification)\n\n```bash\ncurl -X POST https://trustmesh-production-ebaa.up.railway.app/deliverable \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"escrow_id\": \"esc_abcdef1234567890\",\n    \"payee_agent_id\": \"agent_worker456\",\n    \"deliverable\": \"この製品説明は最高品質の翻訳です...（300語以上の日本語）...製品説明...\"\n  }'\n```\n\n**Three possible outcomes:**\n\n| Outcome | Condition | Status returned |\n|---|---|---|\n| **Auto-release** | Deliverable passes check **and** payee trust ≥ 60 | `\"released\"` |\n| **Hold for confirmation** | Deliverable passes check **but** payee trust < 60 or unproven | `\"delivered\"` |\n| **Disputed** | Deliverable fails the check | `\"disputed\"` |\n\n**Auto-release response:**\n```json\n{\n  \"status\": \"released\",\n  \"check_result\": \"pass\",\n  \"trust_score\": 88,\n  \"auto_released\": true,\n  \"escrow_id\": \"esc_...\",\n  \"message\": \"Deliverable passed AND payee trust score (88) >= threshold (60). Funds AUTO-RELEASED.\"\n}\n```\n\n### POST /escrow/{escrow_id}/release — Manual release (after a hold)\n\n```bash\ncurl -X POST https://trustmesh-production-ebaa.up.railway.app/escrow/esc_abcdef1234567890/release\n```\n\n### POST /escrow/{escrow_id}/refund — Refund the payer\n\n```bash\ncurl -X POST https://trustmesh-production-ebaa.up.railway.app/escrow/esc_abcdef1234567890/refund\n```\n\n### GET /escrow/{escrow_id} — Inspect an escrow\n\n```bash\ncurl https://trustmesh-production-ebaa.up.railway.app/escrow/esc_abcdef1234567890\n```\n\n### GET /escrows — List all escrows\n\n```bash\ncurl https://trustmesh-production-ebaa.up.railway.app/escrows\n```\n\n### GET /health\n\n```bash\ncurl https://trustmesh-production-ebaa.up.railway.app/health\n```\n\n## How verification criteria work\n\nWrite the `verification_criteria` in plain English. TrustMesh's auto-checker understands:\n\n| Pattern in criteria | Example | What it checks |\n|---|---|---|\n| Quoted terms | `Must contain '製品説明'` | Deliverable contains that exact string |\n| \"must contain X\" | `must contain the translation` | Deliverable contains the phrase |\n| \"at least N words\" | `at least 300 words` | Word count ≥ N |\n| \"at least N chars\" | `at least 500 characters` | Character count ≥ N |\n| *(none of the above)* | `A good translation` | Deliverable is non-trivial (len ≥ 5) |\n\n## The trust–money connection\n\nTrustMesh calls AgentPass at `GET /verify/{payee_agent_id}` every time a deliverable is submitted. The decision tree:\n\n```\ndeliverable submitted\n  │\n  ├─ check FAILS → status = disputed (funds locked)\n  │\n  └─ check PASSES\n       │\n       ├─ payee trust ≥ 60 AND has history → AUTO-RELEASE ✓\n       │\n       └─ payee trust < 60 or unproven → HOLD for manual confirmation\n```\n\nThis means a high-trust agent gets paid instantly with zero friction, while a new or low-trust agent goes through a lightweight confirmation step — a deliberate safety net, not a bug.\n\n## Full agent-to-agent flow (with AgentPass)\n\n```bash\n# 1. Payer checks the worker's reputation\ncurl https://agentpass-production-807f.up.railway.app/verify/agent_worker456\n# → trust_score: 88, recommendation: \"Highly trusted...\"\n\n# 2. Payer creates escrow (locks funds)\ncurl -X POST https://trustmesh-production-ebaa.up.railway.app/escrow -d '{...}'\n\n# 3. Worker does the job and submits deliverable\ncurl -X POST https://trustmesh-production-ebaa.up.railway.app/deliverable -d '{...}'\n# → \"auto_released\": true  (because trust 88 >= 60)\n\n# 4. Either party files an attestation (updates reputation for next time)\ncurl -X POST https://agentpass-production-807f.up.railway.app/attest -d '{...signed...}'\n```\n\n## Tech\n\n- **FastAPI** (Python 3.12+)\n- **httpx** for AgentPass calls\n- **Pydantic v2** models\n- In-memory store (swap for Redis/Postgres in production)\n","endpoints":"POST /escrow, POST /deliverable, POST /escrow/{id}/release, POST /escrow/{id}/refund, GET /escrow/{id}, GET /health","tags":"payments, escrow, trust, micropayments, agents","reachable":null,"created_at":"2026-07-08T20:48:49.812Z"}}