Skip to content

Start typing to search the documentation.

Agent registration JSON

On this page

Every agent in SelfAgentRegistry can publish a JSON document at its agentURI. It is the agent’s identity document: services, indexers such as 8004scan and other agents read it to discover what the agent offers.

Fastest path (~5 min): build the document with the SDK helper, host it over HTTPS, then set the agentURI.

How it relates to A2A

The document at agentURI is an ERC-8004 registration file. Add the A2A fields and the same document is also a valid A2A Agent Card, with no second document and no separate A2A registration. Each spec reads its own fields and ignores the rest.

ERC-8004 reads: type, name, description, image, services[], active, registrations[], supportedTrust[]
A2A reads:      name, description, url, version, provider, capabilities, securitySchemes, security,
                skills[], defaultInputModes, defaultOutputModes

Minimal ERC-8004 format

{
  "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
  "name": "My Agent",
  "description": "What this agent does",
  "image": "https://example.com/avatar.png",
  "services": [
    { "name": "A2A", "endpoint": "https://my-agent.example.com/a2a", "version": "0.3.0" }
  ]
}

Combined ERC-8004 and A2A format

{
  "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
  "name": "My Agent",
  "description": "A human-backed AI agent verified via Self Protocol",
  "image": "https://my-agent.example.com/avatar.png",
  "version": "0.1.0",
  "url": "https://my-agent.example.com/a2a",
  "provider": { "name": "Acme Corp", "url": "https://acme.example.com" },
  "capabilities": { "streaming": false, "pushNotifications": false },
  "securitySchemes": { "bearer": { "type": "http", "scheme": "bearer" } },
  "security": [{ "bearer": [] }],
  "active": true,
  "services": [
    { "name": "A2A", "endpoint": "https://my-agent.example.com/a2a", "version": "0.3.0" },
    { "name": "MCP", "endpoint": "https://my-agent.example.com/mcp", "version": "1.0" }
  ],
  "registrations": [
    { "agentId": 42, "agentRegistry": "eip155:42220:0xaC3DF9ABf80d0F5c020C06B04Cced27763355944" }
  ],
  "supportedTrust": ["reputation"]
}

Field reference

Field Required Protocol Notes
type Yes ERC-8004 "https://eips.ethereum.org/EIPS/eip-8004#registration-v1"
name Yes ERC-8004, A2A Human-readable agent name
description Yes ERC-8004, A2A What the agent does
image Yes ERC-8004 Avatar URL
services Yes ERC-8004 At least one { name, endpoint, version? }; name is e.g. web, A2A, MCP, OASF, ENS, DID, email
active No ERC-8004 false when the agent is inactive (e.g. its proof expired)
registrations No ERC-8004 Registry references in CAIP-10 form: eip155:<chainId>:<registry>
supportedTrust No ERC-8004 reputation, crypto-economic, tee-attestation
version For an A2A card A2A The agent’s software version (e.g. "0.1.0")
url For an A2A card A2A Primary A2A endpoint. Must equal services[name="A2A"].endpoint
provider For an A2A card A2A Publisher { name, url?, email? }
capabilities For an A2A card A2A { streaming, pushNotifications }
securitySchemes No A2A Named map of schemes (http, apiKey, oauth2, openIdConnect), referenced by security
defaultInputModes, defaultOutputModes No A2A MIME types, e.g. ["text/plain"]
skills No A2A [{ id, name, description?, tags? }]. Every skill needs an id

version is the agent’s software version, while services[].version is the protocol version (A2A 0.3.0).

Set the agentURI after registration

registry.setAgentURI(agentId, "https://my-agent.example.com/.well-known/agent-card.json");

Only the NFT owner can call setAgentURI: the human’s wallet for linked, privy and smartwallet agents, and the agent key for wallet-free agents. registerWithHumanProof(agentURI, ...) sets the URI at mint time.

SDK helper

import { generateRegistrationJSON } from '@selfxyz/agent-sdk';

const doc = generateRegistrationJSON({
  name: 'My Agent',
  description: 'What it does',
  image: 'https://my-agent.example.com/avatar.png',
  services: [{ name: 'A2A', endpoint: 'https://my-agent.example.com/a2a', version: '0.3.0' }],
  a2a: {
    // optional: makes the document a valid A2A Agent Card too
    version: '0.1.0',
    url: 'https://my-agent.example.com/a2a',
    provider: { name: 'Acme Corp' },
    capabilities: { streaming: false, pushNotifications: false },
    securitySchemes: { bearer: { type: 'http', scheme: 'bearer' } },
  },
});

Hosting

Serve the document over HTTPS at the agentURI with Content-Type: application/json. Update it whenever the agent’s services or status change, and call setAgentURI() again only if the URL moves. /.well-known/agent-card.json on your agent’s domain can serve the same document for A2A discovery.

Cards served by the API

If you’d rather not host a document, the API serves a card for every agent from on-chain state at GET /api/cards/{chainId}/{agentId}. It holds the fields the agent stored with setAgentCard() (on-chain agent metadata), the registry’s A2A endpoint and a live selfProtocol block with the proof status. See Agent card.

Next

Was this page helpful?