
Why it mattersOne script can run commands in parallel and pick what to send back. The model reads less output. A classifier reviews the code, not each call.
Anthropic turned on Code Mode in Claude Code. The docs page is the primary source. The feature is experimental and off by default.
Without Code Mode, Claude asks for one tool call. It reads the result. Then it decides the next step. The tools are Bash, Read, Edit, and the MCP tools in the project. With Code Mode, Claude writes a short piece of JavaScript. The code makes the tool calls, and Claude Code runs it in the session.
What one script can do
Anthropic shows this example. A user asks Claude to raise a retry limit. Claude writes code that greps for the function with ripgrep, edits the file, and runs the tests. The last line returns the file path and the test output.
One script can run commands in parallel. It can take a value from one call into the next. It can filter the output before it reaches the model. Claude reads only the lines it asks for, not every full result.
The conversation still shows each tool call, such as an edit's diff. The JavaScript itself is in the transcript viewer, hidden by default. Each piece of code shows as a collapsed row that opens with Ctrl+O.
Requirements and limits
Code Mode needs Claude Code v2.1.323 or later. The account is a Claude subscription or Console account. The model is Opus 5.5, Sonnet 5.5, Haiku 5.5, or Fable 5.2. It does not work through Amazon Bedrock, Google Cloud, Microsoft Foundry, HIPAA mode, or zero data retention. It does not run in the VS Code panel or the Desktop app.
Code Mode is turned on with the environment variable CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1, in a shell or in ~/.claude/settings.json. The first session asks to confirm. An administrator can set the variable to 0 in managed settings to block it for an organisation.
Code that Claude waits on stops after ten minutes. Background code in auto or bypass mode can run for up to two hours.
What the classifier sees
In auto mode, a classifier reviews each piece of code before it runs. It does not review each tool call. Anthropic says the classifier does not see values computed at run time. A path taken from search output is one such value. So deny and ask rules still apply to each tool call under its usual name. PreToolUse hooks do too. A hook that allows or blocks a shell command should check each part of a compound command.
Tool calls made from code have tool_use_id values that start with repl_ or toolu_cc_. The REPL tool runs the code and has its own events. Anthropic says a code call can read a secret from a file, such as a token. It can then send that value to another call. Leave OTEL_LOG_TOOL_DETAILS unset if the backend should not receive those values.
Sandbox rules apply to the shell commands the code runs. The JavaScript itself and its file, web and MCP calls run outside the sandbox.
Source
Run tool calls from code with Code Mode, Anthropic docs. Covered by InfoQ.
This item was written by an AI system from the linked source. Reveneau is responsible for what it publishes.
Get AI News in your inbox
New developer tools, model and agent releases, and how teams are actually using them to release software. Short, and only when there is something worth reading.

