@keyban/cli 0.1.3 → 0.2.1
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 +31 -1
- package/SKILL.md +281 -20
- package/dist/index.mjs +3291 -1393
- package/dist/index.mjs.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -115,6 +115,9 @@ Read-only:
|
|
|
115
115
|
| `wait_for_intent` | Wait for approval decisions |
|
|
116
116
|
| `x402_info` | Inspect the x402 price of a URL |
|
|
117
117
|
| `discover_x402_services` | Search the x402 service directory |
|
|
118
|
+
| `list_missions`, `get_mission` | Read the missions and their statistics |
|
|
119
|
+
| `list_mission_runs`, `get_mission_run` | Read this wallet's mission runs |
|
|
120
|
+
| `publish_mission` | Check a draft can be published and show the page to publish it |
|
|
118
121
|
|
|
119
122
|
Writing:
|
|
120
123
|
|
|
@@ -124,6 +127,9 @@ Writing:
|
|
|
124
127
|
| `cancel_intent` | Cancel a pending payment intent |
|
|
125
128
|
| `transfer_usdc` | Transfer USDC — moves funds |
|
|
126
129
|
| `x402_pay` | Pay for an x402 resource — moves funds |
|
|
130
|
+
| `create_mission`, `update_mission`, `discard_mission_draft` | Draft a mission on this wallet |
|
|
131
|
+
| `request_mission_trial` | Ask a trial of the draft, validated by a human |
|
|
132
|
+
| `start_mission_run`, `log_mission_progress`, `complete_mission_run`, `abandon_mission_run` | Run a mission |
|
|
127
133
|
|
|
128
134
|
Every tool carries a `title` and the applicable `readOnlyHint` or
|
|
129
135
|
`destructiveHint`, so a client can tell the two groups apart before calling
|
|
@@ -134,10 +140,34 @@ anything.
|
|
|
134
140
|
Transfers and x402 payments are checked against the wallet's policy on the
|
|
135
141
|
Keyban side. A call the policy will not clear on its own does not fail
|
|
136
142
|
silently: it comes back naming a payment intent that needs a human decision.
|
|
137
|
-
|
|
143
|
+
The answer carries the link to approve it and the next steps;
|
|
144
|
+
`wait_for_intent` blocks until a wallet operator approves or declines, and the agent
|
|
138
145
|
retries once it is approved. The policy lives with the wallet, not with this
|
|
139
146
|
process, so editing this server's configuration cannot widen it.
|
|
140
147
|
|
|
148
|
+
In clients that render MCP apps (Claude, Claude Desktop, ChatGPT…),
|
|
149
|
+
`x402_pay` and `transfer_usdc` show a card and wait for the decision in the
|
|
150
|
+
same call: the amount, who it pays, a countdown to the deadline, a button that
|
|
151
|
+
opens the payment in the Keyban dashboard and one that withdraws the request.
|
|
152
|
+
Once approved, the call signs and settles, and the card turns into a receipt.
|
|
153
|
+
The card follows the payment through `await_payment_approval` and
|
|
154
|
+
`watch_payment_approval`, tools only it can call. It approves nothing:
|
|
155
|
+
approval needs the user's own Keyban session.
|
|
156
|
+
|
|
157
|
+
The mission tools come from the Keyban API description (`/openapi.json`, kept
|
|
158
|
+
in the user's cache), called with the wallet's key on its own wallet.
|
|
159
|
+
`request_mission_trial`, an on-demand `start_mission_run` and
|
|
160
|
+
`publish_mission` show a mission card: what is asked, a button that opens the
|
|
161
|
+
trial, the run or the mission page in the dashboard, and its status until a
|
|
162
|
+
human decides, through `watch_mission_approval`. Validating and publishing
|
|
163
|
+
stay the user's, in the dashboard.
|
|
164
|
+
|
|
165
|
+
In clients that declare URL elicitation but render no MCP apps (Claude Code),
|
|
166
|
+
the held payment asks the client to open the approval page instead: the client
|
|
167
|
+
shows the user the URL, opens it in the browser once they agree, and the call
|
|
168
|
+
waits for the decision just as with the card. A client that does neither gets
|
|
169
|
+
the link and the steps in the answer.
|
|
170
|
+
|
|
141
171
|
## Trust boundary
|
|
142
172
|
|
|
143
173
|
The share and the API key are protected by your user account, nothing finer.
|
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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 APIs, transfer USDC, check its balance or spending, or when a payment waits for a human or is refused by the policy. Creating and configuring the wallet is the keyban-admin skill.
|
|
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 APIs, transfer USDC, check its balance or spending, or when a payment waits for a human or is refused by the policy, or to draft and run a mission. Creating and configuring the wallet is the keyban-admin skill.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Keyban Agent Wallet
|
|
@@ -19,7 +19,7 @@ Keyban, and neither side can sign alone.
|
|
|
19
19
|
| Acts as | the signed-in user (OAuth) | the agent, through one wallet |
|
|
20
20
|
| Runs | remote, `https://mcp.keyban.io/mcp` | local, `npx -y @keyban/cli@latest mcp` |
|
|
21
21
|
| Default server name | `keyban` | `agent-wallet` |
|
|
22
|
-
| Does | organization, applications, agent wallets, destination rules, x402 catalogue, quotas, billing | balance, spending, USDC transfers, x402 payments, approval waits |
|
|
22
|
+
| Does | organization, applications, agent wallets, destination rules, x402 catalogue, quotas, billing | balance, spending, USDC transfers, x402 payments, approval waits, missions |
|
|
23
23
|
| Does not | spend, install the wallet's signer, approve payments, edit an existing wallet's spending caps | create or configure wallets, approve its own payments |
|
|
24
24
|
| Guide | `keyban:get_instructions`, the `keyban-admin` skill | `agent-wallet:get_instructions`, this skill |
|
|
25
25
|
|
|
@@ -48,19 +48,40 @@ API key and a one-shot invite key.
|
|
|
48
48
|
|
|
49
49
|
## Fund the wallet — human
|
|
50
50
|
|
|
51
|
-
Not needed for a payment the Keyban welcome offer covers (see below)
|
|
51
|
+
Not needed for a payment the Keyban welcome offer covers (see below), nor on a
|
|
52
|
+
prepaid account (see below).
|
|
52
53
|
|
|
53
54
|
USDC on the wallet's network, sent to the address from
|
|
54
55
|
`agent-wallet:get_account_info`. The wallet page in the dashboard also offers a
|
|
55
56
|
card top-up (Base mainnet only, 5 to 999 EUR per purchase) and a top-up request
|
|
56
57
|
to a teammate. Test USDC: https://faucet.circle.com/
|
|
57
58
|
|
|
59
|
+
## Prepaid account
|
|
60
|
+
|
|
61
|
+
Only when `agent-wallet:get_account_info` starts with `Account: prepaid`;
|
|
62
|
+
otherwise skip this section. A prepaid account has no wallet of its own: no
|
|
63
|
+
address and no key share on this machine for you to handle. It does have a
|
|
64
|
+
network, the one Keyban pays on, shown by `agent-wallet:get_account_info`.
|
|
65
|
+
Keyban pays the seller of each x402 payment and debits the prepaid credit of the
|
|
66
|
+
organization, shared by all its prepaid accounts.
|
|
67
|
+
|
|
68
|
+
- The balance is that credit, in euros: `agent-wallet:balance` reports it. A
|
|
69
|
+
welcome credit offered by Keyban to a new organization is part of it, and
|
|
70
|
+
`agent-wallet:balance` shows what is left of it.
|
|
71
|
+
- Pay with `agent-wallet:x402_pay`. `agent-wallet:transfer_usdc` and
|
|
72
|
+
`agent-wallet:sign_message` are not offered: there is nothing to sign or send
|
|
73
|
+
from an address.
|
|
74
|
+
- The mission tools are not offered either: missions do not run on a prepaid
|
|
75
|
+
account yet.
|
|
76
|
+
- "Fund the wallet" does not apply. When the credit runs out, the payment is
|
|
77
|
+
refused with `policy/prepaid-balance-insufficient` (see the table below).
|
|
78
|
+
|
|
58
79
|
## Operate the wallet
|
|
59
80
|
|
|
60
81
|
- Read: `agent-wallet:balance` (report the fiat value first),
|
|
61
82
|
`agent-wallet:expense_stats`, `agent-wallet:list_expense_transactions`.
|
|
62
|
-
-
|
|
63
|
-
offer, shown by `agent-wallet:balance` and `agent-wallet:get_account_info`.
|
|
83
|
+
- On a wallet, a new organization's first payments may be covered by the Keyban
|
|
84
|
+
welcome offer, shown by `agent-wallet:balance` and `agent-wallet:get_account_info`.
|
|
64
85
|
On first use, report it with the balance, and do not say the wallet needs
|
|
65
86
|
funding while the offer has an amount left that covers the payment. The
|
|
66
87
|
offer pays a payment only when its whole price fits in what is left, so a
|
|
@@ -83,25 +104,240 @@ to a teammate. Test USDC: https://faucet.circle.com/
|
|
|
83
104
|
|
|
84
105
|
A service listed "via" a gateway (e.g. Orthogonal) is paid the same way: the
|
|
85
106
|
gateway collects the payment and calls the provider for you.
|
|
86
|
-
- Send USDC: `agent-wallet:transfer_usdc`,
|
|
87
|
-
base units.
|
|
107
|
+
- Send USDC (a wallet only, not a prepaid account): `agent-wallet:transfer_usdc`,
|
|
108
|
+
amount in USDC (`"1.5"`), not in base units.
|
|
88
109
|
|
|
89
110
|
The policy is the user's authorization: do not ask the user to confirm a payment
|
|
90
111
|
the policy allows.
|
|
91
112
|
|
|
92
113
|
## When a human must approve
|
|
93
114
|
|
|
94
|
-
A payment above the approval threshold is held
|
|
95
|
-
`intentId
|
|
115
|
+
A payment above the approval threshold is held for the wallet's operators.
|
|
116
|
+
The answer is not an error: it gives the `intentId`, the link to approve it
|
|
117
|
+
and what to do next. Follow it.
|
|
118
|
+
|
|
119
|
+
- In clients that show MCP apps, or that can open the approval page for the
|
|
120
|
+
user (URL elicitation), `x402_pay` and `transfer_usdc` wait for the decision
|
|
121
|
+
themselves while an operator approves, then go on. If one comes back still
|
|
122
|
+
waiting, call it again as the answer says.
|
|
123
|
+
- Elsewhere, in one message, tell the user the amount, the recipient, the
|
|
124
|
+
deadline and the link, and call `agent-wallet:wait_for_intent` (it waits at
|
|
125
|
+
most 45 s); call it again each time it comes back still waiting. A decision taken before the
|
|
126
|
+
call shows in `recentlyDecided`. Once approved, retry the same call with
|
|
127
|
+
that `intentId` (a transfer: the same recipient and amount).
|
|
128
|
+
|
|
129
|
+
The wallet's operators are notified and decide from the dashboard; approval
|
|
130
|
+
needs their own session: no tool can approve. Never start a new payment for
|
|
131
|
+
the same purchase: it creates a second intent. To withdraw a pending request,
|
|
132
|
+
call `agent-wallet:cancel_intent`.
|
|
133
|
+
|
|
134
|
+
## Missions
|
|
135
|
+
|
|
136
|
+
A mission is the budget and the brief an agent gets for one task: what to do,
|
|
137
|
+
which services may be paid and how often, how much per run, who may run it and how.
|
|
138
|
+
You write it as a draft and try it; a human validates the trial and an operator
|
|
139
|
+
publishes it; then it runs as many times as needed, by one wallet or by many.
|
|
140
|
+
Every mission tool acts on this server's own wallet: never pass a wallet id.
|
|
141
|
+
On a prepaid account there are no mission tools: skip this section.
|
|
142
|
+
|
|
143
|
+
Missions are open to pilot organizations only. Elsewhere every mission tool
|
|
144
|
+
answers `AGENT_WALLET_MISSIONS_DISABLED` (403): it is not a bug and the request
|
|
145
|
+
is valid, so do not retry it. Tell the user missions are not enabled for their
|
|
146
|
+
organization yet, and that Keyban can enable them.
|
|
147
|
+
|
|
148
|
+
### When to propose one
|
|
149
|
+
|
|
150
|
+
When the user asks an agent to do something repeatable that costs money (enrich
|
|
151
|
+
leads, fetch pages, run a nightly job), or when a wallet already pays the same
|
|
152
|
+
services over and over. Do not invent a task: read what the wallet really paid
|
|
153
|
+
(`agent-wallet:list_expense_transactions`, the x402 services it called) and the
|
|
154
|
+
missions that already exist (`agent-wallet:list_missions`,
|
|
155
|
+
`agent-wallet:get_mission`) first. If one fits, run it; if one nearly fits,
|
|
156
|
+
`agent-wallet:update_mission` opens a draft of the next version. Otherwise
|
|
157
|
+
create one that names, budgets and scopes what the agent already does.
|
|
158
|
+
|
|
159
|
+
### Write the brief
|
|
160
|
+
|
|
161
|
+
`brief` is what the agent reads at the start of every run, so write it for an
|
|
162
|
+
agent: the goal in one sentence, the inputs it gets, the steps, what a finished
|
|
163
|
+
unit looks like, what to do when a service fails, when to stop. Say which
|
|
164
|
+
services to use and which never to use. Markdown, at most 8000 characters. A
|
|
165
|
+
good brief can be followed by an agent that has no other context. `title` is the
|
|
166
|
+
short name; `key` is the stable kebab-case identifier (`lead-enrichment`).
|
|
167
|
+
|
|
168
|
+
### Fields
|
|
169
|
+
|
|
170
|
+
`agent-wallet:create_mission` describes its own fields. Go in this order:
|
|
171
|
+
|
|
172
|
+
1. Understand the task, and check the wallet balance
|
|
173
|
+
(`agent-wallet:balance`) first: a mission the wallet cannot fund is
|
|
174
|
+
useless.
|
|
175
|
+
2. Create the draft right away with the `sources` you propose: for each, the
|
|
176
|
+
endpoint, what you expect from it, the calls planned per unit (per run when
|
|
177
|
+
the task has no unit) and the price of one call, read in the x402
|
|
178
|
+
catalogue. That plan is an estimate, never a limit: the sources are the
|
|
179
|
+
services the mission allows. The draft shows no card: the user corrects it
|
|
180
|
+
in chat, and you apply the corrections with `agent-wallet:update_mission`.
|
|
181
|
+
Do not ask for the list beforehand. For a change to an existing mission,
|
|
182
|
+
the same rule: `agent-wallet:update_mission` opens the next version right
|
|
183
|
+
away; do not ask before, do not propose in text.
|
|
184
|
+
3. Propose the price per unit yourself, in the draft: the cost of one unit
|
|
185
|
+
(the sum of the sources' calls × price) plus a margin. The envelope of a
|
|
186
|
+
run is that price × the units of the mission, and it is the only limit on
|
|
187
|
+
spend. There is no cap over all the runs of a mission. Do not ask the user
|
|
188
|
+
for amounts: they correct the ones on the trial card.
|
|
189
|
+
4. Leave the rest at its defaults (duration 1 day, no limit on simultaneous
|
|
190
|
+
runs): do not ask.
|
|
191
|
+
5. On a task with units, `unitCount` is an estimate used for the envelope, not
|
|
192
|
+
a limit: a run may handle more or fewer units. A trial plays a small sample
|
|
193
|
+
of units, not a whole run: when you ask it, pass `unitCount`, the sample, a
|
|
194
|
+
few units; you may propose its size to the user.
|
|
195
|
+
|
|
196
|
+
Amounts are integer strings in cents of the organization's currency, never
|
|
197
|
+
decimals: 0.05 EUR is `"5"`, 30.00 EUR is `"3000"`. A decimal is refused with a
|
|
198
|
+
400. One exception: the price of one call of a source (`callPriceRef`) takes up
|
|
199
|
+
to 3 decimals of a cent, as an x402 call often costs less than one: 0.003 EUR is
|
|
200
|
+
`"0.3"`. Prices of the sources are in the mission's currency.
|
|
96
201
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
202
|
+
- Each source is `METHOD host/path`, for example `POST api.exa.ai/search`, with
|
|
203
|
+
a plain path: no query string, no percent-encoding, no `.` or `..` segment;
|
|
204
|
+
one source per endpoint. The server refuses with `MISSION_ENDPOINT_INVALID`
|
|
205
|
+
what it cannot read unambiguously.
|
|
206
|
+
- The plan is your honest estimate: the calls one unit needs and the price of
|
|
207
|
+
one call read in the catalogue. Put the margin in the unit price, not in the
|
|
208
|
+
plan.
|
|
209
|
+
- The target price per unit is a hint, not a guarantee: say « envelope 30 EUR
|
|
210
|
+
`"3000"` (100 leads at a 0.30 EUR target) », never « at most 0.30 EUR per lead ».
|
|
211
|
+
- `maxPaymentRef`, `exemptFromWalletBudgets` and `maxActiveRunsPerWallet` only
|
|
212
|
+
when the task needs them. Say plainly what each one lifts: the user will see
|
|
213
|
+
it flagged.
|
|
214
|
+
|
|
215
|
+
### Around a card
|
|
216
|
+
|
|
217
|
+
Several tools show a card to the user. Write at most one sentence before it,
|
|
218
|
+
which does not repeat what it shows, and nothing after it: the card is the call
|
|
219
|
+
to action and ends the message. In French, say « essai », never « trial ».
|
|
220
|
+
|
|
221
|
+
### Try, then publish
|
|
222
|
+
|
|
223
|
+
1. `agent-wallet:create_mission` (or `agent-wallet:update_mission` to change the
|
|
224
|
+
open draft, or to open a draft of the next version from a published one).
|
|
225
|
+
Any change voids the trials already done.
|
|
226
|
+
2. `agent-wallet:request_mission_trial`, right after the draft call, without
|
|
227
|
+
asking the user in the chat first: the only approval is the user's
|
|
228
|
+
« Validate in Keyban ». It asks a trial of the draft on this wallet; on a
|
|
229
|
+
task with units, pass `unitCount`, the sample (a few units). It returns at
|
|
230
|
+
once with a card, which the user validates in the Inbox of the dashboard
|
|
231
|
+
(an operator of the wallet; the organization's finance owner too when the
|
|
232
|
+
draft loosens application or organization rules). Then call
|
|
233
|
+
`agent-wallet:wait_for_mission_run` with the `runId`, again and again while
|
|
234
|
+
it says the decision is pending: do not ask the user to tell you. If the
|
|
235
|
+
finance owner declines what the draft loosens, the trial is declined with
|
|
236
|
+
it: change the draft and ask a new trial. The card then follows the run:
|
|
237
|
+
the user sees the payments as they happen, so write nothing in between.
|
|
238
|
+
3. Once the trial is active, play it like a run without asking again (the
|
|
239
|
+
validation is the go-ahead): pay with the `*_in_mission` tools (below),
|
|
240
|
+
record progress, deliver the work result, then
|
|
241
|
+
`agent-wallet:complete_mission_run`. The trial uses real money, inside the
|
|
242
|
+
trial's envelope (sample size × unit price). It must make at least one
|
|
243
|
+
payment, or the draft cannot be published: ask a new trial that pays.
|
|
244
|
+
4. After a successful trial the end-of-run card carries « Publish mission in
|
|
245
|
+
Keyban »: do not call `agent-wallet:publish_mission` then. The user
|
|
246
|
+
publishes in the dashboard, as an operator of the wallet; you cannot
|
|
247
|
+
publish, approve or decline. `agent-wallet:publish_mission` stays for
|
|
248
|
+
publishing later: it checks the draft can be published and shows a card
|
|
249
|
+
with the page. A refusal says what is missing (a completed trial of the
|
|
250
|
+
current content, a trial that paid, the finance owner's approval of what
|
|
251
|
+
the draft loosens). Publication may lower the unit price and the envelope
|
|
252
|
+
to the cost the trial observed: do not adjust them yourself.
|
|
253
|
+
To drop a draft, `agent-wallet:discard_mission_draft`.
|
|
254
|
+
|
|
255
|
+
While a draft v2 is being tuned, the published v1 keeps running.
|
|
256
|
+
|
|
257
|
+
### Optimize an existing mission
|
|
258
|
+
|
|
259
|
+
When the user wants a mission to cost less, or to use other sources:
|
|
260
|
+
|
|
261
|
+
1. Read the mission (`agent-wallet:get_mission`) and the `versionStats` entry
|
|
262
|
+
of its published version: `bySource` says which source costs what, in amount
|
|
263
|
+
and in share (`shareBps`). Tell the user which source weighs what; a
|
|
264
|
+
`basis` of `trial` means the version only ran as trials.
|
|
265
|
+
2. Look for an alternative (`agent-wallet:discover_x402_services`,
|
|
266
|
+
`agent-wallet:x402_info`): the price of one call, read in the catalogue or
|
|
267
|
+
from the seller.
|
|
268
|
+
3. Open the draft right away with `agent-wallet:update_mission`, without asking
|
|
269
|
+
for agreement and without asking about amounts: the draft is the proposal,
|
|
270
|
+
the user corrects it in chat. The « create right away » rule holds for a
|
|
271
|
+
change as for a creation.
|
|
272
|
+
4. Ask the trial right away, wait for the decision, execute, deliver the result,
|
|
273
|
+
then `agent-wallet:complete_mission_run` last: its card compares the unit
|
|
274
|
+
cost of the run with the published version. Write nothing after it.
|
|
275
|
+
5. A trial that paid nothing proves nothing: say so in one sentence before the
|
|
276
|
+
end-of-run card.
|
|
277
|
+
|
|
278
|
+
### Run it
|
|
279
|
+
|
|
280
|
+
A mission may have several runs active at once, started by other
|
|
281
|
+
conversations or other agents. Only touch the runs you started in this
|
|
282
|
+
conversation: never log progress on, complete or abandon another one (its work
|
|
283
|
+
and its results are elsewhere). Start your own run and leave the others alone.
|
|
284
|
+
|
|
285
|
+
1. `agent-wallet:start_mission_run` with the mission; optionally `units` (unit
|
|
286
|
+
tokens such as ids) or `unitCount`; it may exceed the mission's estimate.
|
|
287
|
+
It returns at once with a run id: `active`, or `pending_approval` in
|
|
288
|
+
`on_demand` mode, then a card shows it to the user, who approves it in the
|
|
289
|
+
Inbox. Call `agent-wallet:wait_for_mission_run` with the `runId` until the
|
|
290
|
+
decision: do not ask the user to tell you. Once active, execute without
|
|
291
|
+
asking again.
|
|
292
|
+
2. Pay with `agent-wallet:x402_pay_in_mission` and
|
|
293
|
+
`agent-wallet:transfer_usdc_in_mission`, passing the run id as `missionRunId`
|
|
294
|
+
(required). `agent-wallet:x402_pay` and `agent-wallet:transfer_usdc` refuse a
|
|
295
|
+
`missionRunId`. The run is the budget a human validated for the task: each
|
|
296
|
+
payment counts against the run's envelope. Inside a trial and an on-demand
|
|
297
|
+
run the approval threshold is lifted; inside an automatic or frequency run it
|
|
298
|
+
still applies, and a payment above it waits for an operator: the tool then
|
|
299
|
+
returns the approval link in text. Do not attach a payment to a run it does
|
|
300
|
+
not serve: the server cannot tell, so the user relies on you for the right
|
|
301
|
+
run. These tools show no card. From the command line the same calls are
|
|
302
|
+
`keyban wallet x402-pay-in-mission` and `keyban wallet transfer-usdc-in-mission`,
|
|
303
|
+
with `--mission-run-id <runId>`. Without a run id a payment is evaluated
|
|
304
|
+
under the wallet policy alone, unless the policy requires a mission
|
|
305
|
+
(`policy/mission-required`).
|
|
306
|
+
3. Record progress with `agent-wallet:log_mission_progress` (`unitsDone`,
|
|
307
|
+
idempotent, or `unitsDoneCount`, and a `note`). `agent-wallet:get_mission_run`
|
|
308
|
+
returns what is spent and left and the units remaining: after an
|
|
309
|
+
interruption, read it and continue from the remaining units.
|
|
310
|
+
4. When done, deliver the work result first, then call
|
|
311
|
+
`agent-wallet:complete_mission_run`: its card ends the message.
|
|
312
|
+
`agent-wallet:abandon_mission_run` withdraws a run still waiting for
|
|
313
|
+
approval.
|
|
314
|
+
|
|
315
|
+
Refusals of `agent-wallet:start_mission_run`:
|
|
316
|
+
|
|
317
|
+
- `MISSION_RUN_FREQUENCY_REACHED` (409): the wallet already started as many
|
|
318
|
+
runs as the mission allows in the current period. `params.retryAt` (ISO 8601,
|
|
319
|
+
UTC) is when it may start again. Do not retry before; tell the user when.
|
|
320
|
+
- `MISSION_RUN_LIMIT_REACHED` (409): the mission limits the simultaneous runs
|
|
321
|
+
per wallet and this wallet reached it. Finish one of your own runs first; if
|
|
322
|
+
the others are not yours, tell the user and stop.
|
|
323
|
+
- `MISSION_NOT_PUBLISHED` (409): nothing is published yet (ask a trial) or the
|
|
324
|
+
mission is archived.
|
|
325
|
+
- `MISSION_RUN_WALLET_OUT_OF_SCOPE` (403): this wallet is outside the mission's
|
|
326
|
+
sharing.
|
|
327
|
+
- `MISSION_RUN_OUT_OF_MISSION` (422): the run does not fit the mission; read
|
|
328
|
+
the error, then start a run that fits or tell the user.
|
|
329
|
+
|
|
330
|
+
A run that no longer fits cannot be edited: start another one. A run that goes
|
|
331
|
+
over its envelope, its destinations or its deadline is refused with a `policy/…` reason (below). A payment above the wallet's
|
|
332
|
+
approval threshold in an `auto` or `frequency` run waits for an operator in the
|
|
333
|
+
Inbox, who may allow it for the next runs of the mission. Stopping an active
|
|
334
|
+
run is a human decision, in the dashboard.
|
|
335
|
+
|
|
336
|
+
`agent-wallet:list_missions` and `agent-wallet:get_mission` return the
|
|
337
|
+
statistics (runs by status, total spent,
|
|
338
|
+
observed price per unit next to the target) and the limits currently blocking a
|
|
339
|
+
start, with their `retryAt`. `agent-wallet:list_mission_runs` and
|
|
340
|
+
`agent-wallet:get_mission_run` read the runs of this wallet.
|
|
105
341
|
|
|
106
342
|
## When the policy refuses
|
|
107
343
|
|
|
@@ -113,12 +349,24 @@ that payment.
|
|
|
113
349
|
| `policy/amount-exceeded` | above the per-payment cap | raise the cap on the wallet page |
|
|
114
350
|
| `policy/budget-day-exceeded`, `-week-`, `-month-` | the period's budget is used | wait, or raise the budget on the wallet page |
|
|
115
351
|
| `policy/recipient-…`, `policy/domain-…` | destination not allowed at some scope | change a destination rule, through the admin MCP only if the user asks |
|
|
352
|
+
| `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 |
|
|
353
|
+
| `policy/mission-run-not-found` | the run id is unknown, belongs to another wallet, or missions are not available | check the id with `agent-wallet:list_mission_runs`; do not guess another |
|
|
354
|
+
| `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 |
|
|
355
|
+
| `policy/mission-run-not-active: expired` | the run passed its deadline | start a new run if the task continues |
|
|
356
|
+
| `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 |
|
|
357
|
+
| `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 |
|
|
358
|
+
| `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 |
|
|
116
359
|
| `policy/intent-in-flight` | an earlier transfer is still pending | wait for it, or cancel it with `agent-wallet:cancel_intent` |
|
|
117
360
|
| `policy/emergency-stop` | the wallet is paused | resume it on the wallet page |
|
|
118
361
|
| `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 organization admin to upgrade the plan or allow billed overage in Billing → Usage |
|
|
119
362
|
| `policy/missing` | the wallet has no policy (403 at signing) | ask the user to open the wallet page; do not retry |
|
|
120
363
|
| `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 |
|
|
121
|
-
| `policy/x402-…` | the seller's x402 offer cannot be paid (unreachable, malformed, wrong asset or chain, above `maxAmount`) | pick another provider |
|
|
364
|
+
| `policy/x402-…` | the seller's x402 offer cannot be paid (unreachable, malformed, invalid recipient, wrong asset or chain, above `maxAmount`) | pick another provider |
|
|
365
|
+
| `policy/prepaid-balance-insufficient` | the prepaid credit of the organization does not cover the payment | tell the user an admin must buy a pack in Billing → Prepaid credit; never retry or split the payment |
|
|
366
|
+
| `policy/prepaid-payer-unavailable`, `policy/prepaid-suspended` | Keyban cannot pay prepaid payments for now | report it; do not retry |
|
|
367
|
+
|
|
368
|
+
A destination refused with `mission` as scope is the mission's list; with
|
|
369
|
+
`wallet`, `application` or `organization`, it is that rule.
|
|
122
370
|
|
|
123
371
|
Never split a payment into smaller ones to stay under a cap or the approval
|
|
124
372
|
threshold, and never route a payment around a destination rule.
|
|
@@ -133,8 +381,21 @@ threshold, and never route a payment around a destination rule.
|
|
|
133
381
|
- Running the agent wallet MCP on Amazon Bedrock AgentCore: see the package
|
|
134
382
|
README.
|
|
135
383
|
- The signer's share or API key may have leaked: any program running as the
|
|
136
|
-
user can read them.
|
|
137
|
-
then delete the old one; that revokes both, and the address stays.
|
|
384
|
+
user can read them. On a wallet, rotate with the admin MCP: add a new signer,
|
|
385
|
+
set it up, then delete the old one; that revokes both, and the address stays.
|
|
386
|
+
A prepaid account has no signer to rotate: ask the user to have an admin
|
|
387
|
+
pause the account at once, then delete it and create a new one, with a new
|
|
388
|
+
MCP configuration.
|
|
389
|
+
- A payment fails with `FUNDING_SIGNED_BY_SERVER`: this agent wallet MCP is too
|
|
390
|
+
old to pay it. Ask the user to update it.
|
|
391
|
+
- A payment fails with `FUNDING_UNAVAILABLE`: `agent-wallet:x402_pay` already
|
|
392
|
+
evaluated it again once. Tell the user Keyban cannot pay this payment for
|
|
393
|
+
now; do not retry.
|
|
394
|
+
- A call fails with `FUNDING_NO_CLIENT_SIGNER`: the account is prepaid, so
|
|
395
|
+
Keyban signs its payments and no key share lives on this machine: no DKG, no
|
|
396
|
+
`agent-wallet:transfer_usdc`, no `agent-wallet:sign_message`. Pay with
|
|
397
|
+
`agent-wallet:x402_pay`; if it fails with this code too, this agent wallet
|
|
398
|
+
MCP is too old: ask the user to update it.
|
|
138
399
|
|
|
139
400
|
## Links
|
|
140
401
|
|