Python 88.3%
TypeScript 7.6%
Shell 4.1%
1#!/usr/bin/env bash2set -eo pipefail3cd "$(dirname "$0")/../../.."4source scripts/lib.sh5MODEL="${MODEL:-claude-haiku-4-5-20251001}"6# code_execution_20250825 then container reuse. Response has top-level container{id,expires_at}; blocks: server_tool_use(bash_code_execution) + bash_code_execution_tool_result.7# STATUS: LIVE_VERIFIED 2026-09-18 (e1 stdout "4", e2 reused container id, ~$0.01 tokens; container-hours within the free 1,550 h/month).8T='[{"type":"code_execution_20250825","name":"code_execution"}]'9R1=$(ant POST /v1/messages -d "$(jq -n --argjson t "$T" --arg m "$MODEL" '{model:$m,max_tokens:400,tools:$t,messages:[{role:"user",content:"Use the code execution tool to run print(2+2) and reply with only the number."}]}')")10log_request anthropic POST /v1/messages "$ANT_STATUS" 0.005 "code-execution/code_execution.sh step1"11echo "$R1" | jq -c '.container, (.content[]|{type,name,input,result:(.content|objects|{type,stdout,return_code}),text})'12CID=$(echo "$R1" | jq -r .container.id)13R2=$(ant POST /v1/messages -d "$(jq -n --argjson t "$T" --arg m "$MODEL" --arg c "$CID" '{model:$m,max_tokens:300,container:$c,tools:$t,messages:[{role:"user",content:"Run the shell command `echo hi` with the code execution tool and reply with only its output."}]}')")14log_request anthropic POST /v1/messages "$ANT_STATUS" 0.005 "code-execution/code_execution.sh step2 container reuse"15echo "$R2" | jq -c '.container, (.content[]|select(.type=="text")|.text)'16