Skip to content

Documentation

Agent metadata

How registration files are stored, resolved, sanitized, versioned and checked for integrity — and why only onchain files can be integrity-checked.

Where a registration file can live

An ERC-8004 identity points to its registration file through agentURI. AgentID registrations always store the file onchain; other agents in the same registry use whatever their owners chose.

agentURISourceResolutionIntegrity check
data:application/json;base64,…onchain-data-uriDecoded locally (base64 or percent-encoded, ≤ 64 KB)PASS
https://…httpsFetched with a timeout and a byte capNOT CHECKED
ipfs://…ipfsFetched through a gateway; CID not verified locallyNOT CHECKED
(empty)noneNothing to resolve — status emptyNOT CHECKED
http://, ar://, …—Not fetched — status unsupportedNOT CHECKED

Metadata integrity verified passes only when the file is stored onchain: the bytes in the identity are the file. For https and IPFS there is no onchain hash to compare against, so the check is reported as not checked — the report still includes the keccak256 of the bytes that were served, so you can detect later changes yourself.

Resolution statuses

StatusMeaning
okFetched or decoded, and it is a valid registration file
pendingNot resolved yet (index only)
emptyagentURI is empty — ERC-8004 allows register() without a URI
unsupportedA scheme AgentID will not fetch (http://, localhost, bare strings)
unavailableThe fetch failed: timeout, DNS, non-200, too large
invalidContent is not a valid registration file (not an object, missing name, malformed JSON)

Treating metadata as untrusted input

Registration files are written by agent owners and are parsed leniently but defensively. The parser never throws on odd data; it returns the sanitized file plus warnings:

  • control characters, bidirectional overrides, zero-width and other invisible characters are stripped; text is NFC-normalized and length-capped;
  • links survive only as https:// URLs; images only as https, IPFS, raster data:image or AgentID assets;
  • an invalid agentid extension block is ignored rather than failing the file;
  • AgentID never renders metadata as HTML and never executes or follows instructions found in it.
resolve-metadata.ts
import { resolveMetadata, normalizeImageUrl, safeExternalUrl } from "@agentid/sdk";

const m = await resolveMetadata(agentURI, { timeoutMs: 10_000 });
m.status;      // "ok" | "empty" | "unsupported" | "unavailable" | "invalid"
m.source;      // "onchain-data-uri" | "https" | "ipfs" | "none"
m.contentHash; // keccak256 of the exact bytes resolved
m.file;        // sanitized registration file (or null)
m.warnings;    // what was dropped or truncated, e.g. an unsafe link

// When rendering untrusted values:
normalizeImageUrl(m.file?.image); // https / ipfs gateway / data:image raster only, else null
safeExternalUrl(m.file?.agentid?.links?.website); // https:// only, else null

Server-side fetching#

The SDK's resolveMetadata has no SSRF protection — it is meant for clients. The AgentID server resolves https files through its own SSRF-safe fetcher (private and reserved addresses blocked, DNS pinned, redirects re-validated, byte caps). See the security model.

Versions and updates

The index keeps a version history per agent: version 1 is the URI set at registration and every URIUpdated event adds one. https and IPFS files are re-fetched every 6 hours; new bytes (a new keccak256) become a new version, because the file changed without any onchain event.

Owners update an AgentID file with updateRegistration, which calls setAgentURI with a new data: URI. History: GET /api/v1/agents/…/metadata?history=1.

Back-references and domain verification

A file's registrations[] should point back at the identity that references it. Identity reports check this as Registration file references this identity: PASS when it does, WARN when the entry is missing, FAIL when it points to another agent.

For service endpoints, ERC-8004 defines domain verification: the endpoint's host serves /.well-known/agent-registration.json listing the same identity. The AgentID server checks it when an identity verification asks for endpoint checks.

agent-registration.json
// https://atlas.example/.well-known/agent-registration.json
{
  "registrations": [
    { "agentId": 42, "agentRegistry": "eip155:46630:0x8004A818BFB912233c491871b3d84c89A494BD9e" }
  ]
}
Domain verification shows that whoever controls the domain lists this agent. It does not show that the endpoint behaves as advertised.