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

# Anthropic

> Build durable automations with Claude Managed Agents, hosted environments, session controls, and signed lifecycle events.

Use Anthropic to define reusable Claude agents, configure hosted cloud environments, run durable sessions, handle tool approvals and custom tools, inspect threads and resources, and start automations from signed lifecycle events.

## Connect Managed Agents

1. Create an Anthropic API key with access to the workspace that owns your agents.
2. In the Anthropic Console, create a webhook with endpoint `https://automate.ax/api/v1/events/anthropic`.
3. Enable the agent, environment, and session events your automations use. Enabling every supported event lets you add triggers without revisiting the webhook.
4. Connect Anthropic in Automate.ax with **Managed Agents**. Enter the API key, the webhook signing key that begins with `whsec_`, and a workspace ID when the key can access more than one workspace.

The ordinary **API key** connection remains available for Anthropic model generation. Managed Agents triggers require the **Managed Agents** connection because it stores the signing key and workspace identity.

## Run one durable turn

```ts automations/run-claude-agent.automation.ts theme={null}
import { automation, onInvocation, withPrerequisites } from "automate.ax"
import { anthropic } from "automate.ax/anthropic"

export default automation("Review a repository", () => {
  withPrerequisites(onInvocation(), () => {
    const result = anthropic.runAgent({
      agent: "agent-id",
      environmentId: "environment-id",
      initialEvents: [
        {
          type: "user.message",
          content: [{ type: "text", text: "Review the repository." }],
        },
      ],
      budget: {
        maxListCost: { amount: "250", currency: "USD" },
        type: "limit",
      },
    })

    anthropic.getSession({ sessionId: result.session.id })
  })
})
```

[`anthropic.runAgent`](/reference/integrations/anthropic/actions/run-agent) starts the session in the initiating context. The matching idle or terminated webhook starts an ordinary root context. Automate.ax correlates both by session ID and resumes in their shared child; the webhook never inherits hidden causal ancestry.

## Sessions and control

* [Start a session](/reference/integrations/anthropic/actions/start-session), [get it](/reference/integrations/anthropic/actions/get-session), [list sessions](/reference/integrations/anthropic/actions/list-sessions), or [update one](/reference/integrations/anthropic/actions/update-session).
* [Send a message](/reference/integrations/anthropic/actions/send-message), [define an outcome](/reference/integrations/anthropic/actions/define-outcome), [confirm a tool](/reference/integrations/anthropic/actions/confirm-tool), [return a custom-tool result](/reference/integrations/anthropic/actions/submit-custom-tool-result), or [interrupt execution](/reference/integrations/anthropic/actions/interrupt-session).
* [Send ordered provider events](/reference/integrations/anthropic/actions/send-session-events) when one request must contain multiple events, including a user event immediately followed by [system context](/reference/integrations/anthropic/actions/send-system-context).
* Inspect [session events](/reference/integrations/anthropic/actions/list-session-events), [threads](/reference/integrations/anthropic/actions/list-session-threads), [thread events](/reference/integrations/anthropic/actions/list-session-thread-events), and [resources](/reference/integrations/anthropic/actions/list-session-resources).

## Agents and environments

* [Create an agent](/reference/integrations/anthropic/actions/create-agent), [update it](/reference/integrations/anthropic/actions/update-agent), and [inspect immutable versions](/reference/integrations/anthropic/actions/list-agent-versions).
* [Create a hosted environment](/reference/integrations/anthropic/actions/create-environment) and control packages plus unrestricted networking or networking restricted to specified domains.
* Session creation accepts GitHub repositories, uploaded-file references, memory-store references, vault IDs, budgets, metadata, initial messages, outcome definitions, agent overrides, MCP servers, skills, and multi-agent rosters.

Self-hosted environments, scheduled deployments, vault and credential management, memory-store management, file uploads, and skill management are outside this integration. You can attach IDs created through Anthropic APIs or Console.

## All actions

* [Create Agent](/reference/integrations/anthropic/actions/create-agent)
* [Get Agent](/reference/integrations/anthropic/actions/get-agent)
* [List Agents](/reference/integrations/anthropic/actions/list-agents)
* [Update Agent](/reference/integrations/anthropic/actions/update-agent)
* [Archive Agent](/reference/integrations/anthropic/actions/archive-agent)
* [List Agent Versions](/reference/integrations/anthropic/actions/list-agent-versions)
* [Create Environment](/reference/integrations/anthropic/actions/create-environment)
* [Get Environment](/reference/integrations/anthropic/actions/get-environment)
* [List Environments](/reference/integrations/anthropic/actions/list-environments)
* [Update Environment](/reference/integrations/anthropic/actions/update-environment)
* [Archive Environment](/reference/integrations/anthropic/actions/archive-environment)
* [Delete Environment](/reference/integrations/anthropic/actions/delete-environment)
* [Start Session](/reference/integrations/anthropic/actions/start-session)
* [Run Agent](/reference/integrations/anthropic/actions/run-agent)
* [Get Session](/reference/integrations/anthropic/actions/get-session)
* [List Sessions](/reference/integrations/anthropic/actions/list-sessions)
* [Update Session](/reference/integrations/anthropic/actions/update-session)
* [Archive Session](/reference/integrations/anthropic/actions/archive-session)
* [Delete Session](/reference/integrations/anthropic/actions/delete-session)
* [List Session Events](/reference/integrations/anthropic/actions/list-session-events)
* [Send Session Events](/reference/integrations/anthropic/actions/send-session-events)
* [Send Message](/reference/integrations/anthropic/actions/send-message)
* [Send System Context](/reference/integrations/anthropic/actions/send-system-context)
* [Define Outcome](/reference/integrations/anthropic/actions/define-outcome)
* [Confirm Tool](/reference/integrations/anthropic/actions/confirm-tool)
* [Submit Custom Tool Result](/reference/integrations/anthropic/actions/submit-custom-tool-result)
* [Interrupt Session](/reference/integrations/anthropic/actions/interrupt-session)
* [List Session Threads](/reference/integrations/anthropic/actions/list-session-threads)
* [Get Session Thread](/reference/integrations/anthropic/actions/get-session-thread)
* [Archive Session Thread](/reference/integrations/anthropic/actions/archive-session-thread)
* [List Session Thread Events](/reference/integrations/anthropic/actions/list-session-thread-events)
* [Add Session File](/reference/integrations/anthropic/actions/add-session-file)
* [Get Session Resource](/reference/integrations/anthropic/actions/get-session-resource)
* [List Session Resources](/reference/integrations/anthropic/actions/list-session-resources)
* [Update Repository Token](/reference/integrations/anthropic/actions/update-repository-token)
* [Delete Session Resource](/reference/integrations/anthropic/actions/delete-session-resource)

## All triggers

* [On Agent Event](/reference/integrations/anthropic/triggers/on-agent-event)
* [On Agent Created](/reference/integrations/anthropic/triggers/on-agent-created)
* [On Agent Updated](/reference/integrations/anthropic/triggers/on-agent-updated)
* [On Agent Archived](/reference/integrations/anthropic/triggers/on-agent-archived)
* [On Agent Deleted](/reference/integrations/anthropic/triggers/on-agent-deleted)
* [On Environment Event](/reference/integrations/anthropic/triggers/on-environment-event)
* [On Environment Created](/reference/integrations/anthropic/triggers/on-environment-created)
* [On Environment Updated](/reference/integrations/anthropic/triggers/on-environment-updated)
* [On Environment Archived](/reference/integrations/anthropic/triggers/on-environment-archived)
* [On Environment Deleted](/reference/integrations/anthropic/triggers/on-environment-deleted)
* [On Session Event](/reference/integrations/anthropic/triggers/on-session-event)
* [On Session Run Started](/reference/integrations/anthropic/triggers/on-session-run-started)
* [On Session Idled](/reference/integrations/anthropic/triggers/on-session-idled)
* [On Session Budget Reached](/reference/integrations/anthropic/triggers/on-session-budget-reached)
* [On Session Rescheduled](/reference/integrations/anthropic/triggers/on-session-rescheduled)
* [On Session Terminated](/reference/integrations/anthropic/triggers/on-session-terminated)
* [On Session Thread Created](/reference/integrations/anthropic/triggers/on-session-thread-created)
* [On Session Thread Idled](/reference/integrations/anthropic/triggers/on-session-thread-idled)
* [On Session Thread Terminated](/reference/integrations/anthropic/triggers/on-session-thread-terminated)
* [On Session Outcome Evaluation Ended](/reference/integrations/anthropic/triggers/on-session-outcome-evaluation-ended)
* [On Session Updated](/reference/integrations/anthropic/triggers/on-session-updated)
* [On Session Deleted](/reference/integrations/anthropic/triggers/on-session-deleted)

## Webhook behavior

Anthropic webhooks contain resource IDs, not complete objects. Automate.ax verifies the Standard Webhooks signature and five-minute timestamp window, deduplicates retries by event ID, then fetches the authoritative agent, environment, session, and latest idle reason. Deliveries may arrive out of order and Anthropic does not provide webhook backfill, so use the resource-fetching actions when you need current state.

Every action uses camelCase public fields and the official Anthropic client. Provider calls time out before the action lease. Read actions are replay-safe; creates, updates, sends, interrupts, archival, and deletion are not retried after an uncertain provider response.
