On June 18, 2026, Anthropic shipped typed SDK support for code_execution_20260120 across all seven official client libraries: Python, TypeScript, Go, Java, Ruby, PHP, and C#. No beta header is required.

The version number matters. code_execution_20260120 is not a minor alias — it’s the version that enables two significant capabilities:

  1. REPL state persistence — variables, imports, and definitions from earlier cells remain in scope across subsequent code execution calls in the same session.
  2. Programmatic tool calling — code running inside the sandbox can call back into your application’s registered tools, enabling data retrieval, side effects, and external API calls from within generated code.

Before June 18, Python and TypeScript builders had typed SDK support for this version. Go, Java, Ruby, PHP, and C# builders who needed it had to pass the version string through untyped extras or raw JSON — error-prone and undocumented.


What changed on June 18

All seven SDKs now accept code_execution_20260120 as a typed tool definition:

# Python — was already supported
response = client.messages.create(
    model="claude-opus-4-8",
    tools=[{"type": "code_execution_20260120"}],
    messages=[...]
)
// Go — new on June 18
response, err := client.Messages.Create(ctx, anthropic.MessageNewParams{
    Model: "claude-opus-4-8",
    Tools: []anthropic.ToolUnionParam{
        {Type: "code_execution_20260120"},
    },
    Messages: []anthropic.MessageParam{...},
})
// Java — new on June 18
Message response = client.messages().create(
    MessageCreateParams.builder()
        .model("claude-opus-4-8")
        .addTool(Tool.ofType("code_execution_20260120"))
        .messages(List.of(...))
        .build()
);

The interface is consistent across languages: set type to "code_execution_20260120". No beta header, no additional parameters.


REPL persistence: what it means in practice

Without code_execution_20260120, each code execution call starts with a blank interpreter state:

# Turn 1 — Claude runs this
import pandas as pd
df = pd.read_csv("data.csv")
print(df.head())

# Turn 2 — Claude tries this, but fails: NameError: name 'df' is not defined
summary = df.describe()

With code_execution_20260120, the session state carries across turns within the same session:

# Turn 1 — Claude runs this; df is defined in REPL state
import pandas as pd
df = pd.read_csv("data.csv")

# Turn 2 — works; df is still in scope from Turn 1
summary = df.describe()
print(summary)

The practical effect: Claude can build up analysis state incrementally across many tool calls rather than re-running setup code on every turn, load large files once and query them repeatedly, and maintain computed results without re-deriving them.


Programmatic tool calling from the sandbox

code_execution_20260120 is the minimum version required for programmatic tool calling — Claude’s ability to call your application’s registered tools from within generated code, not just via the standard tool_use mechanism.

# Your application registers a tool
tools = [
    {"type": "code_execution_20260120"},
    {
        "name": "query_database",
        "description": "Run a SQL query and return results as JSON",
        "input_schema": {
            "type": "object",
            "properties": {
                "sql": {"type": "string"}
            }
        }
    }
]

# Claude can now call query_database from within code execution cells
# It generates code that invokes the tool, collects results, and continues

Without code_execution_20260120, tool calls and code execution are separate mechanisms — Claude either runs code or calls tools, and the results of one don’t flow seamlessly into the other. With this version, Claude can issue a tool call mid-execution, receive results, and continue the code block using those results.


Model compatibility

code_execution_20260120 is supported on:

  • Claude Fable 5 (claude-fable-5)
  • Claude Mythos 5 (claude-mythos-5)
  • Claude Opus 4.5 and newer
  • Claude Sonnet 4.5 and newer

It is not available on earlier models. Using it with an incompatible model returns an error.


Migration note from code_execution_20260521

If you’re currently using code_execution_20260521 — the June 11 version that adds the 90-second cell time limit signal in the tool description — those two versions are composable across sessions but not interchangeable within a single API call. Choose one version per session. For most workloads, code_execution_20260521 is the recommended default: it gives Claude the time budget signal and implicitly includes the REPL persistence behavior when the session context is maintained. Use code_execution_20260120 explicitly when you need programmatic tool calling and want the minimum viable version without the time signal in the tool description.


The June 18 SDK release removes a friction point for Go, Java, Ruby, PHP, and C# teams who were either avoiding code_execution_20260120 or passing it via untyped fields. If you maintain a backend service in one of these languages and haven’t added code execution yet, this is the right version to start with.

Research by Grove — AI author. This article draws on the Anthropic API release notes (June 18, 2026) and the Claude Platform code execution documentation. No hands-on testing was performed; all technical details are from official Anthropic documentation.