Skip to content

Repository files navigation

Proctor

The bar exam for AI agents — an OKX.AI Agent Service Provider that examines marketplace agents with adversarial test batteries, grades them, and backs every verdict with a challengeable bond.

Tests TypeScript Vercel License

Live: proctor-flax.vercel.app

What Is Proctor?

Proctor is an ASP on the OKX.AI marketplace that grades other marketplace agents. It calls an agent's live A2MCP endpoint, fires a randomized exam battery at it (paying the target's per-call fees), and scores the responses through deterministic checks plus a three-judge LLM panel. The result is a report card with a letter grade, sub-scores, and a Proctor Bond — a capped USDT guarantee that says: if this grade is wrong, challenge it and get paid 2× your fee.

Built for the OKX.AI Genesis Hackathon (July 2026).

Features

Agent Competence Exam (~5 USDT)

Send an agent ID → Proctor classifies the target's category, runs a randomized exam battery against its live endpoint, and returns a graded report card. Every exam pays the target's own per-call fees as cost of goods.

Certified Agent Lookup (~0.02 USDT)

The pre-hire pre-flight check. Returns an agent's current grade, certification age, category rank, and bond backing — or UNGRADED if the agent hasn't been examined.

Proctor Bond

Every verdict carries a capped USDT bond and a 48-hour challenge window. A challenger pays a small fee to re-run the relevant exam section. If the grade was wrong, the challenger receives 2× their fee from the bond wallet and the grade is publicly downgraded — all backed by on-chain receipts.

Public Leaderboard

Read-only site showing graded agents, letter grades, sub-scores, bond amounts, and challenge history. Shareable report-card images.

API Reference

All endpoints are x402-gated — every request requires a valid payment header (PAYMENT-SIGNATURE).

Method Endpoint Price Description
POST /api/exam ~5 USDT Run a competence exam against a target agent
POST /api/lookup ~0.02 USDT Look up an agent's grade and bond status
POST /api/challenge ~0.05 USDT Challenge a verdict (48h window)
GET /api/site Free Leaderboard, agent details, challenge history
GET /api/card Free Render a report-card SVG image

Exam Request

POST /api/exam
Content-Type: application/json
X-PAYMENT: <x402 payment header>

{
  "targetAgentId": "2135",
  "seed": 7
}

Exam Response

{
  "grade": "B",
  "overall": 82.0,
  "subScores": {
    "accuracy": 75,
    "freshness": 90,
    "injectionResistance": 85,
    "schemaCompliance": 78,
    "latency": 80
  },
  "receiptHash": "0x...",
  "cardImageUrl": "https://proctor-flax.vercel.app/api/card?...",
  "bond": {
    "amountUsdt": 10.0,
    "expiresAt": "2026-07-17T16:00:00Z",
    "remainingUsdt": 10.0
  }
}

Lookup Request

POST /api/lookup
Content-Type: application/json
X-PAYMENT: <x402 payment header>

{
  "targetAgentId": "2135"
}

Exam Battery

The on-chain research category includes these probe types:

  • Known-answer — factual questions with verifiable correct answers
  • Freshness — time-sensitive queries requiring recent data
  • Malformed-input — edge-case inputs testing robustness
  • Injection — prompt injection probes testing safety boundaries

Each exam runs a seeded random sample from the battery. Grading combines deterministic checks (schema compliance, latency thresholds, source verification) with a three-judge LLM panel scoring accuracy, freshness, and injection resistance independently.

Tech Stack

Layer Technology
Runtime TypeScript 5.7, Node.js
Server Express 5, Vercel serverless
Payments x402 v2 protocol (OKX SDK), X Layer USDT
Settlement @okxweb3/x402-express, @okxweb3/x402-evm
Judge LLM Anthropic Claude (Messages API)
Store Vercel Blob (durable JSON snapshots)
Identity ERC-8004 ASP on OKX.AI

Project Structure

api/              Vercel serverless entrypoints
  card.ts         Report-card SVG renderer
  challenge.ts    Challenge endpoint
  exam.ts         Exam endpoint
  lookup.ts       Lookup endpoint
  site.ts         Leaderboard site
src/
  api/            Handler implementations, adapter, Express server
  bond/           Proctor Bond ledger (issue, challenge, resolve)
  deps/           Dependency wiring (judges, registry, facilitator, payer)
  exam/           Exam engine (runner, grader, bank)
  payments/       x402 payment gate
  site/           Site rendering, report cards
  store/          Durable store (Vercel Blob + in-memory fallback)
  config.ts       Environment config loader
test/             Vitest test suite (105 tests)
listing/          OKX.AI listing copy and assets
scripts/          Development scripts

Running Locally

# Install dependencies
npm install

# Set up environment
cp .env.example .env
# Edit .env with your keys

# Run typecheck
npm run typecheck

# Run tests
npm test

# Start dev server
npx vercel dev

Environment Variables

See .env.example for the full list. The critical ones:

Variable Purpose
PAY_TO_ADDRESS Proctor's x402 settlement address
USDT_ASSET_ADDRESS USDT contract on X Layer
OKX_API_KEY OKX API credentials for settlement
JUDGE_API_KEY Anthropic API key for the judge panel
EVM_PRIVATE_KEY Burn wallet for paying target agents
BLOB_READ_WRITE_TOKEN Vercel Blob for durable storage
PUBLIC_BASE_URL Production deployment URL

Deployment

Deployed on Vercel. The vercel.json routes / to the leaderboard site and maps /api/* to serverless functions.

vercel --prod

Requires the environment variables above set in the Vercel dashboard.

Consent Policy

  • Owner-requested exams are full and public
  • Unsolicited exams publish passing grades only; failing owners are notified privately with a free re-test window

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages