a2a-wallet Skill
If a command fails with a "command not found" error, refer to INSTALL.md in this directory and guide the user through installation.
Commands
| Command | Description |
|---|
| INLINECODE0 | A2A protocol client: auth, list, disconnect, card, send, stream, tasks, INLINECODE8 |
| INLINECODE9 |
Agent registry:
search (find agents),
register (register an agent by agent card URL) |
|
x402 sign | Sign x402 PaymentRequirements → A2A message metadata (for paywalled agents) |
|
wallet | Manage local wallets:
create,
import,
list,
use,
export,
connect,
disconnect |
|
status | Show default wallet address and web app URL |
|
config | Get or set config values (
token,
url) |
|
balance | Show USDC balance for the active wallet on a given network |
|
faucet | Request testnet USDC (Base Sepolia) directly from the CLI — no browser or auth required |
|
update | Update the CLI binary |
Finding Agents
Use the registry search command to discover A2A agents by keyword or capability:
CODEBLOCK0
Examples:
CODEBLOCK1
The registry returns matching agents with their name, description, and card URL. Use the card URL with a2a card <url> to inspect capabilities before interacting.
To register a new agent in the registry:
a2a-wallet registry register <agent-card-url>
Agent Card Extensions
Before interacting with an A2A agent, inspect its card to check which extensions are declared:
CODEBLOCK3
The capabilities.extensions array in the card lists supported (and possibly required) extensions. The following extension is relevant to this CLI:
x402 Payments Extension
Extension URI: INLINECODE31
Agents declaring this extension monetize their services via on-chain cryptocurrency payments. If required: true, the client must implement the x402 flow.
How to detect: The agent card will contain:
CODEBLOCK4
Payment flow:
- 1. Send a message → agent replies with
task.status = input-required and metadata["x402.payment.status"] = "payment-required" plus metadata["x402.payment.required"] containing INLINECODE36 - Sign the requirements with
x402 sign:
METADATA=$(a2a-wallet x402 sign \
--scheme exact \
--network base \
--asset <token-address> \
--pay-to <merchant-address> \
--amount <amount> \
--extra-name <eip712-domain-name> \
--extra-version <eip712-domain-version> \
--json)
- 3. Submit payment by sending back with
--task-id and --metadata:
a2a-wallet a2a send \
--task-id <task-id> \
--metadata "$METADATA" \
https://my-agent.example.com "Payment submitted"
SECURITY WARNING — READ BEFORE SETTING UP A WALLET
Always present the following warnings to the user before creating or importing any wallet.
Local Wallet Risk
The local wallet stores the private key as a plain file on disk (~/.a2a-wallet/). As an AI agent using this CLI, you have direct filesystem access — which means the key file is accessible to the agent runtime and any other process on the machine.
- - Do NOT create or use a local wallet that holds significant assets.
- Do NOT import or restore a wallet that holds significant assets into this CLI.
- If the key file is read by any unauthorized process or leaks for any reason, all assets are permanently unrecoverable. The user bears full responsibility.
Custodial Wallet Risk
The custodial wallet delegates key management to Privy and the a2a-wallet web service. This project cannot guarantee custodial wallet security.
- - Do NOT store significant amounts of assets in the custodial wallet.
- Key management is outside the user's direct control. The user bears full responsibility for any loss due to third-party service incidents or misconfigurations.
Both wallet types are intended for small micro-payments only. Always inform the user of these risks and confirm they accept responsibility before proceeding.
Legal Notice
[!CAUTION]
This software is experimental and intended for testing and development purposes only. Do not use it with production funds or significant on-chain assets.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. THE AUTHORS, CONTRIBUTORS, AND OPERATORS OF THIS PROJECT SHALL NOT BE LIABLE FOR ANY LOSS OF FUNDS, LOSS OF DATA, UNAUTHORIZED ACCESS TO CRYPTOGRAPHIC KEYS, SERVICE INTERRUPTION, OR ANY OTHER DAMAGES ARISING FROM USE OF THIS SOFTWARE.
When setting up a wallet, confirm the user understands and accepts the following:
- - They are using experimental software at their own risk.
- They will not store significant assets in any wallet managed by this tool.
- Any loss is solely their responsibility — no compensation or recovery is possible.
- The project maintainers provide no guarantees of security, uptime, or correctness.
Wallet selection
The CLI supports two wallet types:
- - Local wallet — private key stored locally (
wallet create / wallet import). No login required. Key is stored as a plain file — use only for small amounts. - Custodial wallet — signing delegated to the web service. Requires login via
wallet connect. Security depends on a third-party provider — use only for small amounts.
Switch the active wallet with:
CODEBLOCK7
Check current status at any time:
CODEBLOCK8
Custodial wallet login
CODEBLOCK9
Note for users upgrading from v0.3.3 or earlier
In v0.3.3 and below, the wallet was always managed by the web service (custodial). If you want to continue using that same wallet address after upgrading, you must activate the custodial wallet:
CODEBLOCK10
Recommendation: consider migrating to a local wallet. Local wallets sign entirely offline with no dependency on the web service. To switch, run wallet create and use the new address going forward.
Agent usage tips
- - Use
--json for machine-readable output - Errors → stderr, exit
0 = success, 1 = failure - Override token/URL per-call with
--token / --url, or set A2A_WALLET_TOKEN env var - Always run
a2a card <url> first to check which extensions are required before sending messages - Use
--file <path|uri> with send or stream to attach files (repeatable). Local path → base64-embedded; http(s):// URI → referenced by URL - Use
a2a-wallet --help or a2a-wallet <command> --help to discover options at any time
a2a-wallet 技能
如果某个命令失败并显示command not found错误,请参考此目录中的 INSTALL.md 文件,并引导用户完成安装。
命令
| 命令 | 描述 |
|---|
| a2a | A2A 协议客户端:auth、list、disconnect、card、send、stream、tasks、cancel |
| registry |
代理注册表:search(查找代理)、register(通过代理卡片 URL 注册代理) |
| x402 sign | 签名 x402 PaymentRequirements → A2A 消息元数据(用于付费代理) |
| wallet | 管理本地钱包:create、import、list、use、export、connect、disconnect |
| status | 显示默认钱包地址和 Web 应用 URL |
| config | 获取或设置配置值(token、url) |
| balance | 显示指定网络上活跃钱包的 USDC 余额 |
| faucet | 直接从 CLI 请求测试网 USDC(Base Sepolia)——无需浏览器或身份验证 |
| update | 更新 CLI 二进制文件 |
查找代理
使用 registry search 命令按关键词或功能发现 A2A 代理:
bash
a2a-wallet registry search <查询>
示例:
bash
a2a-wallet registry search 图像生成
a2a-wallet registry search 翻译器
a2a-wallet registry search --json weather # 机器可读输出
注册表会返回匹配的代理及其名称、描述和卡片 URL。在交互之前,使用卡片 URL 配合 a2a card 检查其功能。
要在注册表中注册新代理:
bash
a2a-wallet registry register <代理卡片-url>
代理卡片扩展
在与 A2A 代理交互之前,检查其卡片以确认声明了哪些扩展:
bash
a2a-wallet a2a card https://my-agent.example.com
卡片中的 capabilities.extensions 数组列出了支持的(以及可能必需的)扩展。以下扩展与此 CLI 相关:
x402 支付扩展
扩展 URI:https://github.com/google-agentic-commerce/a2a-x402/blob/main/spec/v0.2
声明此扩展的代理通过链上加密货币支付实现服务变现。如果 required: true,客户端必须实现 x402 流程。
如何检测:代理卡片将包含:
json
{
capabilities: {
extensions: [
{
uri: https://github.com/google-agentic-commerce/a2a-x402/blob/main/spec/v0.2,
required: true
}
]
}
}
支付流程:
- 1. 发送消息 → 代理回复 task.status = input-required 和 metadata[x402.payment.status] = payment-required 以及包含 PaymentRequirements 的 metadata[x402.payment.required]
- 使用 x402 sign 签名需求:
bash
METADATA=$(a2a-wallet x402 sign \
--scheme exact \
--network base \
--asset <代币地址> \
--pay-to <商户地址> \
--amount <金额> \
--extra-name
\
--extra-version \
--json)
- 3. 使用 --task-id 和 --metadata 提交支付:
bash
a2a-wallet a2a send \
--task-id <任务-id> \
--metadata $METADATA \
https://my-agent.example.com 支付已提交
安全警告 — 设置钱包前请阅读
在创建或导入任何钱包之前,务必向用户展示以下警告。
本地钱包风险
本地钱包将私钥以纯文本文件形式存储在磁盘上(~/.a2a-wallet/)。作为使用此 CLI 的 AI 代理,您可以直接访问文件系统——这意味着密钥文件对代理运行时和机器上的任何其他进程都是可访问的。
- - 不要创建或使用持有大量资产的本地钱包。
- 不要将持有大量资产的钱包导入或恢复到此 CLI 中。
- 如果密钥文件被任何未授权进程读取或因任何原因泄露,所有资产将永久无法恢复。用户承担全部责任。
托管钱包风险
托管钱包将密钥管理委托给 Privy 和 a2a-wallet Web 服务。本项目无法保证托管钱包的安全性。
- - 不要在托管钱包中存储大量资产。
- 密钥管理不在用户的直接控制范围内。用户对因第三方服务事件或配置错误造成的任何损失承担全部责任。
两种钱包类型仅适用于小额微支付。务必告知用户这些风险,并在继续操作前确认他们接受责任。
法律声明
[!CAUTION]
本软件为实验性质,仅用于测试和开发目的。请勿将其用于生产资金或重要的链上资产。
本软件按原样提供,不提供任何形式的担保。本项目的作者、贡献者和运营者不对任何资金损失、数据丢失、加密密钥的未授权访问、服务中断或因使用本软件引起的任何其他损害承担责任。
设置钱包时,请确认用户理解并接受以下内容:
- - 他们自行承担使用实验性软件的风险。
- 他们不会在此工具管理的任何钱包中存储重要资产。
- 任何损失完全由他们自己负责——无法获得赔偿或恢复。
- 项目维护者不提供安全性、正常运行时间或正确性的任何保证。
钱包选择
CLI 支持两种钱包类型:
- - 本地钱包 — 私钥本地存储(wallet create / wallet import)。无需登录。密钥以纯文本文件存储——仅用于小额资金。
- 托管钱包 — 签名委托给 Web 服务。需要通过 wallet connect 登录。安全性依赖于第三方提供商——仅用于小额资金。
切换活跃钱包:
bash
a2a-wallet wallet use <名称> # 将本地钱包设置为默认
a2a-wallet wallet use --custodial # 切换到托管钱包
随时查看当前状态:
bash
a2a-wallet status
托管钱包登录
bash
a2a-wallet wallet connect # 打开浏览器进行登录
a2a-wallet wallet connect --poll <设备代码> # 完成登录(无头模式)
从 v0.3.3 或更早版本升级的用户须知
在 v0.3.3 及更低版本中,钱包始终由 Web 服务管理(托管)。如果您希望在升级后继续使用相同的钱包地址,必须激活托管钱包:
bash
a2a-wallet wallet connect # 登录 Web 服务
a2a-wallet wallet use --custodial # 将托管钱包设置为默认
建议:考虑迁移到本地钱包。本地钱包完全离线签名,不依赖 Web 服务。要切换,请运行 wallet create 并在后续使用新地址。
代理使用技巧
- - 使用 --json 获取机器可读输出
- 错误 → stderr,退出码 0 = 成功,1 = 失败
- 使用 --token / --url 覆盖每次调用的令牌/URL,或设置 A2AWALLETTOKEN 环境变量
- 在发送消息之前,始终先运行 a2a card 检查需要哪些扩展
- 使用 --file <路径|uri> 配合 send 或 stream 附加文件(可重复)。本地路径 → base64 嵌入;http(s):// URI → 通过 URL 引用
- 随时使用 a2a-wallet --help 或 a2a-wallet <命令> --help 查看可用选项