Architecture
Agent0 SDK provides a unified interface for managing agent identities, enabling discovery, and building reputation on blockchain infrastructure.
High-Level Architecture
Section titled “High-Level Architecture”What Stays Where
Section titled “What Stays Where”Blockchain (On-chain)
- Agent identities (ERC-721 NFTs)
- Basic metadata (wallet address, ENS name)
- Feedback scores and tags
- Cryptographic commitments to off-chain files
- Ownership and operator permissions
Decentralized Storage (Off-chain)
- Complete agent registration files (IPFS/HTTP)
- Detailed feedback data (context, capability info, payment proofs)
- Agent images and additional metadata
Developer Applications
- SDK instance with configuration
- Agent management and registration
- Search and discovery operations
- Feedback submission and retrieval
End Users
- Discover agents through search
- Interact with agents via endpoints
- Give feedback and build reputation
- Access agent capabilities
Core Flows
Section titled “Core Flows”1. Agent Registration Flow
Section titled “1. Agent Registration Flow”Step-by-step process:
-
Create Agent → Developer calls
SDK.createAgent()- Creates in-memory
RegistrationFileobject - No blockchain interaction yet
- Creates in-memory
-
Configure Agent → Developer calls
agent.setMCP(),agent.setA2A(), etc.- SDK automatically fetches capabilities from endpoints (tools, prompts, resources, skills)
- Updates
RegistrationFilelocally with fetched capabilities - Soft fails if MCP/A2A endpoints are unreachable (non-blocking)
-
Mint Agent Identity → SDK calls
IdentityRegistry.register()- Mints ERC-721 NFT representing agent
- Returns unique
agentId
-
Update Registration File → SDK adds
agentIdtoRegistrationFile- Inserts the minted
agentIdinto the registration data - Updates the
registrationsarray with agent ID and registry address
- Inserts the minted
-
Upload Registration File → Developer calls
agent.registerIPFS()- Uploads complete
RegistrationFile(withagentId) to IPFS → Gets CID - Alternative:
agent.registerHTTP()for HTTP storage
- Uploads complete
-
Link File to Identity → SDK calls
IdentityRegistry.setAgentUri(CID)- Stores IPFS CID on-chain
- Creates tamper-proof link between identity and file
-
Index Agent → Subgraph automatically indexes
- Subgraph monitors blockchain events and IPFS updates
- Extracts capabilities from registration files
- Makes agent discoverable via GraphQL queries
2. Agent Discovery Flow
Section titled “2. Agent Discovery Flow”Search process:
-
Query Preparation → Developer calls
SDK.searchAgents(params)- Builds search parameters (name, capabilities, trust models, etc.)
-
Search Execution → SDK queries subgraph
- Fast GraphQL queries for complex filtering
- Real-time results from indexed data
-
Result Processing → SDK returns
AgentSummaryobjects- Includes basic info, capabilities, reputation
- Links to full registration files
-
Detailed Retrieval → Developer calls
SDK.getAgent(agentId)- Queries subgraph for agent data and registration file
- Returns
AgentSummarywith full agent configuration
3. Feedback Submission Flow
Section titled “3. Feedback Submission Flow”Two storage options:
Option A: On-chain Only (Simple)
-
Prepare Feedback → Developer calls
SDK.prepareFeedback()- Creates feedback with score and tags only
- No off-chain file needed
-
Submit to Blockchain → SDK calls
ReputationRegistry.giveFeedback()- Stores score and tags directly on-chain
- Minimal gas costs
Option B: Hybrid (Recommended)
-
Create Feedback File → Developer calls
SDK.prepareFeedback()- Creates detailed feedback file with context, capability info, payment proofs
-
Upload to Storage → SDK uploads to IPFS/HTTP
- Gets CID or URI for feedback file
- Stores complete feedback data
-
Submit Commitment → SDK calls
ReputationRegistry.giveFeedback()- Stores score, tags, and file commitment on-chain
- Creates tamper-proof link to detailed feedback
-
Index Feedback → Subgraph automatically indexes
- Monitors blockchain events (
NewFeedback) and IPFS updates - Makes feedback searchable and discoverable
- Monitors blockchain events (
4. Agent Update Flow
Section titled “4. Agent Update Flow”Modifying existing agents:
-
Load Agent → Developer calls
SDK.loadAgent(agentId)- Retrieves current
RegistrationFilefrom IPFS/HTTP - Loads into
Agentobject for updates
- Retrieves current
-
Modify Configuration → Developer calls update methods
agent.setMCP(),agent.setA2A(), etc.- Updates
RegistrationFilelocally
-
Upload New File → Developer calls
agent.registerIPFS()- Uploads updated
RegistrationFileto IPFS - Gets new CID
- Uploads updated
-
Update On-chain Reference → SDK calls
IdentityRegistry.setAgentUri(newCID)- Updates IPFS CID on-chain
- Maintains link to latest version
-
Re-index Agent → Subgraph automatically re-indexes
- Monitors blockchain events (
UriUpdated) and IPFS updates - Reflects new capabilities and configuration
- Monitors blockchain events (
5. Agent Transfer Flow
Section titled “5. Agent Transfer Flow”Changing ownership:
-
Load Agent → Developer calls
SDK.loadAgent(agentId)- Retrieves current agent configuration
-
Transfer Ownership → Developer calls
SDK.transferAgent(agentId, newOwner)- SDK loads agent and calls
IdentityRegistry.transferFrom() - Transfers ERC-721 NFT to new owner
- SDK loads agent and calls
6. Feedback Retrieval Flow
Section titled “6. Feedback Retrieval Flow”Getting feedback data:
-
Get Feedback → Developer calls
SDK.getFeedback(feedbackId)- SDK queries
ReputationRegistryfor feedback records - Gets on-chain scores, tags, and file commitments
- SDK queries
-
Retrieve Details → SDK fetches feedback files from IPFS/HTTP
- Downloads complete feedback data
- Parses context, capability info, payment proofs
-
Return Results → SDK returns
Feedbackobject- Combines on-chain and off-chain data
- Provides complete feedback information