> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# On Automate.ax automation state changed

> Run an automation when another Automate.ax automation is enabled or disabled.

`automate.onAutomationStateChanged` emits whenever the selected automation's enabled state changes. Use a semantic trigger when only one direction matters.

```ts automations/watch-automation-state.automation.ts theme={null}
import { automation } from "automate.ax"
import { automate } from "automate.ax/automate"

export default automation("Watch automation state", () => {
  const event = automate.onAutomationStateChanged({
    account: "operations",
    automation: "auto_01",
  })

  // Notify an owner when the Automate.ax automation changes state.
})
```

## Configuration

| Property     | Type                                                | Required | Description                                                                                                                    |
| ------------ | --------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `account`    | `string \| IntegrationAccountReference<"automate">` | No       | Static binding with `project:read` for another organization. Omit it to use the deploying project's organization.              |
| `automation` | `AutomationDescriptor \| string`                    | Yes      | Imported descriptor, exact ID, or unique deployed description to watch. It must belong to the resulting organization identity. |

## Trigger data

Returns the selected automation and its project and organization, plus `previousEnabled`, `enabled`, and `transitionedAt`. The automation includes `id`, `identityKey`, and deployed `description`.

Automate.ax stores this event in the same transaction as the state change. An action does not wake the automation that performed that action, but other subscribed automations still receive it.
