# Deploy Claude Managed Agents SDK projects

> Run an existing Claude Managed Agents application through a governed Anthropic Connection without changing SDK calls.

Claude Managed Agents is an Anthropic-hosted Agent, Environment, Session, and event protocol. Constal preserves that ownership honestly: your application is a Constal Agent or Channel, while its Managed Agent and cloud sandbox remain Anthropic provider subresources reached through the `service/claude-managed-agents` Connection. Constal does not claim that an Anthropic cloud Environment is a local SandboxPool. See Anthropic's [Managed Agents overview](https://platform.claude.com/docs/en/managed-agents/overview) and [session event documentation](https://platform.claude.com/docs/en/managed-agents/events-and-streaming).

The current qualified client line is `@anthropic-ai/sdk` 0.122.x with the `managed-agents-2026-04-01` beta protocol.

## Before you begin {#before-you-begin}

Store an Anthropic API key as a Constal Credential and assign it to the tenant-scoped key `anthropic-managed-agents`. The platform Connection requires that assignment and fails closed when it is absent. The key never enters application code; `ANTHROPIC_API_KEY` contains only a sentinel.

Your project must already expose a default request handler or a conventional Node HTTP server. Existing calls such as `client.beta.agents.create()`, `client.beta.environments.create()`, `client.beta.sessions.create()`, and `client.beta.sessions.events.stream()` remain unchanged.

```ts
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

export default async function start(input: {
  agent: string;
  environmentId: string;
}) {
  return client.beta.sessions.create({
    agent: input.agent,
    environment_id: input.environmentId,
  });
}
```

## Deploy {#steps}

```sh
constal deploy . --wait
```

The builder detects reachable Managed Agents beta calls separately from ordinary Anthropic Messages calls. A default handler becomes one immutable Agent. An unchanged Node server becomes a server Agent plus an ordinary authenticated Channel.

## Runtime mapping {#mapping}

| Managed Agents surface | Constal mapping |
| --- | --- |
| SDK application handler | immutable Agent Resource and Run |
| Node HTTP server | server Agent behind a Channel |
| Managed Agent and version | provider subresource behind the Connection |
| cloud Environment | Anthropic-owned sandbox configuration |
| Managed Session | provider durable Session correlated with the outer Constal Session |
| event send, list, and stream | explicit journaled Connection operations |
| custom Tool result | application code; its external work crosses ordinary Resources |
| Tool confirmation | code Policy and approval before the confirmation event is sent |
| API key | scoped Credential injected only by the Driver |
| usage and errors | provider evidence recorded on the outer Run |

The outer Constal journal makes every SDK boundary operation replay-aware. Provider Agent, Environment, and Session creation are non-idempotent: an ambiguous outcome is surfaced for reconciliation rather than silently repeated. Read and event-stream operations are repeatable. The initial event-stream transport may keep a Worker request open; moving the socket to a connection-holding placement is an optimization, not a second runtime.

## Qualified API surface {#qualified-surface}

The qualified 0.122 surface covers Agents and versions; Deployments and deployment runs; Environments and work queues; Sessions, events, resources, and threads; Vaults and credentials; and the SDK support-resource APIs for files, memory stores, skills, tunnels, user profiles, and dreams. Every accepted route is enumerated by the Connection Driver. Reads and event listing/streaming use repeatable operations; writes use non-idempotent recovery and surface an unknown outcome instead of being repeated blindly. Requests outside those exact families never fall through to unrestricted HTTP.

Built-in Anthropic Tool execution is observable through Managed Session events but is not misrepresented as an independently governed Constal Tool effect. Use Managed custom Tools when every external action must cross a Constal Resource. A future self-hosted Environment adapter can bind Anthropic's worker protocol to a declared SandboxPool without changing application SDK calls.

## Verify {#verify}

Create one low-risk Managed Session, send a user event, consume its event stream to `session.status_idle`, and inspect the outer Constal Run journal. Confirm the Connection operation, Credential identity, customer scope, and response event ids are pinned. Repeat with two customers and confirm their Credentials, outer Sessions, Policy, and cost scopes differ even if they call the same deployed application.

## Next steps {#next-steps}

Continue with [Store a Credential](/docs/credentials/store-secret), [Scoped bindings](/docs/credentials/scoped-bindings), and [Operate Runs](/docs/runs/operate.md).
