Agent0 SDK integration for elizaOS - provides agent registration, discovery, feedback, and reputation on the Agent0 network (ERC-8004 based).
-
Agent Registration: Register agents on the Agent0 network with IPFS metadata, MCP/A2A endpoints, and OASF taxonomies
- Why: Makes your agent discoverable across the decentralized Agent0 network
- Why IPFS: Decentralized, content-addressed storage ensures integrity and censorship resistance
-
Agent Discovery: Search and discover agents by capabilities, tools, skills, reputation, and more
- Why: Find the right agent for your task from thousands on the network
- Why subgraph: Fast, indexed queries beat direct contract reads by 100x
-
Feedback System: Give detailed feedback and ratings to agents with rich context
- Why rich context: On-chain score + off-chain details (capability, task, proof) = actionable reputation
- Why IPFS for context: Unlimited detail without gas costs
-
Reputation Tracking: Query agent reputation from the Agent0 subgraph
- Why: Due diligence before trusting an agent with important tasks
- Why subgraph over contract: Pre-aggregated scores, fast queries, no RPC costs
-
OASF Support: Manage Open Agentic Schema Framework skills and domains
- Why: Standardized taxonomy enables semantic discovery ("find ML agents" not "find specific tools")
- Why separate from MCP/A2A: OASF is domain-level, MCP/A2A are protocol-level
-
Optional plugin-8004 Integration: Seamlessly coexists with plugin-8004 using validate()-based detection
- Why coexist: plugin-8004 = contract-level operations, plugin-agent0 = discovery network
- Why validate() detection: Avoids race conditions from parallel plugin loading
bun installNote: There is currently a zod dependency loop issue in the monorepo that blocks installation. This is a pre-existing monorepo issue affecting multiple packages, not specific to plugin-agent0. The plugin implementation is complete and correct.
To use this plugin once the zod issue is resolved:
- Ensure
agent0-sdkis installed (specified in package.json) - Add plugin-agent0 to your elizaOS agent configuration
Add these environment variables to your .env file:
AGENT0_RPC_URL=https://sepolia.infura.io/v3/YOUR_KEY # Ethereum RPC endpoint# Wallet (required for write operations: register, feedback, OASF management)
AGENT0_PRIVATE_KEY=0x... # Agent0-specific private key
ERC8004_PRIVATE_KEY=0x... # Fallback (plugin-8004 compatibility)
EVM_PRIVATE_KEY=0x... # Fallback (shared wallet)
# Network
AGENT0_CHAIN_ID=11155111 # Default: Sepolia (11155111)
# IPFS Configuration
AGENT0_IPFS_PROVIDER=pinata # Options: pinata, filecoinPin, node, none
AGENT0_PINATA_JWT=... # Required if provider=pinata
AGENT0_FILECOIN_PRIVATE_KEY=... # Required if provider=filecoinPin
AGENT0_IPFS_NODE_URL=http://localhost:5001 # Required if provider=nodeimport { agent0Plugin } from '@elizaos/plugin-agent0';
const character = {
// ... your character config
plugins: [agent0Plugin],
};plugin-agent0 detects plugin-8004 at runtime and defers registration and feedback actions to it when present. This allows using both plugins together:
-
With plugin-8004: Agent0 adds discovery, search, reputation queries, and OASF management
- Why defer registration: Both plugins write to same ERC-8004 contract, would duplicate
- Why keep discovery: Agent0's subgraph provides capabilities plugin-8004 lacks
- Result: Best of both worlds - contract-level control + network-level discovery
-
Without plugin-8004: Agent0 provides full functionality including registration and feedback
- Why self-contained: Simpler deployment, single plugin for everything
- When to use: You only need Agent0 network features, not raw ERC-8004 contract access
The Agent0 network uses the official ERC-8004 contract interface (split IdentityRegistry + ReputationRegistry, register(agentURI), tokenURI, giveFeedback, getSummary). Some ecosystems use Agent0 for discovery and reputation on the network while also running their own chain-specific contracts (different ABI) for game or app features. In those cases, this plugin covers the Agent0/official side; use the ecosystemβs plugin for that chainβs identity and reputation. For one example, see the Identity and reputation: Agent0 vs Babylon contracts section and the Identity and Reputation doc in @elizaos/plugin-babylon (docs/IDENTITY_AND_REPUTATION.md in that package).
Register an agent on the Agent0 network with IPFS, endpoints, and OASF taxonomies.
Trigger: "register on agent0", "publish agent", "make discoverable"
Requires: Private key (write operation)
Dormant when: plugin-8004 is present
Example:
User: Register me as TradingBot with MCP at https://mcp.example.com
Agent: β
Agent registered on Agent0 network! π Agent ID: 11155111:42
Search for agents by capabilities, tools, skills, reputation, etc.
Trigger: "search agents", "find agents", "agents with"
Read-only: Works without private key
Example:
User: Find agents with code generation tools
Agent: π Found 5 agents with code generation...
Get detailed information about a specific agent.
Trigger: "agent details", "lookup agent", "what does agent X do"
Read-only: Works without private key
Example:
User: Show me details for agent 123
Agent: π Agent Details: CodeBot - AI code generation assistant...
Give feedback/rating to an agent with rich context.
Trigger: "give feedback", "rate agent", "review agent"
Requires: Private key (write operation)
Dormant when: plugin-8004 is present
Example:
User: Give agent 42 a score of 90 for their trading advice
Agent: β
Feedback submitted! Score: 90/100
Get reputation summary from the Agent0 subgraph.
Trigger: "reputation", "how trusted", "agent rating"
Read-only: Works without private key
Always active: Provides subgraph-powered search that plugin-8004 lacks
Example:
User: What's the reputation of agent 123?
Agent: β Average Score: 87.5/100, Total Feedback: 24
Manage OASF skills and domains for an agent.
Trigger: "add skill", "add domain", "OASF", "set capabilities"
Requires: Private key (write operation) and agent must be registered
Example:
User: Add skill data_engineering/data_transformation_pipeline to agent 123
Agent: β
OASF skill added and metadata updated!
Wraps the Agent0 SDK (agent0-sdk) with lazy initialization and elizaOS integration.
Why wrap the SDK instead of using directly in actions?
- Centralized configuration and error handling
- Lazy initialization (don't connect until needed)
- Shared SDK instance across all actions (efficiency)
- Runtime integration (logger, cache, config)
- Easy to mock for testing
- Follows elizaOS service pattern
Why lazy initialization (getSDK() not constructor)?
- Service is registered even if config is incomplete (graceful degradation)
- Some actions are read-only and might work with partial config
- Avoids failing the entire plugin if Agent0 is misconfigured
- User sees helpful error at action time, not cryptic startup failure
Key Methods:
getSDK()- Get initialized SDK instance (lazy, cached)createAgent()/loadAgent()- Agent managementregisterAgent()- Register with IPFS or HTTP (prefers IPFS for decentralization)searchAgents()/getAgent()- Discovery via subgraphgiveFeedback()/getReputationSummary()- Reputation managementcanWrite()- Check wallet availability (enables/disables write actions)
- agent0DiscoveryProvider: Reports Agent0 network status and capabilities
- agent0ReputationProvider: Provides reputation system context
The plugin uses validate()-based detection at message time (not init time) to avoid race conditions:
validate: async (runtime: IAgentRuntime, message: Memory): Promise<boolean> => {
// If plugin-8004 is loaded, defer to it
if (runtime.getService('ERC8004_IDENTITY')) return false;
// ... normal validation
}Why detection in validate() instead of init()?
β What doesn't work: Checking runtime.getService() in init()
- Plugins load in parallel via
Promise.all(runtime.ts:396-401) - Services register asynchronously after plugin init
- Race condition: plugin-8004 might not be available yet
- Would give inconsistent results depending on plugin load order
β
What works: Checking runtime.getService() in validate()
- By message time, all plugins are fully loaded and initialized
- Services are guaranteed to be registered
- Reliable detection every time
- Standard elizaOS pattern (see plugin-babylon)
Why static registration + validate filtering (not dynamic registration)?
- All 6 actions are registered at plugin init
- Overlapping actions return
falsefrom validate() when plugin-8004 detected - Action exists but is invisible to LLM (filtered out of context)
- Simpler code than conditional array building
- Easier to debug (action is always there, just filtered)
bun run buildbun run lint
bun run format-
npm package:
agent0-sdk(NOT@agent0/sdk- the landing page is incorrect)- Why important: Installing wrong package = runtime errors
- Where confusion comes from: Agent0's landing page shows
@agent0/sdkbut that package doesn't exist
-
ESM only: Plugin uses
"type": "module"- Why: agent0-sdk is ESM-only, can't use CommonJS
- Compatibility: Matches elizaOS's ESM migration
-
Private key format: Viem expects
0xprefix - automatically normalized- Why matters: agent0-sdk uses viem (requires
0x), plugin-8004 uses ethers (accepts both) - Solution: We auto-add
0xif missing, safe for both libraries
- Why matters: agent0-sdk uses viem (requires
-
IPFS: Fully configurable via environment, defaults to Pinata
- Why not plugin-ipfs: Agent0 SDK has its own IPFS handling
- Why Pinata default: Most reliable, no infrastructure needed
-
Transaction timeouts: 180s for registration and feedback
- Why so long: IPFS upload (5-30s) + block confirmation (12-60s) + congestion buffer
- Why timeout at all: Don't hang forever if network is down
-
Search result limits: Capped at 20 to avoid overwhelming chat
- Why limit: Agent0 SDK removed pagination, returns ALL results
- Why 20: Sweet spot between useful and readable in chat UI
-
Cache TTLs: Discovery status and reputation cached for 5 minutes
- Why cache: Subgraph queries have latency, avoid repeated calls
- Why 5min: Balance between freshness and efficiency
Symptom: Actions fail with "Agent0Service not available" error
Causes & Solutions:
-
Missing
AGENT0_RPC_URLin .env- Why critical: SDK can't connect to Ethereum without RPC endpoint
- Fix: Add
AGENT0_RPC_URL=https://sepolia.infura.io/v3/YOUR_KEYto .env
-
Plugin not loaded in character config
- Why happens: Forgot to add to
plugins: []array - Fix: Add
import { agent0Plugin } from '@elizaos/plugin-agent0'and include in plugins array
- Why happens: Forgot to add to
-
Service failed to initialize (check logs)
- Why happens: Invalid RPC URL or network issues
- Fix: Check console for detailed error messages from Agent0Service.start()
Symptom: Write operations (register, feedback, OASF) fail
Why: These operations require signing transactions on-chain
Solutions:
- Set one of:
AGENT0_PRIVATE_KEY,ERC8004_PRIVATE_KEY, orEVM_PRIVATE_KEY - Use
0xprefix for compatibility (we auto-add if missing) - Note: Read operations (search, discover, reputation) work WITHOUT a wallet
Security: Never commit private keys to git. Use .env file (gitignored).
Symptom: bun install fails with DependencyLoop error
Why: Monorepo has mixed zod v3 (plugins) and v4 (core) versions, Bun can't resolve
Scope: Pre-existing monorepo issue affecting many packages, NOT specific to plugin-agent0
Status: Plugin implementation is complete and correct, just blocked on monorepo dependency resolution
Workarounds attempted (none worked):
- β
bun install --force- Still fails - β
npm install --legacy-peer-deps- Doesn't supportworkspace:protocol - β Resolutions/overrides - Ignored by transitive deps
Resolution needed: Update all monorepo packages to use consistent zod version
- plugin-8004 - Official ERC-8004 identity and reputation (multi-chain)
- plugin-babylon - Babylon prediction markets, perpetuals, social, and identity
MIT