Source Intelligence
Sweep 28 Aug 2026 ยท 00:00Z Build v2.1.250 478 read Stable v2.1.236 Latest v2.1.250 Next v2.1.250 Feeds RSS JSON llms.txt

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

One change

code-execution-tool

agents-and-tools/tool-use/code-execution-tool

first seen The page's own history The capture it came from

Nearest release: v2.1.239, published 2 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

agents-and-tools/tool-use/code-execution-tool Changed · +12 / -18 lines

from line 42
 * `code_execution_20260120` adds REPL state persistence and [programmatic tool calling](https://platform.claude.com/docs/en/agents-and-tools/tool-use/programmatic-tool-calling) from within the sandbox. Claude Haiku 4.5 accepts the `code_execution_20260120` and `code_execution_20260521` tool types, but programmatic tool calling and the REPL state persistence that depends on it aren't available on it, so the newer versions behave like `code_execution_20250825` there.
 * `code_execution_20260521` is the same runtime as `code_execution_20260120`. The difference is that the tool description tells Claude about the 90-second wall-clock limit on each Python cell in programmatic tool calling, so Claude can budget long-running cells. A cell that exceeds the limit returns a normal code execution result with a non-zero `return_code` and a `detection_timeout` status message in its output. This is separate from the `execution_time_exceeded` [error code](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#errors), which the API returns when a whole tool invocation exceeds the maximum execution time.
 
-All three tool versions are generally available and don't require an `anthropic-beta` header. The legacy code execution beta headers remain valid opt-ins.
+None of the three tool versions requires an `anthropic-beta` header. The legacy code execution beta headers remain valid opt-ins.
 
 The examples on this page use `code_execution_20250825`, which covers the Bash and file operations they demonstrate and behaves the same way on every model in the table; use `code_execution_20260120` or later when you need programmatic tool calling or REPL state persistence. The current [web search](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool) and [web fetch](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool) tools (`web_search_20260209`, `web_fetch_20260209`, and later) require `code_execution_20260120` or later as their code execution version.
 
from line 324
 
   ```bash CLI
   # First, upload a file and capture the file ID
-  FILE_ID=$(ant files upload \
-    --file ./data.csv \
-    --transform id --raw-output)
+  FILE_ID=$(ant files upload --file ./data.csv --transform id --raw-output)
 
   # Then use the file_id with code execution
   ant messages create <<YAML
from line 503
   ```
 
   ```php PHP
-  // The PHP SDK exposes the Files API under the beta namespace; field names can differ from other SDKs.
   $client = new Client();
 
   // Upload a file
-  $fileObject = $client->beta->files->upload(
+  $fileObject = $client->files->upload(
       file: FileParam::fromResource(fopen('data.csv', 'r')),
   );
 
   // Use the file_id with code execution
-  $response = $client->beta->messages->create(
+  $response = $client->messages->create(
       model: Model::CLAUDE_OPUS_5,
       maxTokens: 4096,
-      betas: [AnthropicBeta::FILES_API_2025_04_14],
       messages: [
           [
               'role' => 'user',
               'content' => [
-                  BetaTextBlockParam::with(text: 'Analyze this CSV data'),
-                  BetaContainerUploadBlockParam::with(fileID: $fileObject->id),
+                  TextBlockParam::with(text: 'Analyze this CSV data'),
+                  ContainerUploadBlockParam::with(fileID: $fileObject->id),
               ],
           ],
       ],
-      tools: [new BetaCodeExecutionTool20250825()],
+      tools: [new CodeExecutionTool20250825()],
   );
 
   echo json_encode($response), PHP_EOL;
from line 803
   ```
 
   ```php PHP
-  // The PHP SDK exposes the Files API under the beta namespace; field names can differ from other SDKs.
   $client = new Client();
 
   // Request code execution that creates files
-  $response = $client->beta->messages->create(
+  $response = $client->messages->create(
       maxTokens: 4096,
       messages: [
           [
from line 815
           ],
       ],
       model: Model::CLAUDE_OPUS_5,
-      betas: [AnthropicBeta::FILES_API_2025_04_14],
-      tools: [new BetaCodeExecutionTool20250825()],
+      tools: [new CodeExecutionTool20250825()],
   );
 
   /**
from line 823
    *
    * @return list<string>
    */
-  function extractFileIds(BetaMessage $response): array
+  function extractFileIds(Message $response): array
   {
       $fileIds = [];
       foreach ($response->content as $block) {
from line 843
 
   // Download the created files
   foreach (extractFileIds($response) as $fileId) {
-      $fileMetadata = $client->beta->files->retrieveMetadata($fileId);
-      $fileContent = $client->beta->files->download($fileId);
+      $fileMetadata = $client->files->retrieveMetadata($fileId);
+      $fileContent = $client->files->download($fileId);
 
       file_put_contents($fileMetadata->filename, $fileContent);
       echo "Downloaded: {$fileMetadata->filename}\n";