# Turn an action on or off and test it

The **Enabled** switch decides whether the agent can run an action. **Test** runs one action with the parameters you give it, in a page of your app, so you can check it before users reach it.

## Enable or disable actions

An action that is off is not offered to the model, so the agent cannot run it.

To turn actions on or off:

1. In the portal, go to [**Web Agents**](https://auth.faustine.ai/go?to=%2Fweb-assistants) and select your agent.
2. Select the **Actions** tab.
3. In the action's row, turn **Enabled** on or off. To change a whole module, select **Enable all** or **Disable all** in the module's row.
4. In the save bar, select **Save changes**.
5. Publish a version. See [Publish a version](https://docs.faustine.ai/web-agents/publish-a-version/).

The module's row shows how many of its actions are enabled, and the count above the table shows the total. Your site gets the change with the version you publish.

## Test an action

A test runs the action for real, in a browser tab where your app is open and connected to the portal in debug mode. The request goes to your backend with the session of the user signed in to that tab.

### Before you begin

- A page of your app is connected in debug mode. See [Open a debug session](https://docs.faustine.ai/web-agents/debug-sessions/). The **Test** button appears on enabled actions only while a session is connected.
- You are signed in to your app in that tab, as a user who is allowed to do what the action does.

### Run the test

1. In the **Actions** tab, select **Test** in the action's row.
2. If more than one page is connected, select the session to run in under **Session**.
3. In **Parameters (JSON)**, enter the action's input as a JSON object. **AI fill** writes sample values for you. It leaves the IDs of existing records empty, so paste real ones.
4. Select **Run action**.

The dialog shows the outcome: the value the action returned, or the error.

> **Warning:** A test changes real data. Testing a delete action deletes the record. If the session is on Production, the button reads **Confirm run on Production** and the action runs as the user signed in to that page.

## Troubleshooting

| Symptom | Cause | Fix |
| --- | --- | --- |
| There is no **Test** button | No page is connected in debug mode, or the action is off. | Connect a page, and turn **Enabled** on. |
| **Parameters must be valid JSON.** | The text in **Parameters (JSON)** does not parse. | Check quotes and commas. |
| **Parameters must be a JSON object.** | The input is an array or a single value. | Wrap the values in `{ }`, with one key for each parameter. |
| The result is an error with status `401` or `403` | The tab is signed out, or its user cannot do this in your app. | Sign in to your app in the connected tab and run the test again. If it still fails, check [Authentication](https://docs.faustine.ai/web-agents/authentication/). |
| The agent still runs an action you turned off | The change is saved in the draft and no version was published. | Publish a version. |

## Next steps

- [Require confirmation for an action](https://docs.faustine.ai/web-agents/require-confirmation/): have the agent ask before it runs an action.
- [Edit an action](https://docs.faustine.ai/web-agents/edit-an-action/): fix an action that a test showed to be wrong.
- [Tests](https://docs.faustine.ai/web-agents/tests/): generate suites that run many actions in order.
