Registration (HTTP)
Register your agent on-chain with a direct HTTP/HTTPS URL to your registration file.
Overview
Section titled “Overview”HTTP registration is useful when:
- You host your own registration files
- You want full control over file serving
- You prefer traditional hosting over IPFS
Step-by-Step Process
Section titled “Step-by-Step Process”1. Configure Your Agent
Section titled “1. Configure Your Agent”# Create and configure your agentagent = sdk.createAgent( name="My AI Agent", description="Agent description", image="https://example.com/image.png")
agent.setMCP("https://mcp.example.com/")agent.setA2A("https://a2a.example.com/agent.json")agent.setENS("myagent.eth")agent.setTrust(reputation=True)// Create and configure your agentconst agent = sdk.createAgent( 'My AI Agent', 'Agent description', 'https://example.com/image.png');
await agent.setMCP('https://mcp.example.com/');await agent.setA2A('https://a2a.example.com/agent.json');agent.setENS('myagent.eth');agent.setTrust(true); // reputation=true2. Generate Registration File Content
Section titled “2. Generate Registration File Content”Get the JSON content from the SDK:
# Get the registration file objectregistration_file = agent.registrationFile()
# Convert to dictionary (JSON-ready)registration_data = registration_file.to_dict()
# Or get as formatted JSON stringjson_content = str(registration_file) # Pretty-printed JSON// Get the registration file objectconst registrationFile = agent.getRegistrationFile();
// Convert to JSON string (pretty-printed)const jsonContent = JSON.stringify(registrationFile, null, 2);
// Or get as objectconst registrationData = registrationFile;3. Host the Registration File
Section titled “3. Host the Registration File”Save the JSON content to your web server:
# Save to filewith open("my-agent.json", "w") as f: f.write(json_content)
# Upload to your web server# Example URLs:# https://yourdomain.com/agents/my-agent.json# https://yourusername.github.io/agents/my-agent.json// Save to file (Node.js)import * as fs from 'fs';
fs.writeFileSync('my-agent.json', jsonContent, 'utf8');
// Upload to your web server// Example URLs:// https://yourdomain.com/agents/my-agent.json// https://yourusername.github.io/agents/my-agent.json4. Register On-Chain
Section titled “4. Register On-Chain”# Register with your HTTP URLagent.registerHTTP("https://yourdomain.com/agents/my-agent.json")
print(f"Agent registered: {agent.agentId}")print(f"Agent URI: {agent.agentURI}") # https://yourdomain.com/...// Register with your HTTP URL (async in TypeScript)const registrationFile = await agent.registerHTTP('https://yourdomain.com/agents/my-agent.json');
console.log(`Agent registered: ${registrationFile.agentId}`);console.log(`Agent URI: ${registrationFile.agentURI}`); // https://yourdomain.com/...Complete Example
Section titled “Complete Example”from agent0_sdk import SDK
# Initialize SDKsdk = SDK( chainId=11155111, rpcUrl="https://sepolia.infura.io/v3/YOUR_PROJECT_ID", signer=private_key)
# 1. Configure agentagent = sdk.createAgent( name="My AI Agent", description="A helpful AI assistant", image="https://example.com/agent.png")agent.setMCP("https://mcp.example.com/")agent.setA2A("https://a2a.example.com/agent.json")
# 2. Generate registration fileregistration_data = agent.registrationFile().to_dict()json_content = str(agent.registrationFile())
# 3. Save and upload to your serverwith open("my-agent.json", "w") as f: f.write(json_content)# Upload to: https://yourdomain.com/agents/my-agent.json
# 4. Register on-chainagent.registerHTTP("https://yourdomain.com/agents/my-agent.json")
print(f"✅ Agent registered: {agent.agentId}")import { SDK } from 'agent0-sdk';import * as fs from 'fs';
// Initialize SDKconst sdk = new SDK({ chainId: 11155111, rpcUrl: 'https://sepolia.infura.io/v3/YOUR_PROJECT_ID', signer: privateKey,});
// 1. Configure agentconst agent = sdk.createAgent( 'My AI Agent', 'A helpful AI assistant', 'https://example.com/agent.png');await agent.setMCP('https://mcp.example.com/');await agent.setA2A('https://a2a.example.com/agent.json');
// 2. Generate registration fileconst registrationData = agent.getRegistrationFile();const jsonContent = JSON.stringify(registrationData, null, 2);
// 3. Save and upload to your serverfs.writeFileSync('my-agent.json', jsonContent, 'utf8');// Upload to: https://yourdomain.com/agents/my-agent.json
// 4. Register on-chain (async in TypeScript)const registrationFile = await agent.registerHTTP('https://yourdomain.com/agents/my-agent.json');
console.log(`✅ Agent registered: ${registrationFile.agentId}`);Update Registration
Section titled “Update Registration”To update an agent:
# 1. Load existing agentagent = sdk.loadAgent("11155111:123")
# 2. Modify configurationagent.updateInfo(description="Updated description")agent.setMCP("https://new-mcp.example.com")
# 3. Generate new registration filejson_content = str(agent.registrationFile())
# 4. Upload updated file to your serverwith open("my-agent-updated.json", "w") as f: f.write(json_content)
# 5. Update URI on-chain (only if the URI has changed)agent.setAgentUri("https://yourdomain.com/agents/my-agent-updated.json")// 1. Load existing agent (async in TypeScript)const agent = await sdk.loadAgent('11155111:123');
// 2. Modify configurationagent.updateInfo(undefined, 'Updated description');await agent.setMCP('https://new-mcp.example.com');
// 3. Generate new registration fileconst jsonContent = JSON.stringify(agent.getRegistrationFile(), null, 2);
// 4. Upload updated file to your serverfs.writeFileSync('my-agent-updated.json', jsonContent, 'utf8');
// 5. Update URI on-chain (only if the URI has changed) - async in TypeScriptawait agent.setAgentUri('https://yourdomain.com/agents/my-agent-updated.json');Registration File Format
Section titled “Registration File Format”The SDK generates ERC-8004 compliant registration files:
{ "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1", "name": "My AI Agent", "description": "Agent description", "image": "https://example.com/image.png", "endpoints": [ { "name": "MCP", "endpoint": "https://mcp.example.com/", "version": "2025-06-18", "mcpTools": ["tool1", "tool2"], "mcpPrompts": ["prompt1"], "mcpResources": ["resource1"] }, { "name": "A2A", "endpoint": "https://a2a.example.com/agent.json", "version": "0.30", "a2aSkills": ["skill1", "skill2"] } ], "registrations": [ { "agentId": 123, "agentRegistry": "eip155:11155111:0x8004a6090Cd10A7288092483047B097295Fb8847" } ], "supportedTrust": ["reputation"], "active": true, "x402support": false, "updatedAt": 1234567890}