Missions
A mission gives a task that an agent repeats two things: a cost you can predict, control and explain, and a way of doing it that stays the same every run. It is a recipe: the brief, a short list of x402 services chosen once, and the most one run may cost, all tested with real money before it goes live. This page follows one example from start to finish. The steps in the dashboard and the agent's tools are in the how-to Run missions.
The example: enriching leads
Acme's sales agent receives new leads every morning. For each lead, it buys the company's details from a data service that charges through x402, about €0.06 per lead. Acme wants the agent to do this on its own, every day, without ever spending more than a few euros on one morning.
Acme writes this as a mission:
| Field | In the example |
|---|---|
| Brief | "For each new lead, buy the company profile from the data service and add it to the CRM." |
| Source (what the mission may pay) | The data service's x402 endpoint, api.example-data.com |
| Unit | A lead |
| Unit price | €0.10, a first guess with a margin |
| Units per run | 50, the usual number of leads in a morning |
| Run envelope | €0.10 × 50 = €5.00, the most one run may spend |
The rest of this page follows that mission.
Why use a mission
Acme already has a scheduler that starts its agent every morning. What a scheduler and the wallet's budgets do not give is control over what that task spends, and the assurance that the agent does it the same way every time. A mission brings both.
- Without a mission
A scheduler and the wallet's budgets
- Nobody knows what a morning will cost before it runs
- Only the wallet's daily, weekly or monthly budget stops a costly morning, shared by every task of the wallet
- The month's spending is one total: nobody can tell which task cost what
- The agent may use a different, untested service each time
- With the mission
The same tested recipe every run
- Each run costs at most €4.00, a figure known before it starts
- A person approved the recipe after a paid trial, and a run never exceeds its envelope
- Spending is broken down by mission: which ran, how many times, and what each cost
- The agent uses the same short list of services, already paid for real during the trial
In short, a mission gives a task the agent repeats a cost you can predict, control and explain, and a way of doing it that stays the same, on services proven before going live.
Costs you can predict, control and explain
- Known before it runs. Each run has a run envelope, €4.00 for Acme, so the most a run can cost is known before the agent starts. The run mode sets how many runs there are: one a day for Acme.
- Tested with real money. The envelope does not come from a guess alone: the trial paid real prices, and publication lowers the unit price to what the trial cost, plus a margin. See Life of a mission.
- Under human control. A person approves the trial and the publication, and each run in
on_demandmode, where the agent then pays within the run instead of having each payment approved. A run never spends more than its envelope, whatever happens during it. A mission that asks to loosen a rule, such as paying a service the organization's rules refuse, needs an Owner or Admin to approve it. See Overrides. - Explained afterwards. Every payment made in a run is tied to its mission. At the end of the month, Acme does not just see a total: it sees that the lead-enrichment mission ran 22 times and what it spent, next to the agent's other missions and to what it paid outside any mission. Each mission shows its number of runs and what it spent, and the Expenses list of the dashboard can be filtered by mission and exported to CSV with that filter. See Track spending.
Repeatable tasks, on predefined and proven services
- Predefined services. During a run, the agent pays only the mission's sources: a short list of x402 services chosen once, when the mission was written. For Acme, that is the data service alone.
- Proven before going live. Those services were paid for real during the trial. A mission cannot be published until a trial of its current draft has paid.
- The same work every run. Every run follows the same brief with the same services, so the results of one morning compare with the next.
- Fewer LLM tokens. The agent does not search the x402 directory or compare services again at each run: it starts from the list.
- Changes are versioned. Changing the recipe opens a new version, which needs its own trial. The runs already started keep the version they began with. See Versions.
- The same recipe across wallets. A mission published for the application or the organization runs the same way on every wallet there, and one wallet can carry several missions, each with its own services and run envelope.
What a run can cost
The run envelope is a guarantee: whatever happens during a run, a busy morning, a price that changed or an agent stuck in a loop, the run never spends more than its envelope. The next payment is refused with policy/envelope-exceeded, and the agent stops and reports it.
The units only help size that amount, from a price you can check: the unit price times the units per run. They do not cap the work itself:
- On a morning with 10 leads, the run spends about €0.60, and the rest of the envelope is never spent.
- On a morning with 120 leads, the agent pays lead after lead until the run reaches the envelope, then stops. The remaining leads wait for the next run.
A mission without units simply has a fixed run envelope.
The run envelope caps one run, not a day. How many runs happen is decided by the run mode:
- with
frequencyand one run a day, Acme's choice, a morning costs at most €4.00, and the leads left over wait until tomorrow; - with
auto, the agent can start a new run whenever it wants, so a busy morning can cost two or three envelopes; - with
on_demand, a person approves each run.
Over a day, a week or a month, the total is capped by the budgets of the wallet, the application and the organization, not by the mission. See How a mission fits in the policy. The rules of the wallet, the application and the organization still apply around it, as described below.
A mission does not schedule anything. Acme's own scheduler, or the agent, starts the run each morning. Keyban never starts a run by itself.
Life of a mission
Draft
The brief, the sources, the unit and its price, the units per run.
Trial
A person approves it. The agent plays a few units with real money.
Publish
A person publishes the draft once a trial has paid.
Runs
One run per morning in the example. Each is capped by the run envelope.
In short, a person approves the trial and the publication, and each run when the mode asks for it. Keyban enforces the run envelope of every run.
- Draft. The agent writes the mission with someone from Acme's sales team. A draft changes nothing yet: no wallet can run it. It is tuned on one wallet, the sales agent's wallet.
- Trial. Before anyone trusts the €5.00 figure, the agent plays a trial on 3 leads. Its envelope is 3 × €0.10 = €0.30. An operator of the wallet approves the trial in the Inbox, and the agent pays for real. Here the 3 leads cost €0.18 in total, so €0.06 each.
- Publish. Acme's operator publishes the draft. Publishing needs a trial of the current draft that made at least one payment, because a trial that paid nothing proves nothing. At publication Keyban tightens the unit price to what the trial cost plus about 20 percent, when that is lower: €0.06 + 20 percent = €0.072, rounded up to €0.08. The run envelope follows: €0.08 × 50 = €4.00. A unit price never goes up at publication. The operator also chooses which wallets may run the mission (the tuning wallet only, every wallet of the application, or every wallet of the organization) and the run mode.
- Runs. Every morning the agent starts a run of the published mission, pays for each lead inside it, then completes it. Each run can spend up to €4.00.
Versions
A month later Acme also wants each lead's LinkedIn page. Editing the brief opens a draft of version 2. Version 1 keeps running every morning in the meantime, and each run keeps the version it started with. Any change to the content of the draft voids the earlier trials, so version 2 needs its own trial before it can be published. Publishing version 2 replaces version 1 for every new run.
Run modes
The mode is chosen at publication. It decides whether a person approves each run.
| Mode | What happens when the agent starts a run | In the example |
|---|---|---|
on_demand | An operator of the wallet approves each run before the agent can pay. A wallet has at most one run of the mission waiting for approval at a time. | Someone at Acme clicks Approve each morning. |
auto | The run starts at once. | The agent starts its morning run with no click. |
frequency | The run starts at once, within an allowance of runs per day, week or month for each wallet. Once the allowance is used, the wallet waits for the next period. | With one run a day, a second run the same day is refused until the next day. |
A published version can also limit how many of its runs are active at the same time on each wallet. Beyond that number, a new run is refused until one ends. Without that limit, several runs can be active at once.
Acme picks frequency, with one run a day, so that a morning never costs more than one envelope.
How a mission fits in the policy
A mission narrows the wallet's policy to the task. It never widens it unless a person approves it, as an override.
- Destinations. During a run, the agent may pay only the mission's sources and recipients. Here that means only
api.example-data.com. They replace the wallet's own destination rules for the run. The rules of the application and of the organization still apply. - Cap per payment. The tighter of the mission's cap and the wallet's cap holds.
- Budgets. The run envelope is not a monthly budget, and a payment must fit both. Say the sales wallet has a monthly budget of €100. Thirty mornings at up to €4.00 could reach €120. The wallet's monthly budget then stops the runs at €100 for the month, unless the mission is exempt from the wallet's budgets, which takes an override. The budgets of the application and the organization always apply.
- A wallet that only pays through missions. A wallet can be set to pay only inside a mission run (Require a mission for every payment). A payment that names no run is then refused with
policy/mission-required.
Overrides
Say Acme's organization has an allow-list of destinations that does not include api.example-data.com. The draft can ask to pay it anyway. That request is an override, listed under What the draft loosens. Three things can be overrides:
- a source or a recipient that the destination rules of the application or of the organization refuse;
- an exemption from the wallet's day, week and month budgets;
- a cap per payment higher than the cap of a wallet that can run the mission.
An Owner or Admin must approve the overrides, and the trial waits for that approval as well as for the operator's. If the overrides are declined, the trial is declined with them: the draft must change before a new trial is asked.
When a person must decide
A signed-in person with the operate right on the wallet decides each of these. An agent and an API key never do:
- approving or declining a trial, and a run in
on_demandmode; - publishing a version, and cancelling a run in progress;
- archiving a mission, and revoking a standing approval (below).
Approving overrides needs an Owner or Admin. Sharing a mission with the whole organization also needs the right to edit the organization settings.
The approval threshold inside a run
Say the sales wallet's approval threshold is €1. Each lead costs €0.06, below the threshold, so every payment of the morning run goes through without a person.
- In
autoandfrequencyruns, the threshold stays in force, because the person who published the mission is not necessarily the operator of the wallet. A €2 payment would wait in the Inbox like any other. - In a trial and in an
on_demandrun, the threshold is lifted, because a person has just approved that run. The agent pays on its own within the run envelope. - When an operator approves a held payment of a run, they can tick Authorize every next time for this mission. This standing approval lifts the threshold for that wallet and that mission until a new version is published.
A payment that breaks a rule is refused whatever the approvals.
What the agent can and cannot do
The wallet MCP serves the mission tools. Each one acts on the agent's own wallet, so the agent never passes a wallet id.
The agent can:
- read the existing missions and what a published one costs;
- write a mission and its draft, and change the draft;
- ask for a trial and wait for the decision;
- start a run of a published mission, pay inside it, log its progress and complete it, or withdraw a run that still waits for approval.
The agent cannot do the human decisions listed above, and no tool exists for them: approve a trial or a run, publish, approve an override, cancel a run in progress, revoke a standing approval. An agent also touches only the runs it started. The tools are listed in Run missions.
Related
- Run missions: create, try, publish and run a mission, and the agent's tools.
- Spending policy: the rules a mission narrows, and the approval threshold.
- Payment intents: what a payment becomes when a person has to approve it.
- Refusal reasons: the
policy/…reasons a mission can add.