# Control what an agent can do

Answer an AI agent's questions, give it access ahead of time, and change or revoke that access.

## Allow an agent

When an agent first asks to use a machine, a question window opens.

1. Read the program's name and what it wants to do.
2. Click **Allow** or **Don't Allow**.

![The question window for Codex, which asks to use the windows-11 machine and lists what it may do](https://osmates.com/docs/images/agent-access-question.png)

Escape refuses, and Return does neither. From another app, click the notification that appears. To answer later, select **Permissions** in the library, select the question under **Waiting for You**, then click **Answer**.

These actions need your answer every time:

- A copy between your Mac and a machine, unless you allowed that folder
- An installation file or disk image from an agent
- A machine folder or disk that `vm_import` reads
- A new forwarded port on your Mac
- Deleting a machine the agent didn't create

An agent run with `claude -p` or `codex exec` can't show the question, so the call fails. When a saved permission would fix it, the error gives the `osmates agents allow` command.

## Give access before the agent asks

1. Select **Permissions** in the library, then click **Allow an Agent**.
2. Choose a program next to **Agent**. For one that hasn't asked before, choose **Choose Program** and select it.
3. Choose a machine, what the agent may do, and for how long.
4. Click **Allow**.

To do the same in Terminal, with the program's executable path:

```sh
osmates agents list
osmates agents allow ~/.local/bin/claude --vm dev --scope observe,input --for 24h
```

A program signed by Apple or a developer team can have permanent access. Any other program gets at most 24 hours. A program OSMates can't identify gets access for its current session only.

## Change or revoke access

1. Select **Permissions** in the library, then find the program's row for the machine.
2. Click **Edit** to change access, or **Revoke** to remove it.

To revoke everything a program has, Control-click its row and choose **Revoke Everything for** the program. **Allow on Another Machine** in the same menu copies access to a second machine.

To replace a program's access to a machine, or revoke it, in Terminal:

```sh
osmates agents allow ~/.local/bin/claude --vm dev --scope observe --for always --replace
osmates agents revoke claude-code --vm dev
```

Revoking `host_transfer`, copying between your Mac and a machine, also removes its folder exceptions.

## Access to machines an agent made

An agent uses a machine it created without asking again, and a clone gets the same access as its original. Copies with your Mac, forwarded ports, and USB devices still need your answer.

To end this access, revoke the right to create machines, or access to the original machine.

For programs inside a machine, see [Let programs in a machine save and restore it](https://osmates.com/docs/snapshots#let-programs-in-a-machine-save-and-restore-it).

## Limit every session of an agent

An access limit caps one program in every session, on every machine. Until you set one, it's Full.

1. Select **Permissions** in the library.
2. Select one of the program's rows, then click **Inspector** in the toolbar.
3. Choose a profile under **Access Limit**.

To set it in Terminal:

```sh
osmates agents profile ~/.local/bin/claude operator
```

The limit applies from the program's next call, and `osmates agents list` shows it. An MCP session uses the narrower of this limit and its [connection profile](https://osmates.com/docs/agents#pick-a-profile). Programs in a machine, and programs OSMates can't identify, have no limit.
