Install
openclaw skills install ag9Use AG9 to register and verify AI agents with VeryAI Palm-backed human ownership, generate or load portable Ed25519 identities for OpenClaw, Codex, local CLI/MCP, browser, or cloud agents, call AG9 registration/signature verification APIs, and solve reverse-CAPTCHA capability challenges.
openclaw skills install ag9ag9 proves two things about an agent that no other layer proves together:
Both live at https://api.ag9.ai. Note the two base URLs:
https://api.ag9.ai/v1/agent/...https://api.ag9.ai/challenge, /verify, and /.well-known/jwks.json at the root (not under /v1) to match existing OpenClaw/monkey-api integrations.This URL split is intentional, not a typo — both endpoints are served by the same ag9-api service.
~/.openclaw/identity/device.json (read). Used first when present. OpenClaw owns this identity file.~/.ag9/identity.json (read/write). Used when OpenClaw identity is absent. The skill may create this file with a stable deviceId, publicKeyPem, and privateKeyPem.deviceId, base64 publicKey, message, signature, and timestamp are sent to ag9. Path B (reverse CAPTCHA) does not touch identity files.https://api.ag9.ai.CRITICAL: Never open browsers
Do not use
open,xdg-open,start, or any command that opens a browser. Always output the registration URL as a text or markdown link for the user to click.
- WRONG:
open "https://api.very.org/oauth2/..."- CORRECT: "Open this link to complete verification: https://api.very.org/oauth2/..."
| File | Purpose |
|---|---|
| SKILL.md | Installed skill instructions for registration, reverse CAPTCHA, verification, and API usage |
| Identity | ~/.openclaw/identity/device.json or ~/.ag9/identity.json — deviceId and keys (never send private key) |
publicKey, message, and signature./verify. Public key at GET /.well-known/jwks.json so any party can verify offline.Use this when you need a third party to know the agent is owned by a verified human.
The AgentChallenge is a signed payload that shows you control an Ed25519 key. It has the shape used by standard OpenClaw identity flows: deviceId, publicKey, message, signature, timestamp. Generate it once and send it to /agent/register/init or /agent/verify/signature.
Resolve identity in this order:
AG9_DEVICE_ID and private/public key env vars exist, use them. This is the right path for Vercel, AWS, GCP, Cloudflare, and other hosted agents.~/.openclaw/identity/device.json exists, use it.~/.ag9/identity.json. This is the default for Codex, local CLI agents, local MCP servers, and other agents without a native identity store.If you run on OpenClaw, device identity is stored at:
~/.openclaw/identity/device.jsonThat file contains (never send privateKeyPem to any server):
| Field | Use |
|---|---|
deviceId | Use as deviceId in the challenge. Stable id for this agent/device. |
publicKeyPem | Use to derive publicKey (see below). |
privateKeyPem | Use only locally to sign the message. Never include in API requests. |
If you do not use OpenClaw, the recommended local identity path is:
~/.ag9/identity.jsonUse the same shape:
{
"deviceId": "ag9_agent_...",
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----\n",
"privateKeyPem": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"createdAt": "2026-05-12T00:00:00.000Z",
"provider": "ag9-local",
"label": "local-agent"
}
For cloud agents, do not write this file on ephemeral disk. Generate the same identity once during provisioning and store deviceId, publicKeyPem, and privateKeyPem in the cloud secret manager. The runtime should load those values from environment variables or mounted secrets:
AG9_DEVICE_ID=ag9_agent_...
AG9_PUBLIC_KEY_PEM_B64=base64-encoded-public-pem
AG9_PRIVATE_KEY_PEM_B64=base64-encoded-private-pem
Plain multiline AG9_PUBLIC_KEY_PEM and AG9_PRIVATE_KEY_PEM are also valid when the platform supports multiline secrets.
Choose the message to sign For registration, use a one-time challenge to avoid replay, e.g.:
ag9-register-<unix_timestamp_ms>
Example: ag9-register-1776646678000
For verify/signature, the message is whatever you are proving (e.g. a nonce from a third party).Sign the message with your Ed25519 private key. The signature must be over the exact UTF-8 bytes of message (no extra prefix/suffix).
Encode for the API:
Date.now()).JSON body (AgentChallenge):
deviceId — from your identity (e.g. device.json)publicKey — base64 DER SPKImessage — exact string that was signedsignature — base64 signaturetimestamp — number (ms)~/.ag9const crypto = require("crypto");
const fs = require("fs");
const path = require("path");
function base64url(buffer) {
return Buffer.from(buffer)
.toString("base64")
.replace(/\+/g, "-")
.replace(/\//g, "_")
.replace(/=+$/g, "");
}
function pemFromEnv(name) {
if (process.env[name]) {
return process.env[name];
}
const b64 = process.env[`${name}_B64`];
return b64 ? Buffer.from(b64, "base64").toString("utf8") : "";
}
function loadOrCreateIdentity() {
const envIdentity = {
deviceId: process.env.AG9_DEVICE_ID,
publicKeyPem: pemFromEnv("AG9_PUBLIC_KEY_PEM"),
privateKeyPem: pemFromEnv("AG9_PRIVATE_KEY_PEM"),
provider: "ag9-env",
};
if (envIdentity.deviceId && envIdentity.publicKeyPem && envIdentity.privateKeyPem) {
return envIdentity;
}
const openClawPath = path.join(process.env.HOME, ".openclaw/identity/device.json");
if (fs.existsSync(openClawPath)) {
return JSON.parse(fs.readFileSync(openClawPath, "utf8"));
}
const ag9Path = path.join(process.env.HOME, ".ag9/identity.json");
if (fs.existsSync(ag9Path)) {
return JSON.parse(fs.readFileSync(ag9Path, "utf8"));
}
const { publicKey, privateKey } = crypto.generateKeyPairSync("ed25519");
const publicKeyDer = publicKey.export({ type: "spki", format: "der" });
const fingerprint = base64url(crypto.createHash("sha256").update(publicKeyDer).digest()).slice(0, 32);
const identity = {
deviceId: `ag9_agent_${fingerprint}`,
publicKeyPem: publicKey.export({ type: "spki", format: "pem" }),
privateKeyPem: privateKey.export({ type: "pkcs8", format: "pem" }),
createdAt: new Date().toISOString(),
provider: "ag9-local",
label: "local-agent",
};
fs.mkdirSync(path.dirname(ag9Path), { recursive: true, mode: 0o700 });
fs.writeFileSync(ag9Path, JSON.stringify(identity, null, 2), { mode: 0o600 });
return identity;
}
const identity = loadOrCreateIdentity();
const message = `ag9-register-${Date.now()}`;
const privateKey = crypto.createPrivateKey(identity.privateKeyPem);
const signature = crypto.sign(null, Buffer.from(message, "utf8"), privateKey);
const publicKeyDer = crypto
.createPublicKey(identity.publicKeyPem)
.export({ type: "spki", format: "der" });
const challenge = {
deviceId: identity.deviceId,
publicKey: publicKeyDer.toString("base64"),
message,
signature: signature.toString("base64"),
timestamp: Date.now(),
};
// POST challenge to https://api.ag9.ai/v1/agent/register/init
If you have a script that already produces an AgentChallenge (e.g. signs a message and outputs JSON with deviceId, publicKey, message, signature, timestamp), you can reuse it for ag9:
ag9-register-$(date +%s)000 (seconds + "000" for ms) or use your script's convention.https://api.ag9.ai/v1/agent/register/init.Same challenge format works for POST /agent/verify/signature when verifying a signature remotely.
Build an AgentChallenge as above, then send it to ag9 to create a session and get a registration URL.
curl -X POST https://api.ag9.ai/v1/agent/register/init \
-H "Content-Type: application/json" \
-d '{
"deviceId": "my-agent-device-id",
"publicKey": "<base64-DER-SPKI-Ed25519>",
"message": "ag9-register-1776646678000",
"signature": "<base64-Ed25519-signature>",
"timestamp": 1776646678000
}'
Response (201):
sessionId — use to poll statusregistrationUrl — output this as a link for the human; do not open it in a browserexpiresAt — session expiry (ISO 8601)If the agent is already registered (deviceId exists), the API returns 409 Conflict.
Tell the human owner to open the registrationUrl in their browser. They will go through VeryAI's palm verification via OAuth. When they finish, the agent is registered under their ownership.
Poll until the human has completed or the session has expired:
curl "https://api.ag9.ai/v1/agent/register/SESSION_ID/status"
Response: status is one of pending | completed | expired | failed. When status is completed, the response includes deviceId and registration (e.g. publicKey, registeredAt).
curl -X POST https://api.ag9.ai/v1/agent/verify/signature \
-H "Content-Type: application/json" \
-d '{
"deviceId": "...",
"publicKey": "...",
"message": "...",
"signature": "...",
"timestamp": 1776646678000
}'
Response: verified (signature valid), registered (agent under verified human).
curl "https://api.ag9.ai/v1/agent/verify/device/DEVICE_ID"
Response: registered, verified, humanId, and optionally registeredAt.
curl "https://api.ag9.ai/v1/agent/verify/public-key/$(printf '%s' "$PUBKEY_B64" | jq -sRr @uri)"
Use this when a relying party needs to confirm the requester is a capable agent (not a naive script), independent of any human binding. Stateless, no account needed.
| Method | Path | Purpose |
|---|---|---|
| POST | /challenge | Issue a single-use HMAC-signed challenge (15s TTL). |
| POST | /verify | Submit {token, solution}; receive an Ed25519-signed capability JWT. |
| GET | /.well-known/jwks.json | Public key (JWKS) for offline JWT verification. |
These live at the root, not under /v1, to match existing OpenClaw/monkey-api integrations.
curl -s -X POST https://api.ag9.ai/challenge \
-H "Content-Type: application/json" -d '{}'
Optional ?type=byte_transform|structured_extraction|constrained_gen pins the family. Omit for random.
Response (200):
{
"challenge_id": "string",
"challenge_type": "byte_transform | structured_extraction | constrained_gen",
"difficulty": "medium",
"payload": { /* shape depends on challenge_type — see below */ },
"token": "base64url-encoded HMAC-signed token carrying the answer hash",
"expires_at": 1776646678,
"time_limit_secs": 30
}
Compute the answer from payload (family-specific — see next section). Submit:
curl -s -X POST https://api.ag9.ai/verify \
-H "Content-Type: application/json" \
-d '{ "token": "...", "solution": "..." }'
Response (200):
{
"success": true,
"jwt": "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9..."
}
The JWT is a capability attestation the relying party can verify offline using the public key at /.well-known/jwks.json. Claims include iss (api.ag9.ai), sub (agent_capability_attestation), challenge_type, difficulty, solved_at, solve_time_ms.
byte_transform{
"data": "<base64 of 256 random bytes>",
"instructions": [
"Transform every byte by XOR-ing it with 19 (decimal).",
"Rotate all bytes left by 192 positions (with wraparound).",
"Starting at byte 5, going up to byte 66, reverse the sub-array end to end."
]
}
Answer: Apply the transforms in order to the decoded bytes, then return sha256(final_bytes) as lowercase hex (64 chars). Typical approach: LLM writes Python, agent executes it. Time limit 30s.
structured_extraction{
"document": "<malformed HTML/JSON/XML blob with authoritative and decoy values>",
"fields": ["author_name", "price_usd", "publish_date"]
}
Answer: Extract each field's authoritative value, join with | (pipe), in the exact order listed. The document mixes current and stale/decoy values of the same type. Context clues to prefer: data-verified="true", data-primary="true", data-source="authoritative", data-kind="live", id="product-current", <section data-kind="live">, <item status="current">, <main>. Clues to avoid: id="product-archive", status="draft", data-kind="historical", <aside>, display:none, <noscript>, HTML comments. Fields can live in <script type="application/json"> or <meta> tags — read them, decide by attributes. Time limit 30s.
constrained_gen{
"topic": "ocean waves",
"lines": 4,
"ascii_target": 419,
"word_count": 20,
"difficulty": "medium"
}
Answer: A plain-text block of exactly lines non-empty lines totaling word_count words, where the sum of ASCII codes of the first character of each trimmed line equals ascii_target (lowercase a=97 through z=122). Recommended approach: choose first letters l_1..l_n such that sum(ord(l_i)) == ascii_target, each in [97, 122]; then pad with short filler words until word_count is reached. Time limit 20s.
Any relying party can verify the attestation without calling ag9 back:
curl -s https://api.ag9.ai/.well-known/jwks.json
Then verify the JWT signature using the returned Ed25519 public key. Cache-Control is public, max-age=3600.
| Need | Path |
|---|---|
| Prove a human owns this agent | A — registration + /agent/verify/device/{deviceId} |
| Prove a capable LLM is operating (no human/account needed) | B — /challenge + /verify |
| Prove both | Run A first, then B on each outbound request |
| Third-party wants to check your agent | They call either /agent/verify/device/{id} (A) or accept a JWT you present (B) |
Base URL: https://api.ag9.ai/v1 (human-ownership endpoints)
Base URL (root): https://api.ag9.ai (reverse-CAPTCHA endpoints)
Local: http://localhost:3000
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /v1/agent/register/init | None | Start registration session; returns sessionId, registrationUrl, expiresAt. |
| GET | /v1/agent/register/{sessionId}/status | None | Poll registration status: pending / completed / expired / failed. |
| POST | /v1/agent/verify/signature | None | Verify a signature and whether the agent is registered under a verified human. |
| GET | /v1/agent/verify/device/{deviceId} | None | Get agent registration and verification status by device id. |
| GET | /v1/agent/verify/public-key/{publicKey} | None | Get agent registration and verification status by Ed25519 public key (base64url). |
| GET | /v1/human/leaderboard | None | Top verified humans ranked by registered agents. |
| POST | /challenge[?type=...] | None | Issue a single-use reverse-CAPTCHA challenge. |
| POST | /verify | None | Submit {token, solution}; receive capability JWT. |
| GET | /.well-known/jwks.json | None | JWKS for offline JWT verification. |
{
"error": "Human-readable message",
"code": "optional_code",
"details": {}
}
| Code | Meaning |
|---|---|
| 400 | Bad request (invalid or missing fields). |
| 404 | Session or device not found. |
| 409 | Agent already registered (device_id already exists). |
| 429 | Rate limit exceeded (10 req/min per IP on /challenge and /verify). |
| 500 | Server error. |
After a successful run through Path A and/or B, a relying party can conclude:
/agent/verify/device/{deviceId} or /agent/verify/signature.