# Modes

A mode tells the [Agent](/docs/ai/agent/general.md) what it is for and what it
may do: its instruction, the tools it has, whether it works on a virtual copy
of the page's content, and whether it may run JavaScript in the page.

## Choosing a mode

The mode button in the Agent's header opens **Agent modes**, which lists the
modes available on the current screen, grouped by category: **General**,
**WordPress**, and any category a plugin's modes add. Pick one before you send
the first message of a chat; the chat keeps that mode. The Agent remembers the
mode you chose for each kind of screen.

A mode made for one screen, such as the block editor, is listed only on that
screen and is chosen there by default. A page builder's mode is the only mode
in that builder and cannot be changed.

## Built-in modes

| Mode                                                        | Category  | Where                              | What it does                                                                                                                                                                                  |
| ----------------------------------------------------------- | --------- | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Chat                                                        | General   | Every screen but the page builders | A general assistant. It can run JavaScript in the page.                                                                                                                                       |
| Block Editor                                                | WordPress | The block editor                   | Works on the post's blocks, each a JSON file it reads and writes, can run JavaScript to insert, remove or move blocks, and has a `get_selected_block` tool that names the block you selected. |
| Bricks Builder, Breakdance, Beaver Builder, Elementor, Etch | WordPress | Their editor                       | Works on the open page through a copy of its structure and the builder's own tools, and offers [coding agents](/docs/ai/agent/coding-agents.md).                                                 |

Every mode can also look for and run WordPress
[abilities](/docs/ai/agent/abilities.md).

## Virtual files

The Block Editor and page builder modes give the Agent the page as files
instead of letting it touch the editor directly. The files are not stored on
your server: each one stands for part of the open page, such as one block.
When the Agent writes a file, the mode applies the change to the editor, and
you see it on the right at once. Nothing is saved until you save the page in
the editor.

In Bricks, the Agent can also save Bricks' global settings when you ask it to.
A save that changes the global custom CSS, the builder CSS, the header and
body scripts or Bricks' code execution setting needs a user who may write
code on the site: on a network a network administrator, on a single site an
administrator who may post unfiltered HTML. For anyone else the save is
refused and nothing is written.

## JavaScript

Modes that allow it give the Agent a tool that runs JavaScript in the page on
the right, with WordPress's `wp` object at hand. It is how the Block Editor
mode inserts and removes blocks, which a file cannot express. The code runs
in your browser with your permissions, as if you had typed it into the
browser's console, and the Agent runs it without asking first.

## Modes that are not offered

Custom modes stored on the site, by an earlier SleekAI version or through the
`AgentMode_create` REST operation, are kept but not listed. The Agent
lists the modes that code registers; [Modes API](/docs/ai/agent/modes-api.md)
describes how a plugin adds one.
