Follow Discord
Sweep 03 Nov 2026 · 22:27Z Build v2.1.318 536 read Stable v2.1.311 Latest v2.1.318 Next v2.1.318 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

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

Nearest release: v2.1.318, published 4 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.

Recorded here
Lines+8added
Lines−6removed
From line 63 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits28to this page, all time

The whole hunk

from line 63, old and new numbered
/
lines
from line 63
6363To check whether a model accepts the code execution tool before you send a request, read its `capabilities.server_tools.code_execution.supported` value from the Models API. Don’t use the top-level `capabilities.code_execution` value for this. It reports whether code running in this tool can call your request’s other tools, as in programmatic tool calling. [Using the Models API](https://platform.claude.com/docs/en/models/overview#using-the-models-api) describes both fields.
6464 
6565<Note>
66 If you’re still using the legacy `code_execution_20250522` (Python only), see [Upgrade to latest tool version](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upgrade-to-latest-tool-version) to migrate from it.
66 If you’re using `code_execution_20250522` (Python only), see [Upgrade to latest tool version](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#upgrade-to-latest-tool-version) to migrate from it.
6767</Note>
6868 
6969## Quick start
from line 74
7474 ```bash cURL
7575 curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
7676 -H "x-api-key: $ANTHROPIC_API_KEY" \
77 -H "anthropic-version: 2023-06-01" \
77 -H "anthropic-version: 2026-10-21" \
7878 -H "content-type: application/json" \
7979 -d '{
8080 "model": "claude-opus-5-5",
from line 295
295295 # First, upload a file
296296 curl --fail-with-body -sS https://api.anthropic.com/v1/files \
297297 -H "x-api-key: $ANTHROPIC_API_KEY" \
298 -H "anthropic-version: 2023-06-01" \
298 -H "anthropic-version: 2026-10-21" \
299299 -F "[email protected]"
300300 
301301 # Then use the file with code execution: FILE_ID is the ID from the upload response
302302 curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
303303 -H "x-api-key: $ANTHROPIC_API_KEY" \
304 -H "anthropic-version: 2023-06-01" \
304 -H "anthropic-version: 2026-10-21" \
305305 -H "content-type: application/json" \
306306 -d '{
307307 "model": "claude-opus-5-5",
from line 1091
10911091 
10921092The response might include a `pause_turn` stop reason, which indicates that the API paused a long-running turn. You may provide the response back as-is in a subsequent request to let Claude continue its turn, or modify the content if you want to interrupt the conversation.
10931093 
1094Send the response’s container ID back with that request (see [Container reuse](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool#container-reuse)). Without it, the request runs in a new container, and files from earlier in the turn are lost.
1095 
10941096## Containers
10951097 
10961098The code execution tool runs in a secure, containerized environment designed specifically for code execution, with a higher focus on Python.
from line 1146
11441146 # First request: Create a file with a random number
11451147 curl https://api.anthropic.com/v1/messages \
11461148 -H "x-api-key: $ANTHROPIC_API_KEY" \
1147 -H "anthropic-version: 2023-06-01" \
1149 -H "anthropic-version: 2026-10-21" \
11481150 -H "content-type: application/json" \
11491151 -d '{
11501152 "model": "claude-opus-5-5",
from line 1165
11631165 # CONTAINER_ID is the container.id from the first response
11641166 curl https://api.anthropic.com/v1/messages \
11651167 -H "x-api-key: $ANTHROPIC_API_KEY" \
1166 -H "anthropic-version: 2023-06-01" \
1168 -H "anthropic-version: 2026-10-21" \
11671169 -H "content-type: application/json" \
11681170 -d '{
11691171 "container": "'"$CONTAINER_ID"'",
Feedback