AgentScore

AgentScore

Gate AI agent escrow payments with credential verification

Gate AI agent escrow payments with credential verification

Jun 10, 20264 min readBy AgentScore Examples

AI agents accessing real estate escrow systems risk fraud through impersonation and credential spoofing without verification. AgentScore enables merchants to gate high-value transactions by verifying buyer credentials and agent reputation before payment execution. Use AgentScore sessions and credential verification to build authorization checks into autonomous agent workflows. Real estate closings require jurisdictional compliance; AgentScore's reputation system provides risk signals for escrow gating.

What this tutorial covers

  • Outcome: You will implement a credential-verified payment gate that blocks unauthorized AI agents from accessing escrow transactions.
  • Endpoints used: `POST /v1/sessions`, `POST /v1/credentials`, `GET /v1/reputation/{address}`
  • Language: typescript
  • Auth: API key
  • Estimated implementation time: ~15 minutes

Step 1: Initialize an AgentScore session for escrow transaction gating

Create a session to bind an AI agent identity to a specific escrow payment request. Sessions in AgentScore track agent context and enable credential verification before transaction approval.

Create a session object

typescript
1import fetch from 'node-fetch';
2
3const apiKey = process.env.AGENTSCORE_API_KEY;
4const baseUrl = 'https://api.agentscore.sh/v1';
5
6const sessionPayload = {
7  context: "escrow_transaction",
8  product_name: "Escrow Payment Request"
9};
10
11const sessionResponse = await fetch(`${baseUrl}/sessions`, {
12  method: 'POST',
13  headers: {
14    'Authorization': `Bearer ${apiKey}`,
15    'Content-Type': 'application/json'
16  },
17  body: JSON.stringify(sessionPayload)
18}).then(res => res.json());
19
20const session_id = sessionResponse.session_id;
21const verify_url = sessionResponse.verify_url;
22const poll_url = sessionResponse.poll_url;
23const poll_secret = sessionResponse.poll_secret;
24
25console.log('AgentScore session created for escrow gating:', { session_id, verify_url });
26console.log('Agent identity binding initiated for escrow payment transaction');
27
28export { session_id, verify_url, poll_url, poll_secret };

Step 2: Register operator credentials with AgentScore for escrow authority

Submit the escrow operator's verifiable credentials—license, jurisdiction registration, and legal entity proof. AgentScore's credential system stores and cryptographically signs operator metadata to prevent spoofing.

Store operator credentials

json
1{
2  "account_verification": {
3    "kyc_status": "verified",
4    "kyc_verified_at": "2026-04-07T17:13:56.525Z",
5    "jurisdiction": "US",
6    "age_verified": true,
7    "age_bracket": "21+",
8    "sanctions_clear": true,
9    "sanctions_checked_at": "2026-04-07T17:13:56.525Z",
10    "operator_type": "individual"
11  },
12  "credentials": [
13    {
14      "id": "uuid",
15      "prefix": "opc_abc1",
16      "label": "claude-code-agent",
17      "expires_at": "2026-04-10T12:00:00Z",
18      "last_used_at": "2026-04-09T14:30:00Z",
19      "created_at": "2026-04-09T12:00:00Z"
20    }
21  ]
22}

Response:

json
1{
2  "id": "uuid",
3  "credential": "opc_abc123...",
4  "prefix": "opc_abc1",
5  "label": "claude-code-agent",
6  "expires_at": "2026-04-10T12:00:00Z",
7  "created_at": "2026-04-09T12:00:00Z",
8  "agent_memory": {
9    "pattern_summary": "...",
10    "identity_paths": { "...": "..." },
11    "bootstrap": { "...": "..." },
12    "do_not_persist_in_memory": ["operator_token", "poll_secret"],
13    "persist_in_credential_store": ["operator_token"]
14  }
15}

Step 3: Check agent reputation to assess escrow payment risk with AgentScore

Query the agent's on-chain reputation score and historical transaction data before releasing escrow funds. AgentScore's reputation endpoint surfaces fraud signals and compliance violations that block high-risk agent access.

Fetch agent reputation

typescript
1import { AgentScore } from '@agentscore/sdk';
2
3const client = new AgentScore({ api_key: process.env.AGENTSCORE_API_KEY });
4
5// Check agent reputation before releasing escrow funds
6const agentContext = {
7  context: "escrow_payment_risk_assessment",
8  product_name: "agent_reputation_check"
9};
10
11const session = await client.post(
12  "https://api.agentscore.sh/v1/sessions",
13  agentContext
14);
15
16const session_id = session.session_id;
17const poll_secret = session.poll_secret;
18const poll_url = session.poll_url;
19
20let poll_response = { status: "pending" };
21while (poll_response.status === "pending") {
22  await new Promise(resolve => setTimeout(resolve, 5000));
23  poll_response = await client.get(poll_url, {
24    headers: { "X-Poll-Secret": poll_secret }
25  });
26}
27
28if (poll_response.status === "verified") {
29  console.log("Agent reputation verified. Safe to release escrow funds.");
30} else if (poll_response.status === "flagged") {
31  throw new Error("Fraud signals or compliance violations detected. Blocking escrow release.");
32} else {
33  throw new Error(`Reputation check failed with status: ${poll_response.status}`);
34}

Response:

json
1{
2  "session_id": "sess_abc123...",
3  "status": "verified",
4  "operator_token": "opc_newtoken...",
5  "completed_at": "2026-04-09T12:30:00Z",
6  "token_ttl_seconds": 86400,
7  "next_steps": {
8    "action": "retry_merchant_request_with_operator_token",
9    "header_name": "X-Operator-Token",
10    "user_message": "Verification complete. Retry the original merchant request with X-Operator-Token set to the operator_token value."
11  }
12}

Step 4: Implement escrow payment gate middleware in agent workflow

Wrap agent escrow execution with AgentScore checks before allowing fund release. This middleware pattern ensures every escrow transaction is credential-verified and reputation-gated.

Middleware gate implementation

json
1{
2  "subject": {
3    "address": "0xdb5aa553feeb2c3e3d03e8360b36fb0f7e480671",
4    "chains": ["base", "ethereum"]
5  },
6  "score": {
7    "value": 68,
8    "grade": "B",
9    "scored_at": "2026-03-10T12:00:00Z",
10    "status": "scored",
11    "version": "v1"
12  },
13  "verification_level": "kyc_verified",
14  "chains": [
15    {
16      "chain": "base",
17      "score": {
18        "value": 68,
19        "grade": "B",
20        "confidence": 0.85,
21        "dimensions": {
22          "identity": 85,
23          "activity": 35,
24          "capability": 70,
25          "reach": 50,
26          "trust": 72
27        },
28        "scored_at": "2026-03-10T12:00:00Z",
29        "status": "scored",
30        "version": "v1"
31      },
32      "classification": {
33        "entity_type": "agent",
34        "confidence": 0.92,
35        "is_known": true,
36        "is_known_erc8004_agent": true,
37        "has_candidate_payment_activity": true,
38        "has_verified_payment_activity": false,
39        "reasons": ["erc8004_registered", "has_endpoints"]
40      },
41      "identity": {
42        "ens_name": null,
43        "website_url": "https://paybot.example.com",
44        "github_url": null
45      },
46      "activity": {
47        "total_candidate_transactions": 142,
48        "total_verified_transactions": 0,
49        "as_candidate_payer": 80,
50        "as_candidate_payee": 62,
51        "as_verified_payer": 0,
52        "as_verified_payee": 0,
53        "counterparties_count": 17,
54        "active_days": 45,
55        "active_months": 3,
56        "first_candidate_tx_at": "2026-01-15T08:30:00Z",
57        "last_candidate_tx_at": "2026-03-10T10:22:00Z",
58        "first_verified_tx_at": null,
59        "last_verified_tx_at": null
60      },
61      "evidence_summary": {
62        "metadata_kind": "https",
63        "has_a2a_agent_card": false,
64        "website_url": "https://paybot.example.com",
65        "website_reachable": true,
66        "website_mentions_mcp": false,
67        "website_mentions_x402": false,
68        "github_url": null,
69        "github_stars": null
70      }
71    }
72  ],
73  "operator_score": {
74    "score": 68,
75    "grade": "B",
76    "agent_count": 3,
77    "chains_active": ["base", "ethereum"]
78  },
79  "reputation": {
80    "feedback_count": 150,
81    "client_count": 3,
82    "trust_avg": 68.5,
83    "uptime_avg": 99.2,
84    "activity_avg": 35.0,
85    "last_feedback_at": "2026-03-28T12:00:00Z"
86  },
87  "agents": [
88    {
89      "token_id": 42,
90      "chain": "base",
91      "name": "PayBot",
92      "score": 68,
93      "grade": "B"
94    }
95  ],
96  "data_semantics": "candidate_payment_activity_with_verified_subset",
97  "caveats": [],
98  "updated_at": "2026-03-10T12:00:00Z"
99}

The middleware returns true only if session creation, credential verification, and reputation checks all pass, blocking unauthorized agents from accessing escrow funds.

Common pitfalls when using AgentScore

  • Ignoring jurisdiction-specific escrow rules. Escrow practices and closing terminology vary across states (CA, TX, NY have different requirements). Always validate against jurisdictional counsel and include jurisdiction in both session creation and credential checks to avoid non-compliance.
  • Trusting agent identity without out-of-band verification. AI-enabled fraud in real estate includes agent impersonation and spoofed caller IDs. Never rely solely on wallet signatures; pair AgentScore reputation checks with external credential verification (license databases, state bar lookups) before escrow execution.
  • Treating third-party agent integrations as trusted execution paths. If your agent connects to external services (GitHub, Slack, Gmail), gate those integrations separately. AgentScore credential verification applies to the payment layer; you must add authorization checks at integration boundaries.
  • Setting reputation thresholds too low or too high. A threshold of 750+ works for most USD500k+ escrows, but your risk tolerance may differ. Test thresholds against your historical fraud and chargeback data; adjust dynamically per transaction size and property value.

Ready to secure your agent-based escrow platform? Deploy credential gating and reputation checks with AgentScore today.

Documentation references

The code examples in this tutorial are grounded in the following docs pages:

Ready to power your agents with secure commerce?

Join innovators using AgentScore to accept payments, verify buyers, and ensure compliance for every AI-driven transaction.

Read More Blog Posts

AgentScoreAgentScore

Commerce infrastructure insights for agent developers.

© 2026 AgentScore. All rights reserved.