Agent as broker
The agent proposes a change, you approve it, and the app makes it with your own session.
The problem
The quick way to let an assistant change things is to give it write tools on the server. “Snooze this alert” calls the snooze endpoint, and the reply says done.
That causes three problems.
- Whose permissions? Server tools usually run as a service account, so the assistant can see and do things the person’s own role would block.
- What did it do? You find out by going to look. There’s no moment where you saw the change before it happened.
- Prompt injection gets a pen. If text on the page can steer the model, it can now steer writes too.
What I concluded
Split the work three ways, and give each step to whoever can be trusted with it:
1. app declares what can change snooze-alert { alertId, until }
2. agent proposes one "Snooze 'Late orders' to Monday?"
3. person approves or edits [Approve] [Edit] [Dismiss]
4. app makes it, as the person same call as the Snooze button
The app is the broker. It tells the agent which changes are possible, shows the person exactly what’s proposed, holds the approval, and sends the write with the person’s own session. The agent never holds a credential, and it never writes anything itself.
// declared next to the hook that already makes this change
declareOperation({
id: "alerts.snooze",
title: "Snooze alert",
input: z.object({ alertId: z.string(), until: z.string().datetime() }),
mutation: snoozeAlertMutation, // the same one the button uses
preview: (args) => <SnoozePreview {...args} />,
});
Rules
- The agent can only name a declared change. It picks an id from a list and fills in values. It never writes raw API calls or URLs.
- Your session does the write. Permissions are enforced where they always are, so the assistant can’t do more than you can.
- Approval is the default. Only changes that are read-only and safe to repeat, like a filter, run without a click.
- Show the real values. The preview renders the actual arguments. Where there’s no nice renderer, it falls back to showing the raw values. It never shows a vague summary.
- Stale proposals can’t be approved. If the app changed since the proposal was made, the card says it’s out of date and hides Approve.
- The outcome goes back. Approved, edited, dismissed or failed, the agent hears it on the next turn, so it never claims something happened that didn’t.
What you get
The agent gets to be helpful about writes without being trusted with them. Every change has a moment where a person saw it, it runs through the same path as a button click, and the permission model stays the one you already have.
The same idea, applied to forms: Assisted forms. What the agent is allowed to try at all: Tool permissions.