Skip to content
←All articles
AI Tools8 min read

Claude Code Code Mode on Bedrock, Google Cloud and Foundry: what changed in v2.1.331

Since November 23, 2026, Claude Code's Code Mode also runs on Bedrock, Google Cloud and Foundry. Requirements, exclusions and what to check first.

On November 23, 2026, Anthropic released Claude Code v2.1.331, which brings Code Mode, the experimental mode where Claude writes JavaScript to make several tool calls in one step, to terminal sessions that run through Amazon Bedrock, Google Cloud (Agent Platform), Microsoft Foundry and Claude Platform on AWS. This updates our November 16 article on Code Mode, where "Anthropic API only" was the main limit.

In sintesi

  • Since v2.1.331 (November 23, 2026), Code Mode runs in the terminal on Bedrock, Google Cloud's Agent Platform, Foundry and Claude Platform on AWS. LLM gateways, Claude for Government and organizations with HIPAA or zero data retention are still excluded.
  • With an Enterprise Admin Console sign-in you need Agent Platform, or Bedrock without the Mantle endpoint. Foundry and Mantle are excluded in that case.
  • Since v2.1.329, Code Mode works alongside OpenTelemetry events and metrics, so cost monitoring is no longer a reason to skip it. Tracing is still incompatible.
  • Since v2.1.328, UserPromptSubmit hooks no longer see code output: redaction now belongs in a PostToolUse hook.
  • To block it you must ship CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=0 through MDM or a managed settings file, because server-managed settings do not cover these providers.

What changed since November 16

In the first article, Code Mode was limited to the Anthropic API. The official documentation now lists a Claude subscription, a Console account or a cloud provider such as Amazon Bedrock, Google Cloud's Agent Platform and Microsoft Foundry as valid accounts, with v2.1.331 or later for providers. The v2.1.331 release notes confirm it and add Claude Platform on AWS.

Releases after v2.1.323 also changed several limits we had listed. The ones that matter for company use are in the table.

TopicAt v2.1.323 (November 12)Now
ProvidersAnthropic API onlyAlso Bedrock, Agent Platform, Foundry, Claude Platform on AWS (v2.1.331)
Agent teamsIncompatibleCompatible since v2.1.326
OpenTelemetryEvents and metrics blocked Code ModeEvents and metrics allowed since v2.1.329, tracing is not
Telemetry and feature flags turned offCode Mode would not startStarts since v2.1.329
PreToolUse hook that errorsCall refusedGoes on to permission checks, refused only on timeout or with "onFailure": "block"
10-minute timeoutAlso counted time spent at a permission promptNo longer counts in Manual and acceptEdits modes (v2.1.328)

The dates of the intermediate versions come from the GitHub releases: v2.1.326 on November 16, v2.1.328 on November 19, v2.1.329 on November 19.

Requirements on a cloud provider

On a cloud provider you need v2.1.331, a supported model and an organization without HIPAA or zero data retention. The supported models are Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2. If you select the model by deployment name or application inference profile, the documentation tells you to check with whoever manages that name that it points to one of these models. Aliases such as sonnet can select older models on some providers, and then Code Mode does not start, with the message it only works with Opus 5.5, Sonnet 5.5 and later models.

The exclusions, again from the documentation:

  • LLM gateways and Claude for Government;
  • an Enterprise Admin Console sign-in on Foundry, or on Bedrock with the Mantle endpoint;
  • VS Code, Desktop and cloud sessions: you need an interactive claude in a terminal;
  • apiKeyHelper on a direct connection to Anthropic;
  • OpenTelemetry tracing turned on.

The availability by provider table marks Code Mode as available in all seven columns (subscription, Console, Bedrock, Claude Platform on AWS, both Google Cloud offerings and Foundry), each time as "experimental, requirements apply".

There is one continuity constraint: after a Code Mode session run with a subscription or Console account, you cannot resume it on a provider such as Bedrock. If a team switches accounts, long sessions stay tied to where they started.

Trying it on Bedrock or Agent Platform

The steps match the first article, with the provider variable in front. On Bedrock, for example:

claude --version   # must be 2.1.331 or later
CLAUDE_CODE_USE_BEDROCK=1 CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude --model <full-name-of-a-supported-model>

For Google Cloud (Agent Platform) the variable is CLAUDE_CODE_USE_VERTEX, for Foundry CLAUDE_CODE_USE_FOUNDRY, for Claude Platform on AWS CLAUDE_CODE_USE_ANTHROPIC_AWS, as listed on the availability page. If the line Code Mode (experimental) is on does not appear, /status shows the reason, and the "Code Mode doesn't start" section of the documentation has one row per cause.

Monitoring: OpenTelemetry works, but your queries change

Since v2.1.329, Code Mode starts with OpenTelemetry events and metrics on: each call the code makes produces its own tool_decision and tool_result events under the tool's usual name, such as Bash. Tracing does not work and is still a blocker.

According to the documentation, calls made from code can be recognized by tool_use_id values that start with repl_ or toolu_cc_, and the REPL tool that runs the code has events of its own without those prefixes. In auto mode, a call covered by the review of the code has no classifier_verdict: the verdict sits on the REPL tool's tool_decision events with the same request_id. If you find more than one, the events do not show which piece of code made the call. If you have audit dashboards on classifier decisions, update the queries before rolling Code Mode out further.

One warning from the same page: code can read a value, such as a token in a file, and pass it to another call. If your backend should not receive it, leave OTEL_LOG_TOOL_DETAILS unset.

Hooks: what changed for security and redaction

Two changes affect anyone who wrote Code Mode hooks from our first guide. First, since v2.1.328 UserPromptSubmit hooks no longer receive code output, not even those administrators set in managed settings. To hide output you need a PostToolUse hook that matches REPL and returns updatedToolOutput, as described on the Code Mode page.

Second, failures. Since v2.1.329 a PreToolUse hook that errors no longer refuses the code's call, as already happened outside Code Mode. The call is still refused if the hook times out. To refuse on other failures too, such as a missing script, set "onFailure": "block" on a command, http or mcp_tool hook. Since v2.1.328, "onFailure": "block" also works for mcp_tool hooks.

The outcomes, taken from the documentation for v2.1.329 and later:

onFailureHook times outOther failure, such as a missing script
Not setRefusedGoes on to permission checks
"block"RefusedRefused
"continue"Goes on to permission checksGoes on to permission checks

If you tuned a hook to v2.1.323 behavior, reread it: the rule "error means refusal" no longer holds.

How to block it on a cloud provider

If you manage Claude Code on Bedrock or Google Cloud you cannot rely on server-managed settings: the availability table marks them as unavailable on every cloud provider. The Code Mode documentation says to deploy the setting through MDM or a managed settings file, because a user who sets a variable such as CLAUDE_CODE_USE_BEDROCK in their shell or user settings can start Code Mode without receiving server-managed settings.

{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "0"
  }
}

The value 0 wins over any 1 set elsewhere. People already in a Code Mode session stay in it until they exit, and cannot resume it afterwards while the 0 is in place. Managed settings cannot turn Code Mode on for users.

What to do now

Rayo's view: if you are on a cloud provider for contract or data residency reasons, you can try it now, but the experimental status weighs more, because the documentation says it can change or disappear in any release.

  1. Check with claude --version that the team's laptops are on v2.1.331 or later.
  2. Confirm with whoever manages Bedrock, Agent Platform or Foundry that deployment names and inference profiles point to Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2.
  3. If you have HIPAA or zero data retention, Code Mode is excluded. Writing the 0 in managed settings makes the choice explicit and stops anyone from turning it on if conditions change.
  4. Update OpenTelemetry queries for the repl_ and toolu_cc_ prefixes and for REPL before expanding use.
  5. Review your hooks: move output redaction to PostToolUse and decide onFailure for each PreToolUse hook.
  6. Measure one repetitive task with and without Code Mode. The documentation publishes no savings figures for Claude Code.

For a broader look at costs, see also how to cut Claude Code token usage.

Sources

FAQ

Does Claude Code's Code Mode work on Amazon Bedrock? Yes, since v2.1.331 on November 23, 2026, in an interactive terminal session. You need a supported model (Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2) and an organization without HIPAA or zero data retention. With an Enterprise Admin Console sign-in, Bedrock with the Mantle endpoint is excluded.

Does it work on Google Cloud and Microsoft Foundry? Yes on both, with v2.1.331 or later. With an Enterprise Admin Console sign-in, Foundry is excluded and Google Cloud's Agent Platform stays allowed. Claude Platform on AWS is covered too.

Can I use it through an LLM gateway? No. The documentation excludes gateways and Claude for Government. If an administrator set up the gateway and you need it, the documentation suggests turning Code Mode off to stop seeing the startup notice.

Is Code Mode compatible with OpenTelemetry? Since v2.1.329, yes for events and metrics, and each call the code makes produces its own events. Tracing is still incompatible: with tracing on, Code Mode does not start.

How do I block it on Bedrock or Google Cloud? Set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to 0 in a managed settings file deployed through MDM. Server-managed settings do not cover these providers, and the value 0 wins over any 1 set elsewhere.

Città di Castello, Umbria, ItalyOpen in Google Maps