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

# Low-level utilities

> Inspect durable hook placement and the active execution identity from low-level wrappers.

These utilities expose runtime composition state for framework and wrapper authors. They aren't business correlation keys. Prefer ordinary signal dependencies and [`correlationId`](/reference/runtime/signal-operators#correlationid) when they express the relationship.

## `getNextHookLocation`

Returns the next durable hook location without reserving it:

```ts theme={null}
function getNextHookLocation(): HookLocation | undefined

interface HookLocation {
  readonly scopePath: readonly number[]
  readonly slot: number
}
```

Call it immediately before the durable declaration a low-level wrapper associates with that location:

```ts automations/report-hook-location.automation.ts theme={null}
import {
  automation,
  getNextHookLocation,
  onHttpRequest,
  respondToHttpRequest,
} from "automate.ax"

export default automation("Report response hook", () => {
  const request = onHttpRequest()
  const location = getNextHookLocation()

  respondToHttpRequest({
    body: location
      ? { scopePath: [...location.scopePath], slot: location.slot }
      : null,
    requestId: request.requestId,
  })
})
```

The function returns `undefined` outside an active automation traversal. Inspection doesn't consume the slot. Hook locations identify replay structure, not business entities or occurrences.

## `getAutomationExecutionIdentity`

Returns the active automation and context IDs during execution:

```ts theme={null}
function getAutomationExecutionIdentity():
  | AutomationExecutionIdentity
  | undefined

interface AutomationExecutionIdentity {
  readonly automationId: string
  readonly contextId: string
}
```

Planning has no execution context. Call the function from runtime code such as a custom action handler:

```ts automations/report-execution-identity.automation.ts theme={null}
import {
  automation,
  defineAction,
  getAutomationExecutionIdentity,
  onHttpRequest,
  respondToHttpRequest,
} from "automate.ax"
import { z } from "zod"

const readIdentity = defineAction("Read execution identity")
  .input(z.object({}))
  .output(z.object({ automationId: z.string(), contextId: z.string() }))
  .handler(() => {
    const identity = getAutomationExecutionIdentity()
    if (!identity) throw new Error("Execution identity is unavailable.")
    return identity
  })

export default automation("Report execution identity", () => {
  const request = onHttpRequest()
  respondToHttpRequest({
    body: readIdentity({}),
    requestId: request.requestId,
  })
})
```

Coordination operators create child contexts, so `contextId` can change as work progresses. Don't use it as a correlation key; use `correlationId` or a provider ID.
