Agent Registration
Create agents, configure their capabilities, and register them on-chain.
Creating an Agent
Use sdk.createAgent() to create a new agent instance. The agent is local until you call one of the register methods.
const agent = sdk.createAgent(
'My AI Agent', // name
'An intelligent assistant for various tasks.', // description
'https://example.com/agent-image.png' // image URL
);
// Configure endpoints (auto-extracts capabilities)
await agent.setMCP('https://mcp.example.com/');
await agent.setA2A('https://a2a.example.com/agent-card.json');
// Set ENS name
agent.setENS('myagent.eth');
// Add OASF skills and domains
agent.addSkill('data_engineering/data_transformation_pipeline', true);
agent.addSkill('natural_language_processing/summarization', true);
agent.addDomain('finance_and_business/investment_services', true);
// Configure trust models
agent.setTrust(true, true, false); // reputation, cryptoEconomic, teeAttestation
// Set custom metadata
agent.setMetadata({ version: '1.0.0', category: 'ai-assistant' });
// Enable agent and x402 payments
agent.setActive(true);
agent.setX402Support(true);Register with IPFS
The recommended approach is to host your registration file on IPFS via Pinata or Filecoin.
// Register on-chain with IPFS
const txHandle = await agent.registerIPFS();
const { result: registration } = await txHandle.waitConfirmed();
console.log(`Agent ID: ${registration.agentId}`); // "11155111:123"
console.log(`Agent URI: ${registration.agentURI}`); // "ipfs://Qm..."Register with HTTP URI
Alternatively, host your registration file on your own server. The SDK will register with a standard HTTPS URL instead of IPFS.
// Register with HTTP URI (no IPFS required)
const txHandle = await agent.registerHTTP(
'https://myserver.com/agents/my-agent.json'
);
const { result: registration } = await txHandle.waitConfirmed();
console.log(`Agent ID: ${registration.agentId}`);
console.log(`Agent URI: ${registration.agentURI}`); // https://myserver.com/...Update an Existing Agent
Load an existing agent, make changes, and re-register to persist updates.
// Load existing agent
const agent = await sdk.loadAgent('11155111:123');
// Update MCP endpoint
await agent.setMCP('https://api.example.com/mcp-v2', '2025-06-18');
// Add new skills
agent.addSkill('advanced_reasoning_planning/strategic_planning', true);
// Remove an endpoint
agent.removeEndpoint({ type: 'A2A' });
// Re-register to persist changes
const txHandle = await agent.registerIPFS();
await txHandle.waitConfirmed();Registration File Format
The registration file follows the ERC-8004 specification. The SDK generates this automatically, but here's the structure:
{
"type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
"name": "My AI Agent",
"description": "An intelligent assistant for various tasks",
"image": "https://example.com/agent.png",
"services": [
{
"name": "MCP",
"endpoint": "https://mcp.myagent.com/",
"version": "2025-06-18"
},
{
"name": "A2A",
"endpoint": "https://myagent.com/.well-known/agent-card.json",
"version": "0.3.0"
},
{
"name": "ENS",
"endpoint": "myagent.eth"
}
],
"x402Support": true,
"active": true,
"registrations": [
{
"agentId": 42,
"agentRegistry": "eip155:1:0x8004A169FB4a..."
}
],
"supportedTrust": ["reputation", "crypto-economic"]
}