Skip to Content
Foir AIApprovals

Approvals

An agent does not publish, delete or change things on its own say-so. When a run reaches an act like that, the act is held: it waits, the run tells the person what is waiting, and it carries on once someone decides.

What is held

Runs straight awayWaits for an approval
Anything that reads: Foir’s read verbs, an operation declared read-only, a remote tool marked readOnlyPublishing, deleting, and every other Foir verb that changes something beyond a draft
Creating or editing a record, which writes a draft, and adding a noteAn operation that changes something
A notification to the person talking to the agentA notification to anyone else, unless the agent sets notifyOthersUnheld
A remote tool marked allowedAny other remote tool
Handing a task to a child agent

A held act is only ever one the caller could do themselves. The agent was offered the tool because their role grants it; the approval is a second look, not a way round a permission.

Who decides

The person talking to the agent decides their own run’s acts. It is their run, acting as them, so they approve or deny what it wants to do.

The project’s team decides when there is no such person, and when the agent sets teamApproves: true:

  • a visitor who has not signed in has no account to decide with, so their run’s acts wait for the team;
  • an agent that sets teamApproves hands every held act to the team, whoever started the run.

A member of the team decides with approvals:write and the permission the act itself needs. Approving an act is authorising it, so nobody approves what they could not do themselves.

A decision is always made by a person, signed in as themselves. A run cannot approve its own act, and neither can another agent’s run.

How the approver is told

The run tells the person in the conversation what is waiting, in its own words. When the act waits for them, they are also sent a notification, “Support is waiting for your approval”, saying what the act will do and linking to it.

In the console, held acts are listed under Approvals, each with what will happen if it is approved and the run it belongs to. The team finds the acts waiting for it there.

In your app, the generated API lists and decides them:

query Waiting { myAgentApprovals { id # the held act: pass it to decideAgentApproval action # the tool, operation or agent it would call approval { summary # what it would do, in words decision # PENDING, APPROVED, DENIED or EXPIRED } } } mutation Decide($id: String!, $reason: String) { decideAgentApproval(id: $id, approve: false, reason: $reason) { id approval { decision } } }

The same on the SDK client:

const waiting = await foir.ns.agents.myAgentApprovals({}); await foir.ns.agents.decideAgentApproval({ id: waiting[0].id, approve: false, reason: 'Not this order.' });

An end user decides only their own runs’ acts, and only signed in as themselves.

After a decision

Once an act is decided the run carries on by itself:

  • Approved: the act runs, as the person the run is for, and the agent is told what it did.
  • Denied: the act does not run, and the agent is told it was denied, with the reason if one was given. It answers the person accordingly.

A run waiting for a decision has the status HELD. If two people decide the same act at once, the first decision stands and the second is refused.

Last updated on