Configure Agents
Learn how to create, configure, and manage agents with all available fields and options.
Creating an Agent
Section titled “Creating an Agent”Create a new agent in memory (not yet registered):
from agent0_sdk import SDK
# Initialize SDKsdk = SDK( chainId=11155111, rpcUrl="https://sepolia.infura.io/v3/YOUR_PROJECT_ID", signer=your_private_key, ipfs="pinata", pinataJwt=your_pinata_jwt)
# Create an agentagent = sdk.createAgent( name="My AI Agent", description="An intelligent assistant that helps with various tasks. Skills: data analysis, code generation, natural language processing. Pricing: $0.10 per request, free tier available.", image="https://example.com/agent-image.png" # Optional)import { SDK } from 'agent0-sdk';
// Initialize SDKconst sdk = new SDK({ chainId: 11155111, rpcUrl: 'https://sepolia.infura.io/v3/YOUR_PROJECT_ID', signer: yourPrivateKey, ipfs: 'pinata', pinataJwt: yourPinataJwt,});
// Create an agentconst agent = sdk.createAgent( 'My AI Agent', 'An intelligent assistant that helps with various tasks. Skills: data analysis, code generation, natural language processing. Pricing: $0.10 per request, free tier available.', 'https://example.com/agent-image.png' // Optional);Core Fields
Section titled “Core Fields”Name and Description
Section titled “Name and Description”# Update basic informationagent.updateInfo( name="Updated Agent Name", description="Updated description", image="https://example.com/new-image.png")// Update basic informationagent.updateInfo( 'Updated Agent Name', 'Updated description', 'https://example.com/new-image.png');Active Status
Section titled “Active Status”# Set agent as active/inactiveagent.setActive(True) # Active (visible in searches)agent.setActive(False) # Inactive (hidden but not deleted)// Set agent as active/inactiveagent.setActive(true); // Active (visible in searches)agent.setActive(false); // Inactive (hidden but not deleted)x402 Payment Support
Section titled “x402 Payment Support”# Enable/disable x402 payment supportagent.setX402Support(True)// Enable/disable x402 payment supportagent.setX402Support(true);Endpoint Configuration
Section titled “Endpoint Configuration”MCP (Model Context Protocol) Endpoint
Section titled “MCP (Model Context Protocol) Endpoint”# Set MCP endpointagent.setMCP(endpoint="https://mcp.example.com/")// Set MCP endpoint (async in TypeScript)await agent.setMCP('https://mcp.example.com/');When you set an MCP endpoint, the SDK automatically:
- Fetches tools, prompts, and resources from the endpoint
- Populates the agent’s capabilities
A2A (Agent-to-Agent) Endpoint
Section titled “A2A (Agent-to-Agent) Endpoint”# Set A2A endpointagent.setA2A(agentcard="https://a2a.example.com/agent-card.json")// Set A2A endpoint (async in TypeScript)await agent.setA2A('https://a2a.example.com/agent-card.json');The SDK automatically:
- Fetches skills from the A2A agent card
- Indexes capabilities for search
# Set ENS nameagent.setENS(name="myagent.eth")// Set ENS nameagent.setENS('myagent.eth');This stores the ENS name both:
- In the registration file
- As on-chain metadata
Removing Endpoints
Section titled “Removing Endpoints”# Remove specific endpoint typeagent.removeEndpoint(type=EndpointType.MCP)
# Remove by valueagent.removeEndpoint(value="https://old-endpoint.com")
# Remove all endpointsagent.removeEndpoints()// Note: These methods are not available in TypeScript SDK// Manually filter endpoints from registrationFile instead:const regFile = agent.getRegistrationFile();// Remove specific endpoint typeregFile.endpoints = regFile.endpoints.filter(ep => ep.type !== 'mcp');// Remove by valueregFile.endpoints = regFile.endpoints.filter(ep => ep.value !== 'https://old-endpoint.com');// Remove all endpointsregFile.endpoints = [];TypeScript Note: removeEndpoint and removeEndpoints methods are not available in the TypeScript SDK. Manually filter endpoints from the registration file instead.
Wallet Configuration
Section titled “Wallet Configuration”# Set agent wallet addressagent.setAgentWallet( addr="0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", chainId=11155111 # Optional: defaults to SDK's chain ID)// Set agent wallet addressagent.setAgentWallet( '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', 11155111 // Required in TypeScript);The wallet address is stored as:
agentWalletendpoint in the registration fileagentWalletmetadata on-chain
Trust Models
Section titled “Trust Models”Set Trust Models
Section titled “Set Trust Models”# Using convenience methodagent.setTrust( reputation=True, cryptoEconomic=True, teeAttestation=False)// Using convenience methodagent.setTrust( true, // reputation true, // cryptoEconomic false // teeAttestation);Available trust models:
reputation- On-chain feedback systemcrypto-economic- Economic stake and slashingtee-attestation- Trusted execution environment proofs
On-chain Metadata Management
Section titled “On-chain Metadata Management”# Set on-chain metadata (stored on blockchain)agent.setMetadata({ "version": "1.0.0", "category": "developer-tools", "pricing": "free"})
# Get metadatametadata = agent.getMetadata()print(metadata)// Set on-chain metadata (stored on blockchain)agent.setMetadata({ version: '1.0.0', category: 'developer-tools', pricing: 'free',});
// Get metadataconst metadata = agent.getMetadata();console.log(metadata);Metadata is stored as on-chain key-value pairs in the Identity Registry contract.
Loading an Existing Agent
Section titled “Loading an Existing Agent”Load an agent that’s already registered for editing:
# Load by agent ID# Format: "chainId:tokenId" (e.g., "11155111:123")# where 11155111 is the Sepolia chain ID and 123 is the agent's token IDagent = sdk.loadAgent("11155111:123")
# All fields are automatically loadedprint(f"Name: {agent.name}")print(f"Description: {agent.description}")print(f"MCP: {agent.mcpEndpoint}")// Load by agent ID (async in TypeScript)// Format: "chainId:tokenId" (e.g., "11155111:123")// where 11155111 is the Sepolia chain ID and 123 is the agent's token IDconst agent = await sdk.loadAgent('11155111:123');
// All fields are automatically loadedconsole.log(`Name: ${agent.name}`);console.log(`Description: ${agent.description}`);console.log(`MCP: ${agent.mcpEndpoint}`);Difference between loadAgent() and getAgent():
sdk.loadAgent(agentId)- Returns anAgentobject that can be modified and re-registered (loads registration file from IPFS/HTTP)sdk.getAgent(agentId)- Returns anAgentSummaryobject with read-only data (queries subgraph for fast access)
Direct Property Access
Section titled “Direct Property Access”All agent data can be accessed directly:
# Identityagent.agentId # "11155111:123"agent.agentURI # "ipfs://Qm..."agent.name # "My Agent"agent.description # "Description text"agent.image # "https://..."
# Statusagent.active # True/Falseagent.x402support # True/False
# Walletagent.walletAddress # "0x..."agent.walletChainId # 11155111
# Endpoints (convenience properties)agent.mcpEndpoint # "https://..."agent.a2aEndpoint # "https://..."agent.ensEndpoint # "myagent.eth"
# Capabilities (populated from endpoints)agent.mcpTools # ["tool1", "tool2", ...]agent.mcpPrompts # ["prompt1", "prompt2", ...]agent.mcpResources # ["resource1", ...]agent.a2aSkills # ["skill1", "skill2", ...]
# Lists (read-only)agent.endpoints # List[Endpoint]agent.trustModels # List[TrustModel]agent.metadata # Dict[str, Any]agent.owners # List[str]agent.operators # List[str]agent.updatedAt # Unix timestamp// Identityagent.agentId // "11155111:123" | undefinedagent.agentURI // "ipfs://Qm..." | undefinedagent.name // "My Agent"agent.description // "Description text"agent.image // "https://..." | undefined
// Statusagent.active // true | falseagent.x402support // true | false
// Walletagent.walletAddress // "0x..." | undefinedagent.walletChainId // number | undefined
// Endpoints (convenience properties)agent.mcpEndpoint // "https://..." | undefinedagent.a2aEndpoint // "https://..." | undefinedagent.ensEndpoint // "myagent.eth" | undefined
// Capabilities (populated from endpoints)agent.mcpTools // string[] | undefinedagent.mcpPrompts // string[] | undefinedagent.mcpResources // string[] | undefinedagent.a2aSkills // string[] | undefined
// Access via getRegistrationFile() for listsconst regFile = agent.getRegistrationFile();regFile.endpoints // Endpoint[]regFile.trustModels // (TrustModel | string)[]regFile.metadata // Record<string, unknown>regFile.owners // Address[]regFile.operators // Address[]regFile.updatedAt // Unix timestampComplete Configuration Example
Section titled “Complete Configuration Example”# Create agentagent = sdk.createAgent( name="My AI Agent", description="A powerful AI assistant", image="https://example.com/agent.png")
# Set endpointsagent.setMCP("https://mcp.example.com/")agent.setA2A("https://a2a.example.com/agent.json")agent.setENS("myagent.eth")
# Configure walletagent.setAgentWallet("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", chainId=1)
# Set trust modelsagent.setTrust(reputation=True, cryptoEconomic=True)
# Add metadataagent.setMetadata({ "version": "1.0.0", "language": "python", "framework": "agent0"})
# Set status flagsagent.setActive(True)agent.setX402Support(False)
# Now ready to register!print(f"Agent configured: {agent.name}")// Create agentconst agent = sdk.createAgent( 'My AI Agent', 'A powerful AI assistant', 'https://example.com/agent.png');
// Set endpoints (async in TypeScript)await agent.setMCP('https://mcp.example.com/');await agent.setA2A('https://a2a.example.com/agent.json');agent.setENS('myagent.eth');
// Configure walletagent.setAgentWallet('0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', 1);
// Set trust modelsagent.setTrust(true, true, false); // reputation, cryptoEconomic, teeAttestation
// Add metadataagent.setMetadata({ version: '1.0.0', language: 'typescript', framework: 'agent0',});
// Set status flagsagent.setActive(true);agent.setX402Support(false);
// Now ready to register!console.log(`Agent configured: ${agent.name}`);Next Steps
Section titled “Next Steps”- Register your agent with IPFS Registration
- Or use HTTP Registration