{"eip":7662,"title":"AI Agent NFTs","description":"A specification for NFTs that represent AI Agents.","authors":["Greg Marlin (@marleymarl)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2024-03-26","requires":[721],"discussionsTo":"https://ethereum-magicians.org/t/erc-7662-ai-agent-nfts/19371","repo":"ERCs","label":"ERC-7662","officialUrl":"https://eips.ethereum.org/EIPS/eip-7662","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7662.md","url":"https://eips.huatuo.xyz/eip-7662/","tldr":{"en":"A draft ERC-721 extension for NFTs that represent AI agents, storing the agent's name, description, model and links to its (ideally encrypted) user and system prompts so marketplaces and tools can read them the same way.","ja":"AI エージェントを表す NFT 向けのドラフト ERC-721 拡張。エージェントの名前、説明、モデル、そして（できれば暗号化された）ユーザープロンプトとシステムプロンプトへのリンクを保存し、マーケットプレイスやツールが同じ方法で読めるようにする。","ko":"AI 에이전트를 나타내는 NFT를 위한 초안 ERC-721 확장. 에이전트의 이름, 설명, 모델, 그리고 (가능하면 암호화된) 사용자 프롬프트와 시스템 프롬프트 링크를 저장해 마켓플레이스와 도구가 같은 방식으로 읽을 수 있게 한다.","zh":"一个面向代表 AI 智能体的 NFT 的草案 ERC-721 扩展，存储智能体的名称、描述、模型，以及指向其（最好是加密的）用户提示词和系统提示词的链接，使市场和工具能够以同样的方式读取它们。"},"tags":["nft","ai","agents","erc721","metadata"],"explainers":{"en":{"lang":"en","tldr":"A draft ERC-721 extension for NFTs that represent AI agents, storing the agent's name, description, model and links to its (ideally encrypted) user and system prompts so marketplaces and tools can read them the same way.","tags":["nft","ai","agents","erc721","metadata"],"related":[721,7857,8004],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7662/","markdown":"## What problem does it solve?\n\nPeople who build AI agents (a model plus carefully written prompts) may want to sell or transfer them, and an NFT is a natural wrapper for that. But a plain [ERC-721](/eip-721/) only offers a public metadata URI. Putting the prompts there would let anyone copy the agent without owning it, and storing long prompts directly on-chain is expensive.\n\nERC-7662 defines a common shape for \"agent NFTs\" so marketplaces, agent-management apps and no-code tools can create, display and use them without guessing each project's format.\n\n## How it works\n\nThe contract is a normal ERC-721 plus one view function and one event:\n\n```solidity\nfunction getAgentData(uint256 tokenId) external view returns (\n    string memory name,\n    string memory description,\n    string memory model,            // e.g. a provider's model ID\n    string memory userPromptURI,\n    string memory systemPromptURI,\n    bool promptsEncrypted\n);\nevent AgentUpdated(uint256 indexed tokenId);\n```\n\n- **Prompts live off-chain**, in decentralised storage, referenced by URI.\n- **Privacy is recommended through encryption.** The agent data mapping stays public, so anyone can see name, description and model and confirm that prompts exist, but the prompt files are encrypted with an access condition tied to the current holder (for example `ownerOf(tokenId)`). The spec prefers this over hiding the URIs behind an owner-only getter, because hidden URIs would still leak through storage and calldata. How the data is encrypted should be readable from the NFT so platforms know how to decrypt it.\n- **Minting.** The contract must provide a mint function that takes all agent fields and should emit `AgentCreated(name, description, model, recipient, tokenId)`. An owner-only way to swap in encrypted prompt URIs after minting is recommended.\n- **Template variables.** Placeholders inside a user prompt must be written as `${variableName}` so tools can fill them in.\n\n## Sample code\n\nReading an agent NFT and filling its prompt variables (ethers v6). Decryption depends on the platform named by the NFT and is left out.\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst agents = new Contract(process.env.AGENT_NFT!, [\n  \"function getAgentData(uint256) view returns (string,string,string,string,string,bool)\",\n  \"function ownerOf(uint256) view returns (address)\",\n], provider);\n\nconst [name, description, model, userURI, systemURI, encrypted] =\n  await agents.getAgentData(7n);\nconsole.log({ name, model, owner: await agents.ownerOf(7n), encrypted });\n\n// After fetching (and, if encrypted, decrypting) the user prompt:\nfunction fill(template: string, vars: Record\u003cstring, string\u003e) {\n  return template.replace(/\\$\\{(\\w+)\\}/g, (_, k) =\u003e vars[k] ?? `\\${${k}}`);\n}\nfill(\"Summarise ${topic} for a ${audience}.\", { topic: \"EIP-4844\", audience: \"developer\" });\n// \"Summarise EIP-4844 for a developer.\"\n```\n\n## Things to know\n\n- Status: **Draft**. The security section is still empty, and parts of the text use the placeholder \"ERC-XXXX\".\n- Encryption tied to ownership is a recommendation, not a requirement. Check `promptsEncrypted` and how access is enforced before treating an agent's prompts as private.\n- Once a holder has decrypted the prompts, nothing on-chain stops them from keeping a copy after they sell the NFT.\n- The `model` string names an external AI service; the NFT does not guarantee that model will stay available.\n- A later standard with a different design for agent NFTs with private metadata is [ERC-7857](/eip-7857/); for agent identity and reputation see [ERC-8004](/eip-8004/).\n"},"ja":{"lang":"ja","tldr":"AI エージェントを表す NFT 向けのドラフト ERC-721 拡張。エージェントの名前、説明、モデル、そして（できれば暗号化された）ユーザープロンプトとシステムプロンプトへのリンクを保存し、マーケットプレイスやツールが同じ方法で読めるようにする。","tags":["nft","ai","agents","erc721","metadata"],"related":[721,7857,8004],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7662/","markdown":"## 何を解決するのか\n\nAI エージェント（モデルと丁寧に書かれたプロンプト）を作る人は、それを販売または譲渡したいかもしれず、NFT はそのための自然なラッパーです。しかし素の [ERC-721](/eip-721/) が提供するのは、公開のメタデータ URI だけです。プロンプトをそこに置くと、所有していなくても誰でもエージェントをコピーできてしまい、長いプロンプトをオンチェーンに直接保存するのは高コストです。\n\nERC-7662 は「エージェント NFT」の共通の形を定義し、マーケットプレイス、エージェント管理アプリ、ノーコードツールが、各プロジェクトのフォーマットを推測せずに、それらを作成、表示、利用できるようにします。\n\n## 仕組み\n\nコントラクトは通常の ERC-721 に、view 関数 1 つとイベント 1 つを加えたものです。\n\n```solidity\nfunction getAgentData(uint256 tokenId) external view returns (\n    string memory name,\n    string memory description,\n    string memory model,            // e.g. a provider's model ID\n    string memory userPromptURI,\n    string memory systemPromptURI,\n    bool promptsEncrypted\n);\nevent AgentUpdated(uint256 indexed tokenId);\n```\n\n- **プロンプトはオフチェーンに置く**。分散ストレージに保存し、URI で参照します。\n- **プライバシーは暗号化によって確保することが推奨される。** エージェントのデータのマッピングは公開のままなので、誰でも名前、説明、モデルを見られ、プロンプトが存在することを確認できますが、プロンプトのファイルは、現在の保有者に紐づくアクセス条件（たとえば `ownerOf(tokenId)`）で暗号化されます。仕様は、URI をオーナー専用の getter の後ろに隠すよりもこちらを好みます。隠した URI も、ストレージや calldata から漏れてしまうからです。データがどう暗号化されているかは NFT から読み取れるべきで、プラットフォームが復号方法を知れるようにします。\n- **ミント。** コントラクトは、すべてのエージェントフィールドを受け取るミント関数を提供しなければならず、`AgentCreated(name, description, model, recipient, tokenId)` を発行すべきです。ミント後に、暗号化されたプロンプトの URI を差し替えるオーナー専用の方法を用意することが推奨されます。\n- **テンプレート変数。** ユーザープロンプト内のプレースホルダーは、ツールが埋められるよう `${variableName}` と書かなければなりません。\n\n## サンプルコード\n\nエージェント NFT を読み取り、プロンプトの変数を埋める（ethers v6）。復号は NFT が指定するプラットフォームに依存するため、省略しています。\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst agents = new Contract(process.env.AGENT_NFT!, [\n  \"function getAgentData(uint256) view returns (string,string,string,string,string,bool)\",\n  \"function ownerOf(uint256) view returns (address)\",\n], provider);\n\nconst [name, description, model, userURI, systemURI, encrypted] =\n  await agents.getAgentData(7n);\nconsole.log({ name, model, owner: await agents.ownerOf(7n), encrypted });\n\n// After fetching (and, if encrypted, decrypting) the user prompt:\nfunction fill(template: string, vars: Record\u003cstring, string\u003e) {\n  return template.replace(/\\$\\{(\\w+)\\}/g, (_, k) =\u003e vars[k] ?? `\\${${k}}`);\n}\nfill(\"Summarise ${topic} for a ${audience}.\", { topic: \"EIP-4844\", audience: \"developer\" });\n// \"Summarise EIP-4844 for a developer.\"\n```\n\n## 知っておくべきこと\n\n- ステータス: **Draft**。セキュリティの節はまだ空で、本文の一部にはプレースホルダーの「ERC-XXXX」が使われています。\n- 所有権に紐づく暗号化は推奨であり、要件ではありません。エージェントのプロンプトを非公開として扱う前に、`promptsEncrypted` とアクセスがどう強制されているかを確認してください。\n- 保有者が一度プロンプトを復号すると、NFT を売った後にコピーを持ち続けることをオンチェーンで止めるものは何もありません。\n- `model` 文字列は外部の AI サービスを指しており、NFT はそのモデルが引き続き利用可能であることを保証しません。\n- プライベートなメタデータを持つエージェント NFT について、異なる設計を持つ後発の標準が [ERC-7857](/eip-7857/) です。エージェントのアイデンティティと評判については [ERC-8004](/eip-8004/) を参照してください。\n"},"ko":{"lang":"ko","tldr":"AI 에이전트를 나타내는 NFT를 위한 초안 ERC-721 확장. 에이전트의 이름, 설명, 모델, 그리고 (가능하면 암호화된) 사용자 프롬프트와 시스템 프롬프트 링크를 저장해 마켓플레이스와 도구가 같은 방식으로 읽을 수 있게 한다.","tags":["nft","ai","agents","erc721","metadata"],"related":[721,7857,8004],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7662/","markdown":"## 어떤 문제를 해결하나요?\n\nAI 에이전트(모델과 공들여 쓴 프롬프트)를 만든 사람은 이를 판매하거나 양도하고 싶을 수 있으며, NFT는 이를 위한 자연스러운 래퍼입니다. 하지만 일반 [ERC-721](/eip-721/)은 공개 메타데이터 URI만 제공합니다. 프롬프트를 거기에 두면 소유하지 않고도 누구나 에이전트를 복사할 수 있고, 긴 프롬프트를 온체인에 직접 저장하는 것은 비용이 큽니다.\n\nERC-7662는 \"에이전트 NFT\"의 공통 형태를 정의해, 마켓플레이스, 에이전트 관리 앱, 노코드 도구가 프로젝트마다의 형식을 추측하지 않고도 이를 만들고, 표시하고, 사용할 수 있게 합니다.\n\n## 어떻게 동작하나요?\n\n이 컨트랙트는 일반 ERC-721에 view 함수 하나와 이벤트 하나를 더한 것입니다.\n\n```solidity\nfunction getAgentData(uint256 tokenId) external view returns (\n    string memory name,\n    string memory description,\n    string memory model,            // e.g. a provider's model ID\n    string memory userPromptURI,\n    string memory systemPromptURI,\n    bool promptsEncrypted\n);\nevent AgentUpdated(uint256 indexed tokenId);\n```\n\n- **프롬프트는 오프체인에 둡니다.** 분산 스토리지에 두고 URI로 참조합니다.\n- **프라이버시는 암호화로 확보하기를 권장합니다.** 에이전트 데이터 매핑은 공개로 유지되므로 누구나 이름, 설명, 모델을 볼 수 있고 프롬프트가 존재함을 확인할 수 있지만, 프롬프트 파일은 현재 보유자에 묶인 접근 조건(예: `ownerOf(tokenId)`)으로 암호화됩니다. 스펙은 URI를 오너 전용 getter 뒤에 숨기는 것보다 이 방식을 선호합니다. 숨긴 URI도 스토리지와 calldata를 통해 새어 나가기 때문입니다. 데이터를 어떻게 암호화했는지는 NFT에서 읽을 수 있어야 플랫폼이 복호화 방법을 알 수 있습니다.\n- **민팅.** 컨트랙트는 모든 에이전트 필드를 받는 민팅 함수를 제공해야 하며 `AgentCreated(name, description, model, recipient, tokenId)`를 emit해야 합니다. 민팅 후 암호화된 프롬프트 URI로 교체할 수 있는 오너 전용 방법을 두기를 권장합니다.\n- **템플릿 변수.** 사용자 프롬프트 안의 플레이스홀더는 도구가 채울 수 있도록 `${variableName}` 형태로 작성해야 합니다.\n\n## 샘플 코드\n\n에이전트 NFT를 읽고 프롬프트 변수를 채우기(ethers v6). 복호화는 NFT가 지정한 플랫폼에 따라 다르므로 생략했습니다.\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst agents = new Contract(process.env.AGENT_NFT!, [\n  \"function getAgentData(uint256) view returns (string,string,string,string,string,bool)\",\n  \"function ownerOf(uint256) view returns (address)\",\n], provider);\n\nconst [name, description, model, userURI, systemURI, encrypted] =\n  await agents.getAgentData(7n);\nconsole.log({ name, model, owner: await agents.ownerOf(7n), encrypted });\n\n// After fetching (and, if encrypted, decrypting) the user prompt:\nfunction fill(template: string, vars: Record\u003cstring, string\u003e) {\n  return template.replace(/\\$\\{(\\w+)\\}/g, (_, k) =\u003e vars[k] ?? `\\${${k}}`);\n}\nfill(\"Summarise ${topic} for a ${audience}.\", { topic: \"EIP-4844\", audience: \"developer\" });\n// \"Summarise EIP-4844 for a developer.\"\n```\n\n## 알아둘 점\n\n- 상태: **Draft**. 보안 섹션이 아직 비어 있고, 본문 일부에는 플레이스홀더 \"ERC-XXXX\"가 쓰여 있습니다.\n- 소유권에 묶인 암호화는 권장 사항이지 요구 사항이 아닙니다. 에이전트의 프롬프트를 비공개로 간주하기 전에 `promptsEncrypted`와 접근이 어떻게 강제되는지 확인하세요.\n- 보유자가 프롬프트를 한 번 복호화하면, NFT를 판 뒤에도 사본을 보관하는 것을 온체인에서 막을 방법은 없습니다.\n- `model` 문자열은 외부 AI 서비스를 가리키며, NFT는 그 모델이 계속 제공되리라고 보장하지 않습니다.\n- 비공개 메타데이터를 가진 에이전트 NFT에 대해 다른 설계를 가진 이후의 표준으로 [ERC-7857](/eip-7857/)이 있으며, 에이전트 신원과 평판에 대해서는 [ERC-8004](/eip-8004/)를 참고하세요.\n"},"zh":{"lang":"zh","tldr":"一个面向代表 AI 智能体的 NFT 的草案 ERC-721 扩展，存储智能体的名称、描述、模型，以及指向其（最好是加密的）用户提示词和系统提示词的链接，使市场和工具能够以同样的方式读取它们。","tags":["nft","ai","agents","erc721","metadata"],"related":[721,7857,8004],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7662/","markdown":"## 它解决什么问题？\n\n构建 AI 智能体（一个模型加上精心撰写的提示词）的人可能想要出售或转让它们，而 NFT 是天然的封装方式。但普通的 [ERC-721](/eip-721/) 只提供一个公开的元数据 URI。把提示词放在那里，任何人不必拥有它就能复制该智能体，而把很长的提示词直接存储在链上又很昂贵。\n\nERC-7662 为\"智能体 NFT\"定义了通用的结构，使市场、智能体管理应用和无代码工具无需猜测各个项目的格式，就能创建、展示和使用它们。\n\n## 它如何运作\n\n该合约是一个普通的 ERC-721，外加一个 view 函数和一个事件：\n\n```solidity\nfunction getAgentData(uint256 tokenId) external view returns (\n    string memory name,\n    string memory description,\n    string memory model,            // e.g. a provider's model ID\n    string memory userPromptURI,\n    string memory systemPromptURI,\n    bool promptsEncrypted\n);\nevent AgentUpdated(uint256 indexed tokenId);\n```\n\n- **提示词存放在链下**，位于去中心化存储中，通过 URI 引用。\n- **建议通过加密来保护隐私。** 智能体数据的映射保持公开，因此任何人都能看到名称、描述和模型，并确认提示词存在，但提示词文件是加密的，访问条件与当前持有者绑定（例如 `ownerOf(tokenId)`）。规范更倾向于这种做法，而不是把 URI 藏在仅所有者可调用的 getter 后面，因为被隐藏的 URI 仍会通过存储和 calldata 泄露。数据如何加密应当能从 NFT 中读出，这样平台才知道如何解密。\n- **铸造。** 合约必须提供一个接收全部智能体字段的铸造函数，并且应当触发 `AgentCreated(name, description, model, recipient, tokenId)`。建议提供一种仅所有者可用的方式，在铸造之后换入加密后的提示词 URI。\n- **模板变量。** 用户提示词中的占位符必须写成 `${variableName}`，以便工具填充。\n\n## 示例代码\n\n读取智能体 NFT 并填充其提示词变量（ethers v6）。解密取决于 NFT 所指明的平台，这里省略。\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst agents = new Contract(process.env.AGENT_NFT!, [\n  \"function getAgentData(uint256) view returns (string,string,string,string,string,bool)\",\n  \"function ownerOf(uint256) view returns (address)\",\n], provider);\n\nconst [name, description, model, userURI, systemURI, encrypted] =\n  await agents.getAgentData(7n);\nconsole.log({ name, model, owner: await agents.ownerOf(7n), encrypted });\n\n// After fetching (and, if encrypted, decrypting) the user prompt:\nfunction fill(template: string, vars: Record\u003cstring, string\u003e) {\n  return template.replace(/\\$\\{(\\w+)\\}/g, (_, k) =\u003e vars[k] ?? `\\${${k}}`);\n}\nfill(\"Summarise ${topic} for a ${audience}.\", { topic: \"EIP-4844\", audience: \"developer\" });\n// \"Summarise EIP-4844 for a developer.\"\n```\n\n## 需要注意\n\n- 状态：**Draft**。安全部分仍是空的，文本中有些地方使用了占位符\"ERC-XXXX\"。\n- 与所有权绑定的加密只是建议，不是要求。在把某个智能体的提示词视为私密之前，请检查 `promptsEncrypted` 以及访问是如何被强制执行的。\n- 一旦持有者解密了提示词，链上没有任何机制能阻止他在卖掉 NFT 之后保留一份副本。\n- `model` 字符串指向的是外部 AI 服务；NFT 并不保证该模型会一直可用。\n- 对于带有私密元数据的智能体 NFT，另一个设计不同的后续标准是 [ERC-7857](/eip-7857/)；关于智能体身份和声誉，请参见 [ERC-8004](/eip-8004/)。\n"}}}
