#!/usr/bin/env bash set -eo pipefail cd "$(dirname "$0")/../../.." source scripts/lib.sh MODEL="${MODEL:-claude-haiku-4-5-20251001}" # 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. # 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). T='[{"type":"code_execution_20250825","name":"code_execution"}]' R1=$(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."}]}')") log_request anthropic POST /v1/messages "$ANT_STATUS" 0.005 "code-execution/code_execution.sh step1" echo "$R1" | jq -c '.container, (.content[]|{type,name,input,result:(.content|objects|{type,stdout,return_code}),text})' CID=$(echo "$R1" | jq -r .container.id) R2=$(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."}]}')") log_request anthropic POST /v1/messages "$ANT_STATUS" 0.005 "code-execution/code_execution.sh step2 container reuse" echo "$R2" | jq -c '.container, (.content[]|select(.type=="text")|.text)'