zerion-agent-management

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Zerion — Agent Token & Policy Management

Zerion — Agent令牌与策略管理

Agent tokens authorize the CLI to sign transactions on behalf of a wallet without a passphrase prompt. Policies attached to a token scope what the token can do (chains, allowlist, deny rules, expiry). This is the foundation for safe autonomous trading and off-chain signing.
Agent令牌授权CLI代表钱包签署交易,无需输入密码提示。绑定到令牌的策略会限定该令牌的操作范围(包括可操作链、白名单、拒绝规则、过期时间)。这是安全自主交易与链下签名的基础。

Setup

安装设置

If a
zerion
command fails with
command not found
, install once:
bash
npm install -g zerion-cli
Requires Node.js ≥ 20. For auth see the
zerion
umbrella skill. To execute trades after setup →
zerion-trading
. To sign messages/typed-data →
zerion-sign
.
如果执行
zerion
命令时出现
command not found
错误,请执行以下安装命令:
bash
npm install -g zerion-cli
要求Node.js版本≥20。认证相关内容请查看
zerion
总览技能。完成设置后执行交易请使用
zerion-trading
,签署消息/结构化数据请使用
zerion-sign

When to use

使用场景

  • "Create an agent token"
  • "Set up autonomous trading"
  • "Restrict the bot to chain X / address Y"
  • "Block transfers" / "block approvals" / "expire the token in N days"
  • "Switch which agent token is active"
  • "Revoke a token"
  • "创建Agent令牌"
  • "设置自主交易"
  • "限制机器人仅在X链/Y地址操作"
  • "阻止转账" / "阻止授权" / "设置令牌N天后过期"
  • "切换激活的Agent令牌"
  • "撤销令牌"

Agent vs manual operations

Agent自主操作 vs 人工操作

OperationTypeNotes
agent list-tokens
,
agent list-policies
,
agent show-policy
,
agent use-token
AgentRead-only or config-only. Safe autonomously.
agent create-token
,
agent revoke-token
,
agent create-policy
,
agent delete-policy
ManualRequire passphrase or confirmation. Humans must run these directly.
操作类型说明
agent list-tokens
,
agent list-policies
,
agent show-policy
,
agent use-token
Agent自主操作只读或仅配置操作,可安全地自主执行。
agent create-token
,
agent revoke-token
,
agent create-policy
,
agent delete-policy
人工操作需要密码或确认,必须由人工直接执行。

Read-only — agents may invoke freely

只读操作 — Agent可自由调用

bash
zerion agent list-tokens              # Tokens, attached policies, active flag, wallet binding
zerion agent list-policies            # All policies with rules summary
zerion agent show-policy <id>         # Full policy details
zerion agent use-token --wallet <wallet>   # Switch the active token (config edit, no passphrase)
bash
zerion agent list-tokens              # 令牌、绑定的策略、激活状态、钱包绑定信息
zerion agent list-policies            # 所有策略及规则摘要
zerion agent show-policy <id>         # 策略完整详情
zerion agent use-token --wallet <wallet>   # 切换激活的令牌(仅修改配置,无需密码)

Manual — humans only

人工操作 — 仅支持人工执行

Create an agent token

创建Agent令牌

bash
undefined
bash
undefined

Interactive policy picker (recommended)

交互式策略选择器(推荐)

zerion agent create-token --name <bot> --wallet <wallet>
zerion agent create-token --name <bot> --wallet <wallet>

Attach an existing policy by ID

通过ID绑定已有策略

zerion agent create-token --name <bot> --wallet <wallet> --policy <id>
zerion agent create-token --name <bot> --wallet <wallet> --policy <id>

Multiple policies (AND semantics — all must pass)

绑定多个策略(逻辑与——需满足所有策略规则)

zerion agent create-token --name <bot> --wallet <wallet> --policy <id1>,<id2>

The token is auto-saved to `~/.zerion/config.json` under `agentTokens` and (if no token was active before) becomes the default. Trading commands (`zerion-trading`) and signing commands (`zerion-sign`) read it from config.
zerion agent create-token --name <bot> --wallet <wallet> --policy <id1>,<id2>

令牌会自动保存到`~/.zerion/config.json`的`agentTokens`字段下,如果之前没有激活的令牌,该令牌会成为默认令牌。交易命令(`zerion-trading`)和签名命令(`zerion-sign`)会从配置文件中读取该令牌。

Revoke a token

撤销令牌

bash
zerion agent revoke-token --name <bot>
zerion agent revoke-token --id <id>
bash
zerion agent revoke-token --name <bot>
zerion agent revoke-token --id <id>

Create a policy

创建策略

A policy is a set of rules a token must pass before signing. At least one rule required.
bash
undefined
策略是令牌在签署交易前必须满足的一组规则。至少需要设置一条规则。
bash
undefined

Chain lock — restrict to specific chains

链锁定——限定到特定链

zerion agent create-policy --name safe-base --chains base,arbitrum
zerion agent create-policy --name safe-base --chains base,arbitrum

Expiry — token deactivates after duration (e.g. 24h, 7d)

过期设置——令牌在指定时长后失效(例如24h、7d)

zerion agent create-policy --name short-lived --expires 7d
zerion agent create-policy --name short-lived --expires 7d

Block raw native transfers (ETH/SOL send command)

阻止原生资产转账(ETH/SOL发送命令)

zerion agent create-policy --name no-transfers --deny-transfers
zerion agent create-policy --name no-transfers --deny-transfers

Block ERC-20 approvals (prevents allowance grants)

阻止ERC-20授权(禁止设置额度)

zerion agent create-policy --name no-approvals --deny-approvals
zerion agent create-policy --name no-approvals --deny-approvals

Allowlist — only allow interaction with specific contract addresses

白名单——仅允许与指定合约地址交互

zerion agent create-policy --name dex-only --allowlist 0xUniRouter,0xCowSwap
zerion agent create-policy --name dex-only --allowlist 0xUniRouter,0xCowSwap

Combined rules (AND semantics)

组合规则(逻辑与)

zerion agent create-policy --name strict
--chains base
--expires 7d
--deny-transfers
--deny-approvals
undefined
zerion agent create-policy --name strict
--chains base
--expires 7d
--deny-transfers
--deny-approvals
undefined

Delete a policy

删除策略

bash
zerion agent delete-policy <id>
Tokens that referenced the deleted policy will no longer pass that rule check.
bash
zerion agent delete-policy <id>
引用该已删除策略的令牌将不再通过对应的规则校验。

Policy reference

策略参数参考

FlagEffect
--chains <list>
Restrict to listed chains (comma-separated)
--expires <duration>
Token deactivates after duration. Format:
<n>h
,
<n>d
(e.g.
24h
,
7d
)
--deny-transfers
Block raw native transfers (
zerion send
of native asset)
--deny-approvals
Block ERC-20
approve
calls
--allowlist <addrs>
Only allow interaction with listed contract addresses (comma-separated)
Policies execute as locally-spawned scripts (
policies/*.mjs
in the CLI repo). They run on every signing attempt before the transaction is built.
参数作用
--chains <list>
限定到指定链(逗号分隔)
--expires <duration>
令牌在指定时长后失效,格式:
<n>h
<n>d
(例如
24h
7d
--deny-transfers
阻止原生资产转账(
zerion send
原生资产命令)
--deny-approvals
阻止ERC-20
approve
调用
--allowlist <addrs>
仅允许与指定合约地址交互(逗号分隔)
策略通过本地运行的脚本执行(位于CLI仓库的
policies/*.mjs
),每次签署交易前、交易构建完成前都会运行策略校验。

Recommended setup pattern

推荐设置流程

bash
undefined
bash
undefined

1. Create wallet (manual — see zerion-wallet skill)

1. 创建钱包(人工操作——查看zerion-wallet技能)

zerion wallet create --name agent-bot
zerion wallet create --name agent-bot

2. Create a tight policy

2. 创建严格的策略

zerion agent create-policy --name swap-only
--chains base,arbitrum
--expires 30d
--deny-transfers
--allowlist 0xUniswapRouter,0x1inchRouter
zerion agent create-policy --name swap-only
--chains base,arbitrum
--expires 30d
--deny-transfers
--allowlist 0xUniswapRouter,0x1inchRouter

3. Create the agent token bound to that policy

3. 创建绑定该策略的Agent令牌

zerion agent create-token --name agent-bot
--wallet agent-bot
--policy <swap-only-id>
zerion agent create-token --name agent-bot
--wallet agent-bot
--policy <swap-only-id>

Now zerion-trading and zerion-sign work autonomously

至此,zerion-trading和zerion-sign可自主执行操作

undefined
undefined

Common errors

常见错误

CodeCauseFix
no_agent_token
No active token for wallet
agent create-token --wallet <wallet>
agent_token_expired
Policy
--expires
lapsed
Create a fresh token
policy_denied
Action blocked by policy
agent show-policy <id>
to see rules; revise or use a different token
policy_not_found
Policy ID doesn't exist
agent list-policies
to find valid IDs
policy_no_rules
create-policy
with no flags
Add at least one rule (
--chains
,
--expires
,
--deny-*
,
--allowlist
)
token_name_exists
Duplicate
--name
Choose another name or
agent revoke-token --name <bot>
first
错误码原因解决方法
no_agent_token
钱包没有激活的令牌执行
agent create-token --wallet <wallet>
创建令牌
agent_token_expired
策略的
--expires
已过期
创建新的令牌
policy_denied
操作被策略阻止执行
agent show-policy <id>
查看规则,修改策略或使用其他令牌
policy_not_found
策略ID不存在执行
agent list-policies
查看有效ID
policy_no_rules
创建策略时未设置任何参数添加至少一条规则(
--chains
--expires
--deny-*
--allowlist
token_name_exists
--name
重复
更换名称或先执行
agent revoke-token --name <bot>
撤销同名令牌