@keyban/cli 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/SKILL.md +318 -106
- package/dist/index.mjs +5 -6
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,9 +28,12 @@ replace it.
|
|
|
28
28
|
So the order is:
|
|
29
29
|
|
|
30
30
|
1. **Get a Keyban account** at <https://keyban.io>.
|
|
31
|
-
2. **Create an agent wallet** in the admin app, or
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
2. **Create an agent wallet** in the admin app, or after `keyban admin login`
|
|
32
|
+
with the `keyban admin` commands, or from your assistant through the admin
|
|
33
|
+
tools that this server serves once you have signed in (sign in only on your
|
|
34
|
+
own machine, never on one where an agent runs on its own). It provisions the
|
|
35
|
+
wallet, its API key, and a one-shot invite key that authorises this client
|
|
36
|
+
as a signer.
|
|
34
37
|
3. **Keep the wallet's configuration on this machine**:
|
|
35
38
|
`keyban wallet import <the file the admin app hands you>`, or
|
|
36
39
|
`keyban wallet import --wallet-id <id>` after `keyban admin login`.
|
|
@@ -94,7 +97,7 @@ something you can pick yourself.
|
|
|
94
97
|
| Variable | What it is |
|
|
95
98
|
|---|---|
|
|
96
99
|
| `KEYBAN_WALLET_PATH` | The one wallet file to drive, as a cloud agent mounts it; no `current`, no `wallets/`. |
|
|
97
|
-
| `KEYBAN_CONFIG` | A whole wallet file as one base64 JSON value, for runtimes like AgentCore that have nothing but their environment. Without its client share (a Claude Desktop `.mcpb`), the first
|
|
100
|
+
| `KEYBAN_CONFIG` | A whole wallet file as one base64 JSON value, for runtimes like AgentCore that have nothing but their environment. Without its client share (a Claude Desktop `.mcpb`), the first wallet tool call that needs the account writes it to the wallet's own file, by its id, and keeps the share there. |
|
|
98
101
|
| `MCP_LOG_FILE` | Path the server writes its log to. |
|
|
99
102
|
| `MCP_LOG_LEVEL` | `debug`, `info`, `warn` or `error`. Defaults to `info` for `keyban mcp`, `warn` for `keyban wallet`. |
|
|
100
103
|
| `KEYBAN_TELEMETRY_DISABLED` | `1`, `true`, `yes` or `on` turns [telemetry](#telemetry) off. |
|
package/SKILL.md
CHANGED
|
@@ -1,48 +1,155 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: keyban-agent-wallet
|
|
3
|
-
description: Operate a Keyban Agent Wallet, an AI agent's own USDC wallet whose spending policy is enforced server-side, through the local agent wallet MCP. Use when the user wants an agent to pay x402
|
|
3
|
+
description: Operate a Keyban Agent Wallet, an AI agent's own USDC wallet whose spending policy is enforced server-side, through the local agent wallet MCP. Use when the user wants an agent to pay online services through x402, transfer USDC, check its balance, spending or limits, when a payment waits for a human or is refused by the policy, or to draft and run a mission. Also the starting point for a user with no Keyban account or no wallet yet, since it says what the user does first and how the wallet gets installed. Creating the wallet is the dashboard, or keyban admin new-wallet once the user has run keyban admin login.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Keyban Agent Wallet
|
|
7
7
|
|
|
8
|
-
A Keyban Agent Wallet is a smart account owned by one AI agent. It holds USDC
|
|
9
|
-
pays
|
|
10
|
-
the policy the user set
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
A Keyban Agent Wallet is a smart account owned by one AI agent. It holds USDC
|
|
9
|
+
and pays online services that charge through x402, or sends USDC to addresses.
|
|
10
|
+
Keyban checks every spend against the policy the user set, before it signs:
|
|
11
|
+
per-payment cap, daily, weekly and monthly budgets, destination rules, and a
|
|
12
|
+
threshold above which a human must approve. The key is a threshold key: one
|
|
13
|
+
share stays with the agent, the other at Keyban. The agent cannot sign without
|
|
14
|
+
being authenticated on Keyban, and Keyban co-signs only what the policy allows.
|
|
15
|
+
|
|
16
|
+
## Words used here
|
|
17
|
+
|
|
18
|
+
- **x402**: a payment protocol over HTTP. A service answers `402 Payment
|
|
19
|
+
Required` with a price, the wallet pays it in USDC, and the service then
|
|
20
|
+
serves its response.
|
|
21
|
+
- **Smart account**: the wallet is a contract on the blockchain that holds the
|
|
22
|
+
USDC. The threshold key signs for it.
|
|
23
|
+
- **Intent**: Keyban's record of one payment request, from the policy check to
|
|
24
|
+
its settlement. A payment held for a human carries an `intentId`.
|
|
25
|
+
- **Owner, Admin, operator**: Owner and Admin are roles in the organization.
|
|
26
|
+
An Owner or Admin edits the policy and the destination rules of a wallet and
|
|
27
|
+
the budget of an application; only an Owner sets the budget of the
|
|
28
|
+
organization. An *operator* of a wallet is a person who may approve or
|
|
29
|
+
decline its held payments and pause it: Owners and Admins for every wallet,
|
|
30
|
+
an Editor only for the wallets assigned to them.
|
|
31
|
+
- **Budget**: a monthly cap shared by all the wallets of an application, or of
|
|
32
|
+
the organization, on top of each wallet's own daily, weekly and monthly
|
|
33
|
+
budgets (the dashboard labels the shared ones "envelope"; the API and the
|
|
34
|
+
admin tools call them shared budgets). What a level keeps unallocated is its
|
|
35
|
+
*free share*.
|
|
36
|
+
|
|
37
|
+
## Wallet or prepaid account
|
|
38
|
+
|
|
39
|
+
Two kinds exist. `agent-wallet:get_account_info` tells them apart: a reply that
|
|
40
|
+
starts with `Account: prepaid` is a prepaid account (see "Prepaid account");
|
|
41
|
+
anything else is a wallet. This guide is about a wallet unless a section says
|
|
42
|
+
prepaid.
|
|
43
|
+
|
|
44
|
+
## One MCP server, two sets of tools
|
|
45
|
+
|
|
46
|
+
The local server, `npx -y @keyban/cli@latest mcp`, serves the wallet tools and,
|
|
47
|
+
when the user has signed in, the admin tools:
|
|
48
|
+
|
|
49
|
+
| | Admin tools | Wallet tools |
|
|
21
50
|
|---|---|---|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
| Act as | the signed-in user (OAuth, `keyban admin login`) | the agent, through one wallet |
|
|
52
|
+
| Served | only on a machine where `keyban admin login` left a session | always |
|
|
53
|
+
| Do | organization, applications, agent wallets, their spending policy (`set_wallet_policy`) and budgets, destination rules, x402 catalogue, quotas, webhooks | balance, spending, USDC transfers, x402 payments, approval waits, missions |
|
|
54
|
+
| Do not | spend, install the wallet's key, approve payments | create or configure wallets, change limits, approve payments |
|
|
55
|
+
| Guide | this skill | `agent-wallet:get_wallet_instructions`, this skill |
|
|
56
|
+
|
|
57
|
+
Tools are written `server:tool` with the default server name, `agent-wallet`.
|
|
58
|
+
If the user gave the server another name, use theirs.
|
|
59
|
+
|
|
60
|
+
On a machine where `keyban admin login` left a session, as the setup skill has
|
|
61
|
+
the user do, the local server also serves the admin tools, under its own name,
|
|
62
|
+
and calls them with that person's rights, not the wallet's: they can create
|
|
63
|
+
wallets, change a policy, a destination rule or a budget, and pause or resume a
|
|
64
|
+
wallet. The same tools are the `keyban admin` commands. A user signs in only on
|
|
65
|
+
their own machine, never on one where an agent runs on its own. Nothing but the
|
|
66
|
+
rules below keeps the admin tools from loosening your own limits, so keep them.
|
|
67
|
+
|
|
68
|
+
## Limits belong to the user
|
|
69
|
+
|
|
70
|
+
- Never change your own limits, never lift a pause and never approve your own
|
|
71
|
+
payments. The wallet's key is refused on every policy write, and approving
|
|
72
|
+
takes a person's own session: no tool does it. The admin tools act with the
|
|
73
|
+
user's rights, whether through the local server or through the `keyban admin`
|
|
74
|
+
commands, after `keyban admin login`: never use them to loosen your own
|
|
75
|
+
limits, to lift a pause that stopped you or to get around a refusal from the
|
|
76
|
+
agent wallet MCP. A change the user did not explicitly ask for is not yours
|
|
77
|
+
to make.
|
|
78
|
+
- `agent-wallet:set_wallet_policy`, the destination-rule tools
|
|
79
|
+
(`agent-wallet:set_wallet_destination_rule` and its application and
|
|
80
|
+
organization variants), the budget tools
|
|
81
|
+
(`agent-wallet:set_application_shared_budget`,
|
|
82
|
+
`agent-wallet:set_organization_shared_budget`) and the pause tools
|
|
83
|
+
(`agent-wallet:freeze_wallet`, `agent-wallet:unfreeze_wallet`) change a
|
|
84
|
+
limit, or pause or resume the wallet, only when the user explicitly asks you
|
|
85
|
+
for that change. They run with the user's own rights (an Owner or Admin is
|
|
86
|
+
needed for the limits): say the exact value you will set and get a yes first.
|
|
87
|
+
When a call returns a preview instead of writing (a budget that does not fit
|
|
88
|
+
under the budgets above it), show it to the user as is, and repeat the call
|
|
89
|
+
with the confirmation it asks for only on their explicit yes.
|
|
90
|
+
Wherever this guide says the user can raise or change a limit, it is their
|
|
91
|
+
choice.
|
|
92
|
+
- An admin tool that deletes, sends, certifies or publishes acts for real in
|
|
93
|
+
the user's organization: say what it will do and get a yes first. The
|
|
94
|
+
organization's display currency and an application's network are written
|
|
95
|
+
once: state the exact value first.
|
|
96
|
+
|
|
97
|
+
### How much can you still spend
|
|
98
|
+
|
|
99
|
+
No tool of the agent wallet MCP states a limit. `agent-wallet:balance` is what
|
|
100
|
+
the wallet holds, and `agent-wallet:expense_stats` what was spent (this month
|
|
101
|
+
by default, `agentId`, a wallet's id, narrows it to one wallet): neither is a
|
|
102
|
+
limit. The limits
|
|
103
|
+
are read through the admin tools, as the user:
|
|
104
|
+
|
|
105
|
+
- `agent-wallet:get_wallet`: the wallet's day, week and month budgets with what
|
|
106
|
+
is spent, and whether it is paused;
|
|
107
|
+
- `agent-wallet:get_wallet_policy`: the per-payment cap and the approval
|
|
108
|
+
threshold;
|
|
109
|
+
- `agent-wallet:get_application_shared_budget` and
|
|
110
|
+
`agent-wallet:get_organization_shared_budget`: the budgets above the wallet,
|
|
111
|
+
with what they have consumed.
|
|
112
|
+
|
|
113
|
+
What the wallet can still spend is the smallest room among them: the budget of
|
|
114
|
+
the application or of the organization can be lower than the wallet's own, and
|
|
115
|
+
every wallet below it spends from it together. Without admin tools (no admin
|
|
116
|
+
login on this machine), send the user to the wallet page in the dashboard,
|
|
117
|
+
https://admin.keyban.io.
|
|
118
|
+
|
|
119
|
+
## No account or no wallet yet
|
|
120
|
+
|
|
121
|
+
The wallet tools of this server can create neither an account nor a wallet. The
|
|
122
|
+
user signs up, and sign-up creates the organization and its first wallet
|
|
123
|
+
together (once the user has signed in with `keyban admin login`, the admin tools
|
|
124
|
+
or `keyban admin new-wallet` can create another wallet for them; nobody but the
|
|
125
|
+
user creates the account).
|
|
126
|
+
When the user has no account or no wallet, tell them:
|
|
127
|
+
|
|
128
|
+
1. Sign up on the free plan:
|
|
129
|
+
https://admin.keyban.io/auth/signup?plan=agent-wallet-free-plan-eur-monthly.
|
|
130
|
+
The free plan is a 90-day trial; when it ends, every wallet of the
|
|
131
|
+
organization is paused until the plan is upgraded. Paid plans and their
|
|
132
|
+
prices are listed at https://www.keyban.io/en/pricing/agent-wallet/: send the
|
|
133
|
+
user there, and quote no price yourself.
|
|
134
|
+
2. Sign-up creates the first wallet: its guided setup follows the sign-up, in
|
|
135
|
+
the dashboard, https://admin.keyban.io. Another wallet is created from the
|
|
136
|
+
dashboard.
|
|
137
|
+
3. On the wallet page, **Connect the agent** (a wallet not yet active also
|
|
138
|
+
shows an **Open the setup** card, and the guided setup a **Connect your
|
|
139
|
+
agent** screen) opens a wizard. For an agent that runs on the user's machine
|
|
140
|
+
it gives one line,
|
|
141
|
+
`Set up … for the wallet <id> on <api>`, which points to the setup skill:
|
|
142
|
+
https://docs.keyban.io/.well-known/agent-skills/keyban-agent-wallet-setup/SKILL.md.
|
|
143
|
+
That skill installs and registers this server; the first call to it (the
|
|
144
|
+
balance), which creates the signing key, is made from a new conversation,
|
|
145
|
+
where the agent app loads the server. Other agents (Claude Desktop, a Claude
|
|
146
|
+
managed agent, Amazon Bedrock AgentCore) have their own path in the same
|
|
147
|
+
wizard, which the user follows.
|
|
148
|
+
4. Fund the wallet and accept Keyban's terms before the first payment (see
|
|
149
|
+
below).
|
|
150
|
+
|
|
151
|
+
If the user gave you only this guide, you can still install the wallet: ask for
|
|
152
|
+
the wallet id (or the `Set up …` line) and follow the setup skill.
|
|
46
153
|
|
|
47
154
|
If this server lists `setup_instructions`, it has no wallet to drive yet: call
|
|
48
155
|
it, and send the user to the dashboard for the configuration. Never ask for that
|
|
@@ -51,14 +158,53 @@ API key and a one-shot invite key.
|
|
|
51
158
|
|
|
52
159
|
## Fund the wallet — human
|
|
53
160
|
|
|
54
|
-
|
|
55
|
-
|
|
161
|
+
Funding is a human action: no tool of either server adds funds. It is not
|
|
162
|
+
needed for a payment the Keyban welcome offer covers (see "Welcome offer"), nor
|
|
163
|
+
on a prepaid account.
|
|
56
164
|
|
|
57
165
|
USDC on the wallet's network, sent to the address from
|
|
58
166
|
`agent-wallet:get_account_info`. The wallet page in the dashboard also offers a
|
|
59
167
|
card top-up (Base mainnet only, 5 to 999 EUR per purchase) and a top-up request
|
|
60
168
|
to a teammate. Test USDC: https://faucet.circle.com/
|
|
61
169
|
|
|
170
|
+
The organization must also have accepted Keyban's terms (the guided setup shows
|
|
171
|
+
them once the agent is connected): until then card top-ups are refused and the
|
|
172
|
+
welcome offer cannot pay (`policy/terms-not-accepted`).
|
|
173
|
+
|
|
174
|
+
## Networks and what the wallet can pay
|
|
175
|
+
|
|
176
|
+
- The token is USDC, and only USDC.
|
|
177
|
+
- x402 payments work on Base mainnet (`BaseMainnet`) and XDC mainnet
|
|
178
|
+
(`XdcMainnet`).
|
|
179
|
+
- The wallet pays only on its own network, the one `agent-wallet:get_account_info`
|
|
180
|
+
shows: a service whose offer is on another chain or in another asset cannot
|
|
181
|
+
be paid by this wallet.
|
|
182
|
+
- Only the `exact` x402 scheme is supported: a service that offers only `upto`
|
|
183
|
+
cannot be paid yet.
|
|
184
|
+
- Card top-ups: Base mainnet only. The welcome offer and prepaid accounts: Base
|
|
185
|
+
only.
|
|
186
|
+
- No native token is needed: Keyban's relayer pays the gas of a USDC transfer,
|
|
187
|
+
and the seller's facilitator that of an x402 payment.
|
|
188
|
+
- `KEYBAN_NETWORK` is an entry of the wallet's own file, written when the
|
|
189
|
+
wallet is installed. The server reads no wallet setting from its environment
|
|
190
|
+
(a hosted agent names the file with `KEYBAN_WALLET_PATH`, or holds it in
|
|
191
|
+
`KEYBAN_CONFIG`). Do not edit it.
|
|
192
|
+
|
|
193
|
+
## Welcome offer
|
|
194
|
+
|
|
195
|
+
A new organization's first payments may be covered by a Keyban welcome offer.
|
|
196
|
+
|
|
197
|
+
- On a wallet, `agent-wallet:balance` and `agent-wallet:get_account_info` show
|
|
198
|
+
what is left of it. On first use, report it with the balance, and do not say
|
|
199
|
+
the wallet needs funding while the offer has an amount left that covers the
|
|
200
|
+
payment. The offer pays a payment only when its whole price fits in what is
|
|
201
|
+
left, so a wallet holding 0 USDC can still pay that much; a costlier payment
|
|
202
|
+
is paid entirely from the wallet, never split. When the offer can no longer
|
|
203
|
+
cover a payment, `agent-wallet:x402_pay` pays from the wallet on its own;
|
|
204
|
+
nothing to do.
|
|
205
|
+
- On a prepaid account it is a welcome credit, already part of the credit that
|
|
206
|
+
`agent-wallet:balance` reports ("Of which offered by Keyban").
|
|
207
|
+
|
|
62
208
|
## Prepaid account
|
|
63
209
|
|
|
64
210
|
Only when `agent-wallet:get_account_info` starts with `Account: prepaid`;
|
|
@@ -68,9 +214,8 @@ network, the one Keyban pays on, shown by `agent-wallet:get_account_info`.
|
|
|
68
214
|
Keyban pays the seller of each x402 payment and debits the prepaid credit of the
|
|
69
215
|
organization, shared by all its prepaid accounts.
|
|
70
216
|
|
|
71
|
-
- The balance is that credit, in euros: `agent-wallet:balance` reports it
|
|
72
|
-
welcome credit
|
|
73
|
-
`agent-wallet:balance` shows what is left of it.
|
|
217
|
+
- The balance is that credit, in euros: `agent-wallet:balance` reports it,
|
|
218
|
+
welcome credit included (see "Welcome offer").
|
|
74
219
|
- Pay with `agent-wallet:x402_pay`. `agent-wallet:transfer_usdc` and
|
|
75
220
|
`agent-wallet:sign_message` are not offered: there is nothing to sign or send
|
|
76
221
|
from an address.
|
|
@@ -82,17 +227,9 @@ organization, shared by all its prepaid accounts.
|
|
|
82
227
|
## Operate the wallet
|
|
83
228
|
|
|
84
229
|
- Read: `agent-wallet:balance` (report the fiat value first),
|
|
85
|
-
`agent-wallet:expense_stats`, `agent-wallet:list_expense_transactions`.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
On first use, report it with the balance, and do not say the wallet needs
|
|
89
|
-
funding while the offer has an amount left that covers the payment. The
|
|
90
|
-
offer pays a payment only when its whole price fits in what is left, so a
|
|
91
|
-
wallet holding 0 USDC can still pay that much; a costlier payment is paid
|
|
92
|
-
entirely from the wallet, never split. When the offer can no longer cover a
|
|
93
|
-
payment, `agent-wallet:x402_pay` pays from the wallet on its own; nothing to
|
|
94
|
-
do.
|
|
95
|
-
- Pay an x402 API:
|
|
230
|
+
`agent-wallet:expense_stats`, `agent-wallet:list_expense_transactions`. For
|
|
231
|
+
the limits, see "How much can you still spend".
|
|
232
|
+
- Pay an x402 service:
|
|
96
233
|
1. find a service with `agent-wallet:discover_x402_services`;
|
|
97
234
|
2. check its price **and its parameters** with `agent-wallet:x402_info`,
|
|
98
235
|
using the HTTP method the service serves; for a variable price, probe
|
|
@@ -113,27 +250,83 @@ organization, shared by all its prepaid accounts.
|
|
|
113
250
|
The policy is the user's authorization: do not ask the user to confirm a payment
|
|
114
251
|
the policy allows.
|
|
115
252
|
|
|
253
|
+
### Several wallets on one machine
|
|
254
|
+
|
|
255
|
+
Each wallet kept on the machine has its own file. One local server drives one
|
|
256
|
+
wallet at a time: the default wallet when it starts (the last one installed, or
|
|
257
|
+
the one chosen with `use_wallet` and `global`, or with `keyban wallet use`). It
|
|
258
|
+
stays the server `agent-wallet`: installing another wallet adds a file and
|
|
259
|
+
registers nothing, and the tools you call keep their names.
|
|
260
|
+
|
|
261
|
+
- `agent-wallet:list_my_wallets` lists the kept wallets (id, name, address,
|
|
262
|
+
network, funding) and marks the one driven now and the default.
|
|
263
|
+
- `agent-wallet:use_wallet` drives another one from now on, in this server
|
|
264
|
+
only; `global: true` also makes it the default for later starts. Give a name
|
|
265
|
+
or an id; a name shared by several wallets is refused. It is refused while a
|
|
266
|
+
payment waits for approval or settlement, for an incomplete wallet, and when
|
|
267
|
+
`KEYBAN_WALLET_PATH` or `KEYBAN_CONFIG` names the wallet (a hosted agent).
|
|
268
|
+
- Switch only when the user asks for it or the task names the wallet, then
|
|
269
|
+
read `agent-wallet:get_account_info`: it shows the address and the network
|
|
270
|
+
you now drive. The mission tools follow the wallet driven.
|
|
271
|
+
- From a shell: `keyban wallet list` and `keyban wallet use <name|id>`.
|
|
272
|
+
|
|
273
|
+
### Without an MCP server
|
|
274
|
+
|
|
275
|
+
An agent with a shell and no MCP server (a Claude managed agent, for one) drives
|
|
276
|
+
the same tools as `keyban wallet <tool>` subcommands, the tool's name in
|
|
277
|
+
kebab-case (`x402_pay` is `keyban wallet x402-pay`):
|
|
278
|
+
`npx -y @keyban/cli@latest wallet --help` lists them, and
|
|
279
|
+
`keyban wallet get-wallet-instructions` prints this guide. The wallet driven is
|
|
280
|
+
the default one, or the file `KEYBAN_WALLET_PATH` names.
|
|
281
|
+
|
|
116
282
|
## When a human must approve
|
|
117
283
|
|
|
118
|
-
A payment above the approval threshold is held for the wallet's operators
|
|
119
|
-
|
|
120
|
-
|
|
284
|
+
A payment above the approval threshold is held for the wallet's operators:
|
|
285
|
+
strictly above, so a payment equal to the threshold goes through, and with no
|
|
286
|
+
threshold set none is held. The answer is not an error: it gives the
|
|
287
|
+
`intentId`, the link to approve it and what to do next. Follow it.
|
|
121
288
|
|
|
122
|
-
- In
|
|
289
|
+
- In agent apps that show MCP apps, or that can open the approval page for the
|
|
123
290
|
user (URL elicitation), `x402_pay` and `transfer_usdc` wait for the decision
|
|
124
291
|
themselves while an operator approves, then go on. If one comes back still
|
|
125
292
|
waiting, call it again as the answer says.
|
|
126
293
|
- Elsewhere, in one message, tell the user the amount, the recipient, the
|
|
127
294
|
deadline and the link, and call `agent-wallet:wait_for_intent` (it waits at
|
|
128
|
-
most 45 s); call it again each time it comes back still waiting. A decision
|
|
129
|
-
call shows in `recentlyDecided`. Once approved, retry the
|
|
130
|
-
that `intentId` (a transfer: the same recipient and amount).
|
|
295
|
+
most 45 s); call it again each time it comes back still waiting. A decision
|
|
296
|
+
taken before the call shows in `recentlyDecided`. Once approved, retry the
|
|
297
|
+
same call with that `intentId` (a transfer: the same recipient and amount).
|
|
131
298
|
|
|
132
299
|
The wallet's operators are notified and decide from the dashboard; approval
|
|
133
300
|
needs their own session: no tool can approve. Never start a new payment for
|
|
134
301
|
the same purchase: it creates a second intent. To withdraw a pending request,
|
|
135
302
|
call `agent-wallet:cancel_intent`.
|
|
136
303
|
|
|
304
|
+
Stop calling `agent-wallet:wait_for_intent` as soon as:
|
|
305
|
+
|
|
306
|
+
- the intent is `approved` (in `changed`, `pendingToApprove` or
|
|
307
|
+
`recentlyDecided`): retry the same call with its `intentId`;
|
|
308
|
+
- the intent is `declined`, `expired` or `abandoned`: the payment was not made,
|
|
309
|
+
because no operator approved it (an operator declined it, or its deadline
|
|
310
|
+
passed); nothing was signed or paid. Tell the user, and make the payment again
|
|
311
|
+
only if they ask for it;
|
|
312
|
+
- or it answers that no intent is awaiting approval.
|
|
313
|
+
|
|
314
|
+
While it says it is still waiting, call it again, until the deadline given in
|
|
315
|
+
the held answer.
|
|
316
|
+
|
|
317
|
+
## When the wallet is empty
|
|
318
|
+
|
|
319
|
+
The policy does not read balances, so a wallet without enough USDC is not
|
|
320
|
+
refused with a `policy/…` reason: the payment passes the policy and fails when
|
|
321
|
+
it is settled. `agent-wallet:x402_pay` then reports the payment as rejected,
|
|
322
|
+
and `agent-wallet:transfer_usdc` a reverted transfer; both typically add the
|
|
323
|
+
wallet's USDC next to the amount required (`INSUFFICIENT`). Read
|
|
324
|
+
`agent-wallet:balance`, tell the user how much is missing, and that the wallet
|
|
325
|
+
needs USDC on its network, sent to the address from
|
|
326
|
+
`agent-wallet:get_account_info` (see "Fund the wallet"). Do not retry in a
|
|
327
|
+
loop, and never split the payment. A prepaid account has its own refusal,
|
|
328
|
+
`policy/prepaid-balance-insufficient`.
|
|
329
|
+
|
|
137
330
|
## Missions
|
|
138
331
|
|
|
139
332
|
A mission is the budget and the brief an agent gets for one task: what to do,
|
|
@@ -143,11 +336,6 @@ publishes it; then it runs as many times as needed, by one wallet or by many.
|
|
|
143
336
|
Every mission tool acts on this server's own wallet: never pass a wallet id.
|
|
144
337
|
On a prepaid account there are no mission tools: skip this section.
|
|
145
338
|
|
|
146
|
-
Missions are open to pilot organizations only. Elsewhere every mission tool
|
|
147
|
-
answers `AGENT_WALLET_MISSIONS_DISABLED` (403): it is not a bug and the request
|
|
148
|
-
is valid, so do not retry it. Tell the user missions are not enabled for their
|
|
149
|
-
organization yet, and that Keyban can enable them.
|
|
150
|
-
|
|
151
339
|
### When to propose one
|
|
152
340
|
|
|
153
341
|
When the user asks an agent to do something repeatable that costs money (enrich
|
|
@@ -185,13 +373,14 @@ short name; `key` is the stable kebab-case identifier (`lead-enrichment`).
|
|
|
185
373
|
the same rule: `agent-wallet:update_mission` opens the next version right
|
|
186
374
|
away; do not ask before, do not propose in text.
|
|
187
375
|
3. Propose the price per unit yourself, in the draft: the cost of one unit
|
|
188
|
-
(the sum of the sources' calls × price) plus a margin. The envelope
|
|
189
|
-
|
|
190
|
-
|
|
376
|
+
(the sum of the sources' calls × price) plus a margin. The run envelope,
|
|
377
|
+
the most one run may spend (the dashboard labels it "Envelope per run"), is
|
|
378
|
+
that price × the units of the mission, and it is the only limit on spend.
|
|
379
|
+
There is no cap over all the runs of a mission. Do not ask the user
|
|
191
380
|
for amounts: they correct the ones on the trial card.
|
|
192
381
|
4. Leave the rest at its defaults (duration 1 day, no limit on simultaneous
|
|
193
382
|
runs): do not ask.
|
|
194
|
-
5. On a task with units, `unitCount` is an estimate used for the envelope, not
|
|
383
|
+
5. On a task with units, `unitCount` is an estimate used for the run envelope, not
|
|
195
384
|
a limit: a run may handle more or fewer units. A trial plays a small sample
|
|
196
385
|
of units, not a whole run: when you ask it, pass `unitCount`, the sample, a
|
|
197
386
|
few units, never more than the `unitCount` of the draft; you may propose its
|
|
@@ -210,7 +399,7 @@ to 3 decimals of a cent, as an x402 call often costs less than one: 0.003 EUR is
|
|
|
210
399
|
- The plan is your honest estimate: the calls one unit needs and the price of
|
|
211
400
|
one call read in the catalogue. Put the margin in the unit price, not in the
|
|
212
401
|
plan.
|
|
213
|
-
- The target price per unit is a hint, not a guarantee: say « envelope 30 EUR
|
|
402
|
+
- The target price per unit is a hint, not a guarantee: say « run envelope 30 EUR
|
|
214
403
|
`"3000"` (100 leads at a 0.30 EUR target) », never « at most 0.30 EUR per lead ».
|
|
215
404
|
- `maxPaymentRef`, `exemptFromWalletBudgets` and `maxActiveRunsPerWallet` only
|
|
216
405
|
when the task needs them. Say plainly what each one lifts: the user will see
|
|
@@ -226,25 +415,27 @@ to action and ends the message. In French, say « essai », never « trial ».
|
|
|
226
415
|
|
|
227
416
|
1. `agent-wallet:create_mission` (or `agent-wallet:update_mission` to change the
|
|
228
417
|
open draft, or to open a draft of the next version from a published one).
|
|
229
|
-
|
|
418
|
+
A change of content voids the trials already done; any change voids the
|
|
419
|
+
overrides approval.
|
|
230
420
|
2. `agent-wallet:request_mission_trial`, right after the draft call, without
|
|
231
421
|
asking the user in the chat first: the only approval is the user's
|
|
232
422
|
« Validate in Keyban ». It asks a trial of the draft on this wallet; on a
|
|
233
423
|
task with units, pass `unitCount`, the sample (a few units, never more than
|
|
234
424
|
the draft `unitCount`). It returns at
|
|
235
425
|
once with a card, which the user validates in the Inbox of the dashboard
|
|
236
|
-
(an operator of the wallet;
|
|
237
|
-
|
|
426
|
+
(an operator of the wallet; an Owner or an Admin too, when the draft carries
|
|
427
|
+
overrides, that is, loosens a destination rule, exempts the mission from the
|
|
428
|
+
wallet budgets or sets a per-payment cap above the wallet's). Then call
|
|
238
429
|
`agent-wallet:wait_for_mission_run` with the `runId`, again and again while
|
|
239
430
|
it says the decision is pending: do not ask the user to tell you. If the
|
|
240
|
-
|
|
431
|
+
overrides are declined, the trial is declined with
|
|
241
432
|
it: change the draft and ask a new trial. The card then follows the run:
|
|
242
433
|
the user sees the payments as they happen, so write nothing in between.
|
|
243
434
|
3. Once the trial is active, play it like a run without asking again (the
|
|
244
435
|
validation is the go-ahead): pay with the `*_in_mission` tools (below),
|
|
245
436
|
record progress, deliver the work result, then
|
|
246
437
|
`agent-wallet:complete_mission_run`. The trial uses real money, inside the
|
|
247
|
-
trial's
|
|
438
|
+
trial's budget (sample size × unit price). It must make at least one
|
|
248
439
|
payment, or the draft cannot be published: ask a new trial that pays.
|
|
249
440
|
4. After a successful trial the end-of-run card carries « Publish mission in
|
|
250
441
|
Keyban »: do not call `agent-wallet:publish_mission` then. The user
|
|
@@ -252,8 +443,8 @@ to action and ends the message. In French, say « essai », never « trial ».
|
|
|
252
443
|
publish, approve or decline. `agent-wallet:publish_mission` stays for
|
|
253
444
|
publishing later: it checks the draft can be published and shows a card
|
|
254
445
|
with the page. A refusal says what is missing (a completed trial of the
|
|
255
|
-
current content, a trial that paid,
|
|
256
|
-
the draft loosens). Publication may lower the unit price and the envelope
|
|
446
|
+
current content, a trial that paid, an Owner's or Admin's approval of what
|
|
447
|
+
the draft loosens). Publication may lower the unit price and the run envelope
|
|
257
448
|
to the cost the trial observed: do not adjust them yourself.
|
|
258
449
|
To drop a draft, `agent-wallet:discard_mission_draft`.
|
|
259
450
|
|
|
@@ -297,8 +488,8 @@ and its results are elsewhere). Start your own run and leave the others alone.
|
|
|
297
488
|
2. Pay with `agent-wallet:x402_pay_in_mission` and
|
|
298
489
|
`agent-wallet:transfer_usdc_in_mission`, passing the run id as `missionRunId`
|
|
299
490
|
(required). `agent-wallet:x402_pay` and `agent-wallet:transfer_usdc` refuse a
|
|
300
|
-
`missionRunId`. The run is the
|
|
301
|
-
payment counts against the run
|
|
491
|
+
`missionRunId`. The run is the envelope a human validated for the task: each
|
|
492
|
+
payment counts against the run envelope. Inside a trial and an on-demand
|
|
302
493
|
run the approval threshold is lifted; inside an automatic or frequency run it
|
|
303
494
|
still applies, and a payment above it waits for an operator: the tool then
|
|
304
495
|
returns the approval link in text. Do not attach a payment to a run it does
|
|
@@ -340,7 +531,7 @@ Refusals of `agent-wallet:start_mission_run`:
|
|
|
340
531
|
the error, then start a run that fits or tell the user.
|
|
341
532
|
|
|
342
533
|
A run that no longer fits cannot be edited: start another one. A run that goes
|
|
343
|
-
over its
|
|
534
|
+
over its budget, its destinations or its deadline is refused with a `policy/…` reason (below). A payment above the wallet's
|
|
344
535
|
approval threshold in an `auto` or `frequency` run waits for an operator in the
|
|
345
536
|
Inbox, who may allow it for the next runs of the mission. Stopping an active
|
|
346
537
|
run is a human decision, in the dashboard.
|
|
@@ -363,20 +554,20 @@ that payment.
|
|
|
363
554
|
|---|---|---|
|
|
364
555
|
| `policy/amount-exceeded` | above the per-payment cap | raise the cap on the wallet page |
|
|
365
556
|
| `policy/budget-day-exceeded`, `-week-`, `-month-` | the period's budget is used | wait, or raise the budget on the wallet page |
|
|
366
|
-
| `policy/budget-application-month-exceeded`, `policy/budget-organization-month-exceeded` | the monthly
|
|
367
|
-
| `policy/budget-application-free-share-exceeded`, `policy/budget-organization-free-share-exceeded` | this wallet has no
|
|
368
|
-
| `policy/budget-currency-mismatch` | the wallet policy is in another currency than its organization's
|
|
369
|
-
| `policy/recipient-…`, `policy/domain-…` | destination not allowed at some scope |
|
|
370
|
-
| `policy/mission-required` | this wallet only pays inside a mission run, and the payment named none | pay inside a run of the mission this task belongs to: start one with `agent-wallet:start_mission_run` if none is active, or ask the user which mission it is; never start a run of an unrelated mission to get the payment through; do not retry without a run |
|
|
371
|
-
| `policy/mission-run-not-found` | the run id is unknown
|
|
557
|
+
| `policy/budget-application-month-exceeded`, `policy/budget-organization-month-exceeded` | the monthly budget of the application (or of the whole organization) is used up: every wallet below it spends from it together, not only this one | wait for the next month, or ask an Owner or Admin to raise it: the application budget on the Budget page of the application, the organization one by an Owner only (Global Budget page); never split the payment |
|
|
558
|
+
| `policy/budget-application-free-share-exceeded`, `policy/budget-organization-free-share-exceeded` | this wallet has no monthly budget of its own and shares what the application (or the organization) keeps unallocated, the free share. Other wallets' reservations are untouchable, so it can run out while the budget above still has room | tell the user the free share is used; do not retry or try another wallet to get round it. The user gives this wallet a monthly budget of its own (wallet page, Spending rules → Edit → Monthly budget (capped)) or asks for a larger one, which may need an Owner to raise the organization; never split the payment |
|
|
559
|
+
| `policy/budget-currency-mismatch` | the wallet policy is in another currency than its organization's budgets, so they cannot be compared: no payment goes through until that is fixed | do not retry; tell the user an Owner or Admin must put the wallet policy in the organization currency (wallet page, Spending rules → Edit) |
|
|
560
|
+
| `policy/recipient-…`, `policy/domain-…` | destination not allowed at some scope | the user changes the destination rule; you change it through the admin tools only if they ask you to |
|
|
561
|
+
| `policy/mission-required` | this wallet only pays inside a mission run, and the payment named none | pay inside a run of the mission this task belongs to: start one with `agent-wallet:start_mission_run` if none is active, or ask the user which mission it is; if no mission is published for the task (`MISSION_NOT_PUBLISHED`), tell the user a person publishes one in the dashboard, or an Owner or Admin turns off the requirement; never start a run of an unrelated mission to get the payment through; do not retry without a run |
|
|
562
|
+
| `policy/mission-run-not-found` | the run id is unknown or belongs to another wallet | check the id with `agent-wallet:list_mission_runs`; do not guess another |
|
|
372
563
|
| `policy/mission-run-not-active: <status>` | the run is not active: `pending_approval` (an operator has not approved it yet), `declined`, `abandoned`, `cancelled` or `completed` | tell the user the status; wait for approval or start a new run (Missions, above); never reuse an ended run |
|
|
373
564
|
| `policy/mission-run-not-active: expired` | the run passed its deadline | start a new run if the task continues |
|
|
374
|
-
| `policy/mission-run-not-active: currency_mismatch` | the wallet's policy currency changed after the run started, so the envelope no longer matches | do not retry; the user must recreate the mission in the new currency and start a new run |
|
|
375
|
-
| `policy/envelope-exceeded: … (<key>)` | the payment would take the spent total above a cap: the key is the run's id | report which one; finish or abandon the run, or ask the user for a mission with a larger envelope; never split the payment |
|
|
565
|
+
| `policy/mission-run-not-active: currency_mismatch` | the wallet's policy currency changed after the run started, so the run envelope no longer matches | do not retry; the user must recreate the mission in the new currency and start a new run |
|
|
566
|
+
| `policy/envelope-exceeded: … (<key>)` | the payment would take the spent total above a cap: the key is the run's id | report which one; finish or abandon the run, or ask the user for a mission with a larger run envelope; never split the payment |
|
|
376
567
|
| `policy/domain-mission-not-allowed: <METHOD host/path>` (x402), `policy/recipient-mission-not-allowed` (transfer) | the destination is not among the mission's sources (or recipients); for x402 the whole `METHOD host/path` is compared | pick a service the mission names, with the method and path it names; to add one, update the mission with `agent-wallet:update_mission`, play a trial, and the user publishes the new version |
|
|
377
568
|
| `policy/intent-in-flight` | an earlier transfer is still pending | wait for it, or cancel it with `agent-wallet:cancel_intent` |
|
|
378
|
-
| `policy/emergency-stop` | the wallet is paused |
|
|
379
|
-
| `policy/transaction-quota-reached` | the organization's monthly transaction quota (its plan) is used up — for every wallet of the organization, until the 1st of next month (UTC) | do not retry; ask an
|
|
569
|
+
| `policy/emergency-stop` | the wallet is paused, by an operator or by the end of the free trial | an operator resumes it on the wallet page; once the free trial has ended, upgrading the plan resumes the wallets it paused |
|
|
570
|
+
| `policy/transaction-quota-reached` | the organization's monthly transaction quota (its plan) is used up — for every wallet of the organization, until the 1st of next month (UTC) | do not retry; ask an Owner or Admin to upgrade the plan, or on a plan that allows it, allow billed overage in Billing → Usage (Free plan: only an upgrade) |
|
|
380
571
|
| `policy/missing` | the wallet has no policy (403 at signing) | ask the user to open the wallet page; do not retry |
|
|
381
572
|
| `policy/x402-no-exact-accept` | the seller only offers an x402 payment scheme the wallet cannot settle yet (e.g. `upto`) — a current limit of the wallet, not a budget problem | do not retry; pick another provider and tell the user |
|
|
382
573
|
| `policy/x402-…` | the seller's x402 offer cannot be paid (unreachable, malformed, invalid recipient, wrong asset or chain, above `maxAmount`) | pick another provider |
|
|
@@ -392,19 +583,32 @@ threshold, and never route a payment around a destination rule.
|
|
|
392
583
|
|
|
393
584
|
## Troubleshooting
|
|
394
585
|
|
|
395
|
-
- The agent wallet MCP shows `setup_instructions`: it is not configured
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
586
|
+
- The agent wallet MCP shows `setup_instructions`: it is not configured, an
|
|
587
|
+
entry of the wallet's file being missing or invalid (`KEYBAN_NETWORK` is one:
|
|
588
|
+
never invent a value). Call it, then send the user to the dashboard's `Set up`
|
|
589
|
+
line and follow the setup skill.
|
|
399
590
|
- `agent-wallet:api_status` checks that the Keyban API answers.
|
|
400
|
-
- Running the agent wallet MCP on Amazon Bedrock AgentCore: see the
|
|
401
|
-
README.
|
|
402
|
-
- The
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
591
|
+
- Running the agent wallet MCP on Amazon Bedrock AgentCore (beta): see the
|
|
592
|
+
package README.
|
|
593
|
+
- The wallet's file, `$XDG_CONFIG_HOME/keyban/wallets/<wallet id>.json`
|
|
594
|
+
(`~/.config/keyban/wallets/<wallet id>.json` by default, mode 600), holds the
|
|
595
|
+
API key and, once the first wallet call has made it, the key share. Keep it
|
|
596
|
+
like a password: any program running as the user can read it and run
|
|
597
|
+
`keyban`, and any agent with access to it can ask Keyban to pay from the
|
|
598
|
+
wallet within the policy. If the key share or the API key may have
|
|
599
|
+
leaked, ask the user to pause the wallet now with the emergency stop, then to
|
|
600
|
+
replace the agent's key: register a new key, install it and let it connect
|
|
601
|
+
once, then revoke the old one; that revokes both, and the address stays. Before the
|
|
602
|
+
agent's first connection the file also holds the invitation, which lets
|
|
603
|
+
whoever uses it first register their own key. Neither the admin tools nor the
|
|
604
|
+
dashboard offer these steps: they go through the Keyban API
|
|
605
|
+
(`/v1/agent-wallets/{walletId}/signers`). What a leak gives, and what to do:
|
|
606
|
+
https://docs.keyban.io/solutions/agent-wallet/security/agent-wallets.md#what-a-leaked-credential-gives-an-attacker.
|
|
607
|
+
A prepaid account has no key to replace: ask the user to have an admin
|
|
406
608
|
pause the account at once, then delete it and create a new one, with a new
|
|
407
609
|
MCP configuration.
|
|
610
|
+
- The key share stays on the machine that generated it: reinstalling the wallet
|
|
611
|
+
there works, installing it on another machine is refused (`SIGNER_DKG_ALREADY_COMPLETED`).
|
|
408
612
|
- A payment fails with `FUNDING_SIGNED_BY_SERVER`: this agent wallet MCP is too
|
|
409
613
|
old to pay it. Ask the user to update it.
|
|
410
614
|
- A payment fails with `FUNDING_UNAVAILABLE`: `agent-wallet:x402_pay` already
|
|
@@ -418,10 +622,18 @@ threshold, and never route a payment around a destination rule.
|
|
|
418
622
|
|
|
419
623
|
## Links
|
|
420
624
|
|
|
421
|
-
-
|
|
422
|
-
-
|
|
423
|
-
-
|
|
424
|
-
-
|
|
425
|
-
-
|
|
625
|
+
- Install a wallet on a machine (setup skill): https://docs.keyban.io/.well-known/agent-skills/keyban-agent-wallet-setup/SKILL.md
|
|
626
|
+
- Give wallets to the agents a user builds (integrate skill, for a coding agent): https://docs.keyban.io/.well-known/agent-skills/keyban-agent-wallet-integrate/SKILL.md
|
|
627
|
+
- Agent wallet overview: https://docs.keyban.io/solutions/agent-wallet/introduction.md
|
|
628
|
+
- Compatible agents: https://docs.keyban.io/solutions/agent-wallet/introduction.md#compatible-agents
|
|
629
|
+
- Security model: https://docs.keyban.io/solutions/agent-wallet/security.md
|
|
630
|
+
- Shared key and leaked credentials: https://docs.keyban.io/solutions/agent-wallet/security/agent-wallets.md#what-a-leaked-credential-gives-an-attacker
|
|
631
|
+
- CLI, MCP and API (the ways in, and the sign-in of the admin tools): https://docs.keyban.io/solutions/agent-wallet/cli-mcp-api.md
|
|
632
|
+
- Admin tools: https://docs.keyban.io/solutions/agent-wallet/reference/admin-mcp-tools.md
|
|
633
|
+
- Agent wallet MCP tools: https://docs.keyban.io/solutions/agent-wallet/reference/wallet-mcp-tools.md
|
|
634
|
+
- Refusal reasons: https://docs.keyban.io/solutions/agent-wallet/reference/refusal-reasons.md
|
|
635
|
+
- Dashboard: https://admin.keyban.io
|
|
426
636
|
- Pricing: https://www.keyban.io/en/pricing/agent-wallet/
|
|
637
|
+
- Support, for anything this guide does not settle (a plan, a wallet that
|
|
638
|
+
cannot be created): support@keyban.io
|
|
427
639
|
- Agent wallet MCP package: https://www.npmjs.com/package/@keyban/cli
|