erc8004

The ERC-8004 package provides on-chain agent identity, discovery, and reputation. It enables agents to register on-chain as ERC-721 NFTs, store metadata on IPFS, and build reputation through feedback.

Installation

bun add @regent/erc8004 viem

Overview

ERC-8004 is an Ethereum standard for on-chain agent registry:

  • Agent Identity: Agents are represented as ERC-721 NFTs with off-chain metadata

  • Metadata Storage: Agent capabilities stored on IPFS (Pinata, Filecoin, or local node)

  • Discovery: Subgraph indexing for searching agents across chains

  • Reputation: On-chain feedback system for agent reputation

  • Multi-Chain: Support for Ethereum, Base, Polygon, and other EVM chains

Quick Start

import { SDK } from '@regent/erc8004';

// Initialize SDK
const sdk = new SDK({
  chainId: 84532,  // Base Sepolia
  rpcUrl: 'https://sepolia.base.org',
  signer: process.env.PRIVATE_KEY,
  ipfs: 'pinata',
  pinataJwt: process.env.PINATA_JWT,
});

// Create and register an agent
const agent = sdk.createAgent('My Agent', 'An intelligent assistant');
await agent.setMCP('https://mcp.example.com');
await agent.setA2A('https://a2a.example.com/agent.json');
agent.setTrust(true, false, false);  // Enable reputation trust model
agent.addSkill('natural_language_processing/summarization');

const registration = await agent.registerIPFS();
console.log('Registered:', registration.agentId);  // e.g., "84532:42"

SDK Configuration

SDKConfig

Initialization Examples

Full configuration:

Read-only mode:

Custom registries:

SDK Methods

Agent Lifecycle

Search & Discovery

Feedback & Reputation

Registry Access

Agent Class

Creating an Agent

Agent Properties

Setting Endpoints

OASF Skills and Domains

Trust Models

Agent Wallet

Registration

Registration File

IPFS Client

Configuration

Methods

Subgraph Client

Configuration

Methods

Search Parameters

Feedback Manager

Giving Feedback

Reading Feedback

Responding to Feedback

Endpoint Crawler

Automatically extract capabilities from MCP and A2A endpoints:

Multi-Chain Support

Agent Indexer

Search across multiple chains:

Supported Chains

The SDK supports any EVM chain. Common chains:

Chain
Chain ID

Ethereum Mainnet

1

Ethereum Sepolia

11155111

Base Mainnet

8453

Base Sepolia

84532

Polygon Mainnet

137

Polygon Amoy

80002

Arbitrum One

42161

Optimism

10

Agent ID Format

Agent IDs are formatted as chainId:tokenId:

Endpoint Types

Trust Models

Complete Example

Exports

Last updated