# Let ChatGPT run commands on your computer

ChatGPT runs a command on your own computer and answers from its real output: a build, a test
run, a look at a log. You decide that it may, for this one agent, and you see every command after.

**In short:** Connect ChatGPT ([guide](https://docs.cmdop.ai/guides/connect/chatgpt.md)), then on your page: All machines → Agents →
ChatGPT → switch on `exec`. Ask it to run `git status` in a project folder.

## When to use this

You want an answer that depends on the computer itself, not on what you paste into the chat.

## Steps

1. [Connect ChatGPT](https://docs.cmdop.ai/guides/connect/chatgpt.md). A new agent can only read: it can list your
   machines, read files and see system facts, and it changes nothing.
2. On your page, open All machines → Agents, pick ChatGPT and switch on `exec`
   ([grant risk classes](https://docs.cmdop.ai/guides/access/grant.md)). A command can do anything your user account can,
   so switch on only what the task needs.
3. Ask in the chat, for example: "Run `git status` in ~/project on my computer and tell me what
   changed." ChatGPT calls [`exec_run`](https://docs.cmdop.ai/reference/tools/exec_run.md) and reads the exit code and
   the output.
4. For anything longer than a couple of minutes, ask it to start a task instead
   ([long jobs](https://docs.cmdop.ai/guides/use-cases/long-job.md)).

## Check

Your page lists the call under ChatGPT with the tool, the machine, the result and the time
([the record of calls](https://docs.cmdop.ai/concepts/audit-and-history.md)).

## If it fails

- [`denied`](https://docs.cmdop.ai/reference/errors/denied.md): `exec` is not on for this agent, or the machine's
  [ceiling](https://docs.cmdop.ai/guides/access/ceiling.md) does not allow it.
- [`paused`](https://docs.cmdop.ai/reference/errors/paused.md): the machine is paused; resume it at the computer.
- [`timed_out`](https://docs.cmdop.ai/reference/errors/timed_out.md): use a task for long work.

## Related

[Revoke an agent](https://docs.cmdop.ai/guides/access/revoke.md) · [Run commands and tasks](https://docs.cmdop.ai/guides/run.md) ·
[Pause a machine](https://docs.cmdop.ai/guides/pause-and-presence.md)
