# Policies

> Decide which connector actions run on their own, get logged, get checked by the agent, wait for a person, or never run.

Policies decide what happens when an agent, a connected app or an Automation tries to run a connector action, like sending an email or deleting a file. You manage them in **Settings → Policies**.

With no rules, every action runs. You add a rule when you want something logged, checked, approved or stopped.

The same page also holds rules for record and agent changes. Out of the box, it blocks agents from deleting agents. This guide covers connector actions.

## The five modes

Each rule picks one of five modes. The rule menu calls them "Run automatically", "Only log it", "Agent follows it", "Ask first" and "Block".

| Mode | What happens | Example |
| --- | --- | --- |
| Run automatically | The action runs. | Let agents create Linear issues without asking. |
| Only log it | The action runs, and the run is recorded on its Activity card. | Log every message an agent posts to Slack. |
| Agent follows it (Check) | You write the rule in plain words. The agent must confirm in one sentence that the action follows it, then it runs. Nobody else is asked. | "Only email people at acme.com" on sending Gmail messages. |
| Ask first | The action waits until a person approves it. | Ask before deleting anything in Google Drive. |
| Block | The action never runs. | Block deleting GitHub repositories. |

If you are not sure where to start, the page offers four starter rules: "Ask before destructive actions", "Block destructive actions", "Log every write" and "Ask before agents post where the whole workspace can see".

## What a rule covers

A rule can cover every connector, one connector or one connection. Within that, it can cover every action, a category of actions, or one action. The categories are read, write, destructive, non-destructive and unknown.

When several rules match, the strictest one wins. There is one exception. A narrower "Run automatically" rule can carve a hole in a broader "Ask first" rule. For example, you can ask first for every Gmail write but let agents add labels without asking. Log, Check and Block rules can't be carved out like that.

## Who will see it

A Log, Check, Ask first or Block rule can also depend on who will see the action. In the rule editor, next to **Only**, pick "Where the whole workspace can see" or "Where people outside the workspace can see". The default, "Wherever it lands", applies the rule everywhere.

Audiences go from narrowest to widest: private, the whole workspace, people outside the workspace. A rule for "where the whole workspace can see" also covers places people outside can see.

For example, "Ask before agents post where the whole workspace can see" holds a Slack message to a public channel or a Slack Connect channel, but lets a direct message or a private channel post run without asking.

The connector has to tell Lobu who will see the action. Today only Slack's `send_message` does. An audience rule never applies to other actions. If Slack can't answer within a few seconds, or the lookup fails, Lobu treats the post as visible outside the workspace, so the rule applies.

## Who rules apply to

Rules apply to software acting in your workspace:

- agents
- connected apps, such as an OAuth app, a personal access token or a local CLI
- Automations

Rules never stop a person acting in the web app, not even Block. If you open a connection and run an action yourself, it runs.

An agent's reply sent through a chat connection is not a person, even when it goes out under your account. It keeps the rules.

## Workspace rules and rules for one caller

A workspace rule applies to every caller.

You can also add a rule for one agent, one connected app or one Automation. It applies only to that caller, and it can only tighten. A rule for one agent can make it ask first where the workspace runs automatically. It can't let that agent run something the workspace asks for or blocks. The only way to loosen things for one caller is "Always allow".

## Always allow and Ask next time

When an action waits for approval, its Activity card shows who asked it ("Requested by ...") and offers **Approve** and **Reject**. When the caller is an agent, a connected app or an Automation, it also offers **Always allow &lt;caller&gt; on &lt;connection&gt;**. Only workspace owners and admins see these buttons.

"Always allow" approves the run and stops asking that caller for that exact action on that connection. It covers only the caller on the card, and for an agent, the Automations that agent owns. Every other agent, app and Automation still gets asked.

A caller's own "Always allow" lifts Ask first for it, including workspace Ask first rules. It never lifts:

- a Block, Check or Log rule
- an allowed-actions list
- a device owner's hold on their own device

Local CLIs can't be given "Always allow". A local CLI names itself, so any local tool could claim that name. Add a workspace rule for it instead.

When an action ran without asking, its card offers **Ask next time**. Lobu then asks before that caller runs the action again on that connection. On an Automation's card it holds even when the Automation's agent has "Always allow".

Lobu also suggests rules from your history, such as "Always allow &lt;name&gt;?" after repeated approvals or "Block &lt;name&gt; here?" after repeated rejections. Suggestions are grouped by the caller that asked.

## Allowed-actions lists

You can give an agent or a personal access token an allowed-actions list. Once it has one, it can only make the writes on that list. Reads stay open unless a rule blocks them.

Each entry names one action on one connection and can run automatically, only log, check or ask first. Workspace rules still apply on top, and the stricter result wins.

If a caller tries a write that isn't on its list, the call fails with:

```text
'send_email' isn't on this caller's allowed actions list.
```

## What an agent sees

### Check

The action doesn't run yet. The agent gets the rule's note, a run id, the status `pending_check` and an `expires_at` time:

```json
{
  "run_id": 4812,
  "status": "pending_check",
  "expires_at": "2026-01-15T10:10:00.000Z",
  "message": "Operation 'Send email' is held by a workspace check: Only email people at acme.com. If this action meets the rule, call operations.confirm({ run_id: 4812, statement }) with one sentence saying why. Otherwise call operations.cancel(4812) and try a corrected version.",
  "policy": {
    "reason": "guardrail",
    "rules": [{ "id": 31, "kind": "guardrail", "note": "Only email people at acme.com." }],
    "principal": { "kind": "agent", "id": "support", "label": "Support" }
  }
}
```

The agent then does one of two things:

- calls `operations.confirm` with the run id and one sentence saying why the action meets the rule, and the action runs
- calls `operations.cancel` and tries a corrected version

If it does neither before `expires_at`, the check expires as a timeout. A person never sees a Check, so an agent should never ask someone to approve one.

A caller that can't confirm, such as an Automation that runs only code, gets Ask first instead.

### Ask first

The agent gets the status `pending_approval`, a run id and an `approval_url`. The run is waiting, not failed. A person approves or rejects it on the Activity card. An MCP client can call `get_approval` with the run id to show that card.

### Block

The call fails with a message like `Policy blocks 'delete_repository' for this principal: <note>`. Blocked actions also show up as blocked when an agent lists the actions it can run.

## Who can change rules

Only workspace owners and admins can change rules. They do it in their own browser session, or with a personal access token that has the `policies:write` scope. Agents can't change rules.

Approving a run is always a person's action in the web app.

## API

Rules live in one collection per workspace:

```text
GET /api/<workspace>/write-permissions/connector-actions
PUT /api/<workspace>/write-permissions/connector-actions
```

`GET` returns `{ revision, rules }`. `PUT` takes `{ revision, rules }` and replaces the whole set at once. If someone changed the rules since your `GET`, the `PUT` returns `409` and you read again.

Add `?principal_kind=app` or `?principal_kind=automation`, optionally with `&principal_id=<id>`, to manage the rules for connected apps or one Automation. An app id looks like `client:<id>`, `pat:<id>`, `web:<domain>` or `local:<name>`. An Automation id looks like `automation:<id>`.

Each rule has these fields:

| Field | Meaning |
| --- | --- |
| `connector_key` or `connection_id` | Which connector or connection it covers. Leave both out for all. |
| `operation_category` or `operation_key` | Which actions it covers: a category, or one action as `connector::action`. Leave both out for all. |
| `effect` | `auto`, `log`, `check`, `approval` or `deny` |
| `kind` | Leave it out for a plain rule (`auto`, `approval` or `deny`), where the narrowest match wins. Set `"guardrail"` for a rule that only tightens (`log`, `check`, `approval` or `deny`). |
| `audience` | Leave it out for everywhere. On a guardrail, `workspace` or `external` applies the rule only where the action lands at least that wide. A plain rule with an `audience` returns `400`. |
| `note` | Up to 280 characters, shown to the caller when the rule holds or blocks an action |

For an app or an Automation, the only rule that loosens is "Always allow": `effect: "auto"` with a `principal_id`, one `connection_id` and one `operation_key`.

Every execute result carries a `policy` object that explains the decision:

```json
{
  "reason": "allowlist",
  "rules": [],
  "principal": { "kind": "app", "id": "pat:17", "label": "Deploy script" }
}
```

`reason` is one of `matched_rule`, `guardrail`, `default_auto`, `allowlist`, `device_owner`, `parent_approval`, `unresolved_principal` or `unavailable_operation`. `principal` names who the decision was made for.

## Read next

- [Tool policy](/guides/tool-policy/)
- [Guardrails](/guides/guardrails/)
- [Security](/guides/security/)
- [REST API](/reference/api-reference/)
