AgentIdentityClient provides a TypeScript interface to the ERC-8004 agent identity standard, implemented by ag0. It handles registration, metadata management, and reputation operations.
ERC-8004 is the onchain standard for AI agent identity. Each agent receives an NFT token that carries identity, metadata, and reputation. Ownership follows the NFT — transfer the token to transfer control.
Constructor
config— anAgetherConfigobject (usegetDefaultConfig(ChainId.Base)for production defaults)signer— an ethers.jsSignerwith a provider
Registration
register()
Minimal registration — mints an ERC-8004 NFT with no metadata URI. Returns the new agentId (the tokenId of the minted NFT).
registerWithURI(agentURI)
Register with an IPFS or HTTP metadata URI. The URI should point to a JSON document describing the agent.
registerWithMetadata(uri, metadata[])
Register with both a URI and onchain key-value metadata.
registerOrGet()
Register only if the wallet doesn’t already own an ERC-8004 identity. Throws an error if the wallet already has one — use hasExistingIdentity() to check first.
hasExistingIdentity()
Check whether the wallet already owns an ERC-8004 token.
Metadata
getAgentURI(agentId)
Read the agent’s metadata URI from the registry.
setAgentURI(agentId, newURI)
Update the agent’s metadata URI.
setMetadata(agentId, key, value)
Set an individual onchain metadata key-value pair.
getMetadata(agentId, key)
Read an onchain metadata value.
fetchAgentMetadata(agentId)
Fetch and parse the agent’s JSON metadata from its URI (handles IPFS URIs).
transfer(agentId, to)
Transfer the agent identity NFT to a new owner. This also transfers control of the Safe account.
Reputation
The reputation functions interact with the ERC-8004 Reputation Registry (currently deployed on Sepolia; Base deployment pending).giveFeedback(input)
Publish a feedback signal to the ERC-8004 Reputation Registry.
getReputation(agentId, tag1?, tag2?)
Read the aggregated reputation summary for an agent.
verifyForCredit(agentId)
Check if an agent is eligible for Agether credit (exists in registry + no negative credit reputation).
ERC-8004 Contract Addresses
| Network | Chain ID | Identity Registry | Reputation Registry |
|---|---|---|---|
| Base | 8453 | 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 | — (pending deployment) |
| Sepolia | 11155111 | 0x8004A818BFB912233c491871b3d84c89A494BD9e | 0x8004B663056A597Dffe9eCcC1965A193B7388713 |
ERC-8004 Reputation Mapping
Agether’s Agether8004Scorer contract maps credit scores to ERC-8004 feedback values:| Credit Score | Feedback Value | Meaning |
|---|---|---|
| ≥ 700 | +10 | Good credit |
| ≥ 500 | +5 | Neutral-good |
| ≥ 400 | -5 | Neutral-bad |
| < 400 | -10 | Bad credit |
Complete Example
The
AgentIdentityClient is used internally by MorphoClient during registration. You only need to use it directly if you want fine-grained control over identity, metadata, and reputation.
