# AmoCRM with your AI agent, step by step (/en/docs/amo/scenarios)

Each scenario is a common task in order: the commands to run, why each one runs and what to look at in the answer. The same scenarios are in the terminal: `amo guide` lists them and `amo guide <name>` prints one.

Commands that use an account start with your profile, the name you gave the account at login: `amo <profile> …`.

## First sync and the pipeline board [#first-sync-and-the-pipeline-board]

Copy your deals and their clients into the local store and see where each deal stands.

1. ```sh
   amo setup
   ```

   the account's address and the long-lived token from your private integration; both are checked against the account before anything is saved

2. ```sh
   amo session status --check
   ```

   the account and the user the token acts as, and whether that user is an administrator

3. ```sh
   amo sync
   ```

   copies the pipelines, the deals assigned to you and only the contacts and companies on them; the next sync takes only the changes

4. ```sh
   amo pipelines show Sales
   ```

   the pipeline as a board and a funnel, how many deals stand in each stage and how many reached it

5. ```sh
   amo deals list status:open
   ```

   the open deals with stage, amount and owner, from the store, offline too

What to look at:

- the user in session status, since a colleague's token copies their deals, not yours
- warnings in the sync answer, such as a page the account refused
- the stage where most deals wait

`Sales` stands for one of your pipelines; `amo <profile> pipelines list` names them. An administrator can copy
colleagues' deals too, by their user ids: `amo <profile> users list`, then the `unassigned` setting on the settings
page. No setting copies the whole CRM, and any other client is read live with `people` or `organizations`.

In the terminal: `amo guide first-sync`

<a id="keep-in-sync" />

## Keep the copy up to date [#keep-the-copy-up-to-date]

Have the local store follow the account on its own, and search it beside your other WireCat tools.

1. ```sh
   amo schedule command crm --every 1h -- sync
   ```

   a timer on this computer that runs sync every hour; it reads only what changed

2. ```sh
   amo schedule list
   ```

   the schedule, when it runs next and how its last run went

3. ```sh
   amo store status
   ```

   how far each kind's sync is, how many records are stored and when it last ran

4. ```sh
   amo search all invoice
   ```

   stored deals beside your messages, notes and meetings from other WireCat tools

What to look at:

- a schedule whose last run failed
- a kind in store status that is partial, which the next sync goes on with

`amo <profile> sync --rescan` reads everything again, every id too, when the copy looks wrong.

In the terminal: `amo guide keep-in-sync`

<a id="safe-agent-writes" />

## Let an agent change the CRM without surprises [#let-an-agent-change-the-crm-without-surprises]

Give an agent your CRM over MCP while the writes that reach clients or cannot be undone stay yours.

1. ```sh
   amo config set permissions.deals.move readonly
   ```

   a stage change can start the account's own automation, such as a Salesbot that writes to a client; over MCP ask does not ask, so ask stops nothing there

2. ```sh
   amo config set permissions.deals.close deny
   ```

   no agent marks a deal won or lost, whatever it is asked

3. ```sh
   amo mcp add claude-code --permission people.update=deny --allow-writes
   ```

   add this profile to Claude Code; this server also refuses contact changes, and --allow-writes acknowledges the writes it still offers

4. ```sh
   amo config show
   ```

   each permission with its level and where it came from

5. ```sh
   amo runs list
   ```

   what the agent ran, refused writes too

What to look at:

- the levels of deals.move, deals.close and people.update in config show
- refused runs in runs list, and which command asked

At a terminal `ask` still asks before the write. Over MCP nobody is there to answer, so a write at `ask` goes ahead;
set `readonly` or `deny`, or turn on approval of `amo_write` in the agent client.

In the terminal: `amo guide safe-agent-writes`
