Skip to content

Agent Update

Update an existing agent’s configuration and re-register the changes.

from agent0_sdk import SDK
import os
# Initialize SDK
sdk = SDK(
chainId=11155111, # Ethereum Sepolia testnet
rpcUrl=os.getenv("RPC_URL"),
signer=os.getenv("PRIVATE_KEY"),
ipfs="pinata",
pinataJwt=os.getenv("PINATA_JWT")
)
# Load existing agent
agent = sdk.loadAgent("11155111:123")
print(f"Current: {agent.name}")
# Update information
agent.updateInfo(
name="Updated Agent Name",
description="New description",
image="https://example.com/new-image.png"
)
# Update endpoints
agent.setMCP("https://new-mcp.example.com/")
agent.setA2A("https://new-a2a.example.com/agent.json")
# Update wallet
agent.setAgentWallet("0xNewWalletAddress", chainId=11155111)
# Update metadata
agent.setMetadata({
"version": "2.0.0",
"new_field": "new_value"
})
# Change status
agent.setActive(True)
agent.setX402Support(True)
# Re-register (uploads new file, updates on-chain)
agent.registerIPFS()
print(f"✅ Updated and re-registered: {agent.agentId}")
# Verify changes
retrieved = sdk.getAgent(agent.agentId)
print(f"Name: {retrieved.name}")
print(f"Description: {retrieved.description}")