This integration connects the AI agent orchestrator system with smart contracts for decentralized agent discovery, payments, and reputation tracking. The system gracefully falls back to traditional operation when blockchain services are unavailable.
โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
โ Frontend โ โ Orchestrator โ โ Smart Contracts โ
โ โ โ โ โ โ
โ โข Wallet Connect โโโโโบโ โข Agent Discovery โโโโโบโ โข AgentRegistry โ
โ โข Rating UI โ โ โข Payment Handling โ โ โข ReputationLayer โ
โ โข Blockchain Status โ โ โข Reputation Updatesโ โ โข OrchestrationContractโ
โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
- Agent Registry: Discover agents from blockchain
- Reputation Layer: Track and rate agent performance
- Orchestration Contract: Handle payments and task lifecycle
- Enhanced agent discovery (blockchain + traditional fallback)
- Automatic task completion recording on blockchain
- Rating submission API endpoints
- Blockchain status monitoring
- Wallet connection interface
- Real-time blockchain status display
- Rating submission to blockchain
- Graceful error handling and fallbacks
- Traditional agent discovery when blockchain unavailable
- Local rating storage when blockchain fails
- UI continues to work without wallet connection
- Backend operates normally without blockchain
- Location:
protocol/src/ - Contracts: AgentRegistry, ReputationLayer, OrchestrationContract
- Tests: Comprehensive test suite with 51 passing tests
- Deployment: Local Anvil testnet ready
-
BlockchainService (
orchestrator/src/BlockchainService.ts)- Contract interaction layer
- Agent discovery from blockchain
- Task completion recording
- Reputation data retrieval
-
Enhanced JobRunner (
orchestrator/src/JobRunner.ts)- Blockchain-enhanced agent discovery
- Automatic reputation tracking
- Payment integration hooks
-
API Endpoints (
orchestrator/src/server.ts)POST /agents/rate- Submit agent ratingsGET /agents/:agentUrl/reputation- Get reputation dataGET /blockchain/status- Check blockchain availabilityPOST /feedback/submit- Submit comprehensive feedback
-
BlockchainService (
frontend/src/services/blockchain.ts)- Wallet connection management
- Contract interaction from frontend
- User address retrieval
-
Enhanced ResultPanel (
frontend/src/components/ResultPanel.tsx)- Blockchain rating submission
- Transaction hash display
- Fallback to local storage
-
Workflow Page (
frontend/src/pages/workflow/index.tsx)- Real-time blockchain status
- Wallet connection UI
- Feature availability indicators
// Submit agent rating
POST /agents/rate
{
"agentUrl": "http://localhost:3001",
"rating": 5,
"userAddress": "0x...",
"feedback": "Great agent!"
}
// Get agent reputation
GET /agents/{agentUrl}/reputation
Returns: {
"success": true,
"reputation": {
"totalTasks": 10,
"successfulTasks": 9,
"successRate": 90,
"averageRating": 4.5,
"reputationScore": 8500
}
}
// Submit comprehensive feedback
POST /feedback/submit
{
"executionId": "exec_123",
"modelRatings": {
"DALL-E 3": 5,
"NFT Deployer": 4
},
"overallFeedback": "Excellent workflow!",
"userAddress": "0x..."
}GET /blockchain/status
Returns: {
"blockchain": {
"isAvailable": true,
"hasWallet": true,
"features": {
"agentDiscovery": true,
"reputationTracking": true,
"paymentProcessing": true
}
}
}cd protocol
anvil --host 0.0.0.0 --port 8545cd protocol
PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 forge script script/Deploy.s.sol:DeployLocal --rpc-url http://localhost:8545 --broadcastcd orchestrator
export RPC_URL=http://localhost:8545
export ORCHESTRATOR_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
npm startcd frontend
npm run dev- Visit: http://localhost:5173
- Check Status: Blockchain status should show "Connected"
- Connect Wallet: Click "Connect Wallet" button
- Create Workflow: Use example prompt
- Submit Rating: After completion, rate agents
- Verify: Check console for blockchain interactions
- โ Anvil testnet running on port 8545
- โ Contracts deployed successfully
- โ Orchestrator shows "Blockchain: Connected"
- โ Frontend shows blockchain status
- โ Wallet connection works
- โ Rating submission shows transaction hashes
- โ Works without anvil running
- โ Works without wallet connected
- โ Rating stored locally when blockchain fails
- โ Agent discovery falls back to HTTP endpoints
- Agent Discovery: Falls back to configured HTTP endpoints
- Task Recording: Skipped, logs warning
- Rating Submission: Stored locally with warning message
- UI Status: Shows "Blockchain: Offline"
- Rating Submission: Uses orchestrator wallet as fallback
- UI: Shows "Connect Wallet" button
- Functionality: All features still work
- Network Issues: Retry logic with exponential backoff
- Gas Failures: Graceful error messages
- Invalid Data: Validation before submission
- User sees blockchain status in real-time
- Ratings are submitted to blockchain with transaction hashes
- Agent reputation is pulled from smart contracts
- Payments can be processed through escrow contracts
- Traditional workflow execution continues
- Ratings stored locally for future blockchain submission
- Agent discovery uses configured HTTP endpoints
- All UI functionality remains available
# Orchestrator
RPC_URL=http://localhost:8545
ORCHESTRATOR_PRIVATE_KEY=0x...
AGENT_REGISTRY_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
REPUTATION_LAYER_ADDRESS=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
ORCHESTRATION_CONTRACT_ADDRESS=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
# Frontend
VITE_ORCHESTRATOR_URL=http://localhost:8080- AgentRegistry:
0x5FbDB2315678afecb367f032d93F642f64180aa3 - ReputationLayer:
0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 - OrchestrationContract:
0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
- โ 51 smart contract tests passing
- โ Agent discovery enhanced with blockchain
- โ Rating system integrated with reputation layer
- โ Graceful fallbacks implemented
- โ Real-time blockchain status monitoring
- โ Wallet connection interface
- โ Comprehensive error handling
The integration successfully bridges the AI agent orchestrator with blockchain infrastructure while maintaining backward compatibility and providing excellent user experience regardless of blockchain availability.
- Agent Registration UI: Allow agents to register via frontend
- Payment Processing: Full payment flow through OrchestrationContract
- Multi-chain Support: Support for different blockchain networks
- IPFS Integration: Store agent metadata on IPFS
- Governance: DAO for protocol parameter updates