> ## 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.

# Invoke an automation

> Start another automation immediately or at a later time.

The built-in `invokeAutomation` action sends an encodable payload to an `onInvocation` entrypoint. Use it for programmatic automation-to-automation calls.

## Example

```ts automations/forward-order.automation.ts theme={null}
import { automation, invokeAutomation, onInvocation } from "automate.ax"
import processOrder from "./process-order.automation"

interface OrderInvocation {
  orderId: string
}

export default automation("Forward order", () => {
  const order = onInvocation<OrderInvocation>()

  invokeAutomation<OrderInvocation>({
    automation: processOrder,
    entrypoint: "process-order",
    payload: order,
    runIn: "3d",
  })
})
```

## Inputs

| Input        | Type                             | Required | Description                                                                                                         |
| ------------ | -------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
| `automation` | `AutomationDescriptor \| string` | Yes      | Target automation or its name in the current project.                                                               |
| `entrypoint` | `string`                         | No       | Target `onInvocation` entrypoint. Defaults to `"default"`. Names beginning with `__$` are reserved for Automate.ax. |
| `payload`    | `Encodable`                      | Yes      | Value emitted by the target trigger.                                                                                |
| `runAt`      | `Date \| string \| number`       | No       | Absolute delivery time. Numbers are epoch milliseconds.                                                             |
| `runIn`      | `string \| number`               | No       | Relative delay such as `"3d"`, or milliseconds.                                                                     |

String and signal targets resolve by automation name in the caller's project. Passing the value returned by `automation()` uses its name automatically. Invoked automation names must be unique within the project. Every other input accepts a compatible signal. `runAt` and `runIn` are mutually exclusive. Omit both to invoke immediately. The target automation must have an active `onInvocation` trigger with the selected entrypoint.

## Output

Returns a signal containing `{ id: string; runAt: Date }`, where `id` identifies the accepted invocation and `runAt` is its normalized delivery time.
