|
| 1 | +# ERC-8004 Action Providers |
| 2 | + |
| 3 | +This directory contains **ERC8004IdentityActionProvider** and **ERC8004ReputationActionProvider**, which expose actions for the [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) trustless agent registries (identity and reputation) on supported EVM networks. Implementation uses the Agent0 SDK (`getAgent0SDK`). |
| 4 | + |
| 5 | +## Directory Structure |
| 6 | + |
| 7 | +``` |
| 8 | +erc8004/ |
| 9 | +├── erc8004IdentityActionProvider.ts # Identity registry: register, metadata, discovery |
| 10 | +├── erc8004IdentityActionProvider.test.ts |
| 11 | +├── erc8004ReputationActionProvider.ts # Reputation registry: feedback, responses, queries |
| 12 | +├── erc8004ReputationActionProvider.test.ts |
| 13 | +├── identitySchemas.ts # Zod schemas for identity actions |
| 14 | +├── reputationSchemas.ts # Zod schemas for reputation actions |
| 15 | +├── constants.ts # Supported network IDs and helpers |
| 16 | +├── utils.ts # Agent0 SDK wiring |
| 17 | +├── index.ts # Public exports |
| 18 | +└── README.md # This file |
| 19 | +``` |
| 20 | + |
| 21 | +## Providers |
| 22 | + |
| 23 | +Register both providers on an `EvmWalletProvider` when you want full ERC-8004 coverage: |
| 24 | + |
| 25 | +```typescript |
| 26 | +import { |
| 27 | + erc8004IdentityActionProvider, |
| 28 | + erc8004ReputationActionProvider, |
| 29 | +} from "@coinbase/agentkit"; |
| 30 | + |
| 31 | +const identity = erc8004IdentityActionProvider({ pinataJwt: process.env.PINATA_JWT }); |
| 32 | +const reputation = erc8004ReputationActionProvider({ pinataJwt: process.env.PINATA_JWT }); |
| 33 | +``` |
| 34 | + |
| 35 | +Optional `pinataJwt` enables IPFS uploads for richer metadata and off-chain feedback payloads (comments, A2A task fields). |
| 36 | + |
| 37 | +## Identity actions (`erc8004_identity`) |
| 38 | + |
| 39 | +- `register_agent`: Mint an agent NFT on the Identity Registry and set registration JSON / URI. |
| 40 | + |
| 41 | +- `update_agent_metadata`: Patch agent configuration (name, description, image, MCP/A2A endpoints, ENS, active/x402 flags, trust models, OASF taxonomies, custom metadata). |
| 42 | + |
| 43 | +- `get_owned_agents`: List agents owned by an address (defaults to the connected wallet). |
| 44 | + |
| 45 | +- `search_agents`: Discover agents via semantic keyword search, filters (capabilities, status, reputation), sort, and pagination. |
| 46 | + |
| 47 | +- `get_agent_info`: Fetch full agent profile (identity, endpoints, capabilities, reputation summary, status). |
| 48 | + |
| 49 | +## Reputation actions (`erc8004_reputation`) |
| 50 | + |
| 51 | +- `give_feedback`: Submit scored feedback (tags, endpoint, optional comment / A2A context); core data on-chain, optional IPFS file when JWT is set. Callers cannot rate their own agent. |
| 52 | + |
| 53 | +- `revoke_feedback`: Revoke feedback previously sent from the connected wallet. |
| 54 | + |
| 55 | +- `append_response`: Append an off-chain response URI to a feedback entry (agent owners, aggregators, auditors, etc., per spec). |
| 56 | + |
| 57 | +- `get_agent_feedback`: Read feedback for an agent with optional filters (reviewers, value range, tags). |
| 58 | + |
| 59 | +## Adding New Actions |
| 60 | + |
| 61 | +1. Add or extend Zod schemas in `identitySchemas.ts` or `reputationSchemas.ts`. See [Defining the input schema](https://github.com/coinbase/agentkit/blob/main/CONTRIBUTING-TYPESCRIPT.md#defining-the-input-schema). |
| 62 | +2. Implement the action on `ERC8004IdentityActionProvider` or `ERC8004ReputationActionProvider` with `@CreateAction`. |
| 63 | +3. Cover behavior in the matching `*.test.ts` file. |
| 64 | + |
| 65 | +## Network Support |
| 66 | + |
| 67 | +Supported `networkId` values are defined in `constants.ts` (e.g. Ethereum and Base mainnet/sepolia, Polygon mainnet). Other networks are rejected by `supportsNetwork`. |
| 68 | + |
| 69 | +## Notes |
| 70 | + |
| 71 | +- Agent IDs may be passed as a local token id (e.g. `"123"`) or as `"chainId:tokenId"` (e.g. `"84532:123"`). |
| 72 | +- For broader setup and examples, see the AgentKit [8004 guide](../../../../8004.md) in this repo. |
0 commit comments