# Brokered actions

> How an agent sends, publishes or spends outside the workspace through the broker: declared actions, input, checks, budgets, dedupe, undo window, answers and questions.

Source: https://docs.ventgris.com/agents/brokered-actions

A brokered action is the only way an agent acts on the outside world: a message to someone outside the team, a public page, a change to who can talk to the agent. The agent holds no key that sends. It asks the broker, which runs inside the workspace control plane (`vgd`), with `vg action run NAME`. The broker checks the request against its guardrails, then runs it now, runs it after an undo window, waits for a person, or refuses it. It answers at once in every case, so no task ever waits on a human.

## The flow of one request

1. The agent runs `vg action run NAME --file input.json` (or the MCP tool `action_run`).
2. The broker finds the declared action. Unknown name: error `unknown action`.
3. It works out the gate (`auto`, `notify` or `approve`) from the autonomy preset, the class of the action and any override.
4. It refuses at once, in this order, when:
   - the session's [agent profile](https://docs.ventgris.com/agents/agent-profiles.md) does not list the action, or its policy does not allow it;
   - the kill switch is on (everything is frozen);
   - the policy file of the workspace cannot be read;
   - the action has no executor on this machine;
   - the input is not valid JSON or is larger than 256 KiB;
   - a circuit breaker of the action is open.
5. It validates the input against the schema of the action, then the allowlists.
6. It scans the input for secrets. A secret value refuses the run and trips the breaker of the action.
7. It checks for a duplicate of the same input in the dedupe window.
8. It runs the content checks of the action. All must pass; a check that cannot run refuses.
9. It admits the run: budgets, rate limit and breakers again, in one transaction.
10. Depending on the gate: it runs it now (`done` or `failed`), schedules it after the undo window (`scheduled`), or leaves it waiting for a person (`pending_approval`).

Every step that refuses returns a run in state `blocked` with a `block_reason`. A refusal is an answer, not a crash: read the reason and adapt.

## Find the actions you may run

```bash
vg action list
```

```text
discord.post  class broadcast  gate approve  Send a Discord message outside the team's own channels
art.publish_public  class broadcast  gate notify  Make an artifact public
channels.user_add  class reversible  gate approve  Allow someone to talk to the agent on a platform
```

Each line gives the name, the class, the gate that applies now (`refused` when no gate applies) and the title. `[blocked for now: ...]` at the end means every run of that action is refused until something changes (a missing secret, an open breaker). The first line is `everything is frozen: no action runs until a human thaws` when the kill switch is on.

`vg action list --json` gives every field of each action:

| Field | Meaning |
|---|---|
| `name`, `title`, `class`, `file` | identity, and the declaration file it comes from |
| `gate`, `gate_source` | the gate that applies, and where it comes from: `preset`, `action file` or `autonomy.toml` |
| `delay_ms`, `tainted_delay_ms` | the undo window of a `notify` gate, normally and when the turn read untrusted content |
| `timeout_ms`, `on_timeout` | for an `approve` gate: how long it waits, and what happens then (`reject` or `run`) |
| `stepup` | an approval of this action needs a step-up of the person who approves |
| `secret`, `allowed_hosts` | the name of the secret it uses (never the value) and the hosts it may call |
| `schema` | `true` when the input is validated against a schema |
| `checks`, `text` | the content checks, and the input fields they read |
| `allow` | allowlists: input path to accepted values |
| `dedupe_ms` | the dedupe window |
| `budgets` | the budgets that count this action |
| `estimate_cents` | the declared cost estimate, for spend actions |
| `breaker` | the state of its breaker |
| `problem` | why every run is refused for now |

The list shows every declared action. Running one also needs it to be in the action list of your profile: otherwise the run is `blocked` with `profile: ...`.

## Who declares actions

Actions are declared by the workspace platform in files under `/etc/ventgris/actions.d/`, owned by `root` and out of reach of every session and terminal. An agent cannot add, change or widen an action, a gate, a budget or an allowlist. A workspace admin changes the gates, budgets and the autonomy preset in the **Autonomy** screen. See [Autonomy and guardrails](https://docs.ventgris.com/workspace/autonomy.md).

The actions shipped with every workspace:

| Action | Class | Input | Default gate | Guardrails |
|---|---|---|---|---|
| `discord.post` | broadcast | `recipient`, `text`, optional `title`, `conversation` | `approve` | checks `message_shape`, `no_secret`, `no_private_link`, `slopcheck`, `readcheck-social` on `title` and `text`; 20 per day |
| `telegram.send` | broadcast | `recipient`, `text` | `approve` | same checks; 20 per day |
| `whatsapp.send` | broadcast | `recipient`, `text` | `approve` | same checks; 20 per day |
| `art.publish_public` | broadcast | made by `vg art publish --public` | `notify` (undo window) | checks `artifact_report`, `no_secret`, `no_private_link`, `slopcheck` on the title; dedupe 1 minute; 5 per day |
| `channels.channel_save`, `channels.channel_remove` | reversible | made by `vg channel save`, `vg channel remove` | `approve`, with step-up | schema |
| `channels.user_add`, `channels.user_update`, `channels.user_remove` | reversible | made by `vg channel user ...` | `approve`, with step-up | schema |
| `channels.whatsapp_settings` | reversible | made by `vg channel whatsapp` | `approve`, with step-up | schema |

`recipient` is a channel id (`discord:123...`, `telegram:-100...`, `whatsapp:+33...`) or `platform:channel-name`. A message to the team's own channels is not a brokered action: use `vg notify CHANNEL "text"`.

## Classes, presets and gates

Every action has a class. The autonomy preset of the workspace turns the class into a gate, unless the action file or the workspace settings name a gate for that action.

| Class | What it covers | `autonomous` preset | `supervised` preset |
|---|---|---|---|
| `internal` | stays in the workspace | `auto` | `auto` |
| `reversible` | can be undone | `auto` | `auto` |
| `broadcast` | reaches people outside | `notify` (undo window) | `approve` |
| `spend` | costs money | `auto` | `approve` above the spend threshold |
| `destructive` | cannot be undone | `auto`, after a snapshot | `approve` |

| Gate | What happens to your run |
|---|---|
| `auto` | It runs now. You get `done` or `failed` |
| `notify` | It is `scheduled` and runs at the end of its undo window unless someone cancels it |
| `approve` | It is `pending_approval` until a person decides, or until its timeout |

Defaults of a new workspace: undo window 10 minutes, 30 minutes when the turn read untrusted content, approval timeout 24 hours, then `reject`. A gate named for one action wins over the preset. Under the `custom` preset, an action with no gate of its own is refused: `gate: the preset is custom and this action declares no gate`.

A turn that read untrusted content (a web page, an email, a third-party tool) is tainted. A tainted turn keeps its actions, but a `broadcast` action that would run at once gets the `notify` gate, and its undo window is at least the tainted delay.

A `destructive` action runs only after a snapshot of the machine; without one it is refused: `snapshot: no snapshot is possible, a destructive action does not run without one`.

## Write the input

The input is one JSON object. Read it from a file, from standard input with `-`, or give nothing for `{}`:

```bash
cat > /tmp/msg.json <<'EOF'
{"recipient": "discord:partners", "text": "The 2026-12-04 meetup moves to 19:00, same place."}
EOF
vg action run discord.post --file /tmp/msg.json
echo '{"recipient":"telegram:-1001234","text":"Doors open at 18:30."}' | vg action run telegram.send --file -
```

| Limit | Value |
|---|---|
| Size | 1 MiB read by `vg`, 256 KiB accepted by the broker |
| Format | valid JSON. It is put in canonical form: what is validated is what is hashed, stored, shown and sent |
| Schema | JSON Schema subset: `type`, `required`, `properties`, `additionalProperties`, `enum`, `pattern`, `items`, numeric bounds. A failure gives `schema: <path>: <reason>` |
| Allowlist | each listed input path must be present and its value in the list: `allow: input.account "x" is not in the allowlist` |

## Content checks

The checks listed by the action read the text fields named in its `text` list.

| Check | Refuses |
|---|---|
| `message_shape` | a message without a recipient or a text |
| `no_secret` | a value of the vault, or anything shaped like a key, anywhere in the input |
| `no_private_link` | a link to a private artifact or to the workspace interface |
| `slopcheck` | the phrases and patterns the house style forbids |
| `readcheck-social` | a message that does not talk to its reader or does not open on something concrete |
| `artifact_report` | an artifact whose content scan found a problem |

Run the same checks on a file before you send it:

```bash
vg check drafts/announce.md --check slopcheck,readcheck
```

It prints each finding as `BLOCK` or `WARN` with the line and an advice line, then `N BLOCK, N WARN in FILE: ...`. It exits 1 when a finding blocks or a check could not run.

## Budgets, rate limits and breakers

| Guardrail | Rule | Refusal text |
|---|---|---|
| Budget | counts runs (`count`), recipients (`recipients`) or money (`eur_cents`) per `hour`, `day`, `week` or `month`, optionally per input value | `budget: <what> is at 20 of 20 runs per day` |
| Rate of internal actions | 120 runs per hour by default for an internal action with no count budget | `rate: N runs in the last hour, the limit is 120` |
| Breaker | trips after 3 failures in a row, a failed check, a secret in an input, or a rate far above the usual; cools down 1 hour, then longer, up to 24 hours | `breaker: action:NAME is paused (why)` |
| Kill switch | a person froze everything | `frozen: the kill switch is on, nothing leaves` |

Budgets, breakers and the kill switch are reset or changed by a person in the **Autonomy** screen. No command does it.

## Dedupe

The broker keeps a hash of each canonical input. A second run of the same action with the same input inside the dedupe window is refused: `dedupe: the same input already went through as act_...`. The window is 24 hours unless the action declares another (`art.publish_public`: 1 minute). Runs that count are those `scheduled`, `pending_approval`, `running` or `done`, and those `failed` with an unknown outcome. A `blocked`, `cancelled` or `expired` run does not count, so you can fix a refused input and send it again.

There is no dedupe key to pass: change the input on purpose when you really mean to send the same thing twice (for example a dated reminder), and expect a refusal otherwise.

## Read the answer

```text
act_01JF3Q8Y0C5W discord.post: pending_approval (gate approve)
  waits for a human until 2026-11-30 10:12 (on timeout: reject); do not wait for it, go on with the rest
```

| State | Meaning | What you do |
|---|---|---|
| `done` | It ran. A `result:` line holds the answer of the service | Report it as done |
| `scheduled` | It runs at the time shown unless cancelled: `runs at 10:22 unless cancelled: vg action cancel act_...` | Go on. Say it is scheduled and until when it can be cancelled |
| `pending_approval` | A person decides, until the timeout | Go on with the rest of the task. Report it as waiting |
| `blocked` | A guardrail refused, with the reason | Do not retry the same input. Fix it (text, recipient, size) or report the refusal. Nobody approves a blocked run |
| `failed` | It ran and the service refused or failed | Report it. Retry only if the reason is temporary |
| `cancelled` | Withdrawn, or rejected by a person (with an optional note) | Read the note in `vg activity`; do not resend the same thing |
| `expired` | The approval timed out with `on_timeout = reject` | Report it |

`[dry run: nothing was executed]` follows the state when the job runs with `VG_DRY_RUN=1`.

Exit status of `vg action run`: 0 for `done`, `scheduled` and `pending_approval`; 1 for `blocked`, `failed`, `cancelled` and `expired`, with `vg: the action was blocked: <reason>` or `vg: the action ended in state <state>` on standard error. The MCP tool returns a tool error for the same states.

## Cancel during the undo window

```bash
vg action cancel act_01JF3Q8Y0C5W --note "wrong date in the text"
```

You can cancel your own runs while they are `scheduled` or `pending_approval`, and only your own. People cancel runs in the **Activity** screen with **Cancel**, and approve or reject waiting runs with **Approve** and **Reject** (with step-up when the action asks for it). A run that already ran cannot be cancelled.

## See what became of your runs

```bash
vg activity --since 24h
vg activity --since 7d --all
```

It lists your action runs and questions in the period, with their state and id. `--all` shows everybody's, with who asked. `--limit N` caps the list. Use it to report the end state of a `scheduled` or `pending_approval` run, or to learn that a question was answered after its default applied.

## Ask a human, with a default

When a choice changes what you do next, ask, and say what you will do if nobody answers:

```bash
answer=$(vg ask "Send the recap to the 42 partners now, or wait for Monday?" \
  --choices now,monday --default monday --timeout 20m)
```

| Rule | Value |
|---|---|
| `--default` | required, 200 characters at most. With `--choices`, it must be one of them |
| `--choices` | up to 12, comma separated, no comma inside a choice, no duplicate |
| Question | 2000 characters at most, complete enough to answer from a phone |
| `--timeout` | default 30 minutes, at most 24 hours. `0s` applies the default at once |
| In a job | the default applies at once: nobody watches a scheduled job |

The answer alone is printed on standard output; `que_...: answered by usr_...` or `que_...: nobody answered, the default applies` goes to standard error. A person answers in the **Activity** screen or in a channel. An answer that comes after the default applied is kept as a late answer for next time; the task has already gone on.

> [!AGENT]
> Never wait for a person: ask with `vg ask` and a default, then act on what it returns. Never ask for permission to continue. Send everything that leaves the workspace through `vg action run`; never call an outside API with a key to get around the broker, and never split or reword a message to get past a budget, a dedupe or a check. A `blocked` run is final for that input: change the input or report the reason.

## Related

- [Autonomy and guardrails](https://docs.ventgris.com/workspace/autonomy.md)
- [Activity](https://docs.ventgris.com/workspace/activity.md)
- [vg CLI reference](https://docs.ventgris.com/agents/vg-cli.md#asking-a-human-acting-on-the-outside)
- [Agent profiles](https://docs.ventgris.com/agents/agent-profiles.md)
- [Channels](https://docs.ventgris.com/workspace/channels.md)
