handling-stop-reasons changedbuild-with-claude/handling-stop-reasons
Nearest release: v2.1.281, published an hour 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+33added
Lines−2removed
From line
897
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits8to this page, all time
The whole hunk
from line 897, old and new numbered
/
from line 897
897897
898898 <CodeGroup exclude="shell:cURL">
899899 ```bash CLI
900 RESPONSE=$(ant messages create --max-tokens 1024 --format jsonl < request.yaml)
900 RESPONSE=$(ant messages create --max-tokens 1024 --format jsonl <<'YAML'
901 model: claude-opus-5-5
902 tools:
903 - name: get_weather
904 description: Get the current weather in a given location
905 input_schema:
906 type: object
907 properties:
908 location:
909 type: string
910 required:
911 - location
912 messages:
913 - role: user
914 content: What is the weather in San Francisco?
915 YAML
916 )
901917
902918 # Check if the response was truncated mid tool use
903919 STOP_REASON=$(jq -r '.stop_reason' <<<"$RESPONSE")
from line 920
904920 LAST_TYPE=$(jq -r '.content[-1].type' <<<"$RESPONSE")
905921 if [ "$STOP_REASON" = "max_tokens" ] && [ "$LAST_TYPE" = "tool_use" ]; then
906922 # Retry with a higher max_tokens
907 ant messages create --max-tokens 4096 < request.yaml
923 ant messages create --max-tokens 4096 <<'YAML'
924 model: claude-opus-5-5
925 tools:
926 - name: get_weather
927 description: Get the current weather in a given location
928 input_schema:
929 type: object
930 properties:
931 location:
932 type: string
933 required:
934 - location
935 messages:
936 - role: user
937 content: What is the weather in San Francisco?
938 YAML
908939 fi
909940 ```
910941
No line in this hunk matches that.