Follow Discord
Sweep 22 Oct 2026 · 21:04Z Build v2.1.309 528 read Stable v2.1.308 Latest v2.1.309 Next v2.1.309 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

computer-use-tool changedagents-and-tools/tool-use/computer-use-tool

Nearest release: v2.1.309, published 3 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+32added
Lines−24removed
From line 22 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 22, old and new numbered
/
lines
from line 22
2222 Claude API: ga
2323 Claude Platform on AWS: beta
2424 Amazon Bedrock: beta
25 Google Cloud: ga
25 Claude Models on Google Cloud (Google managed): ga
2626 Microsoft Foundry: beta
2727 details:
2828 - On the Claude API and Claude Models on Google Cloud (Google managed), Claude 5.5 and later models support computer use only through the `computer_toolset_20260801` toolset and return an error for the earlier `computer_20251124` and `computer_20250124` tool versions. To move an existing integration, see [Migrate from `computer_20251124`](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#migrate-from-computer-20251124). To move from `computer_20250124`, see [Move computer use to the toolset](https://platform.claude.com/docs/en/models/haiku-5-5/migration-guide#computer-use-toolset) in the Claude Haiku 5.5 migration guide.
from line 232
232232 messages: [
233233 ['role' => 'user', 'content' => 'Save a picture of a cat to my desktop.'],
234234 ],
235 model: 'claude-opus-5-5',
235 model: Model::CLAUDE_OPUS_5_5,
236236 tools: [
237237 ['type' => 'computer_toolset_20260801'],
238238 [
from line 617
617617 List<MessageParam> samplingLoop(Model model, List<MessageParam> messages, int maxIterations) {
618618 for (int i = 0; i < maxIterations; i++) {
619619 Message response = client.messages().create(MessageCreateParams.builder()
620 .model(model)
621 .maxTokens(4096)
622 .messages(messages)
623 .addTool(COMPUTER_TOOLSET)
624 .build());
620 .model(model)
621 .maxTokens(4096)
622 .messages(messages)
623 .addTool(COMPUTER_TOOLSET)
624 .build());
625625 
626626 // Add Claude's response to the conversation history
627627 messages.add(response.toParam());
from line 891
891891 
892892### Build a custom computer use environment
893893 
894The [reference implementation](https://github.com/anthropics/anthropic-quickstarts/tree/main/computer-use-demo) is meant to help you get started with computer use. It includes all of the components needed to have Claude use a computer. However, you can build your own environment for computer use to suit your needs. You'll need:
894The [reference implementation](https://github.com/anthropics/anthropic-quickstarts/tree/main/computer-use-demo) is meant to help you get started with computer use. It includes all of the components needed to have Claude use a computer. However, you can build your own environment for computer use to suit your needs. You need:
895895 
896896* A virtualized or containerized environment suitable for computer use with Claude
897897* An implementation of the computer use tool's actions
from line 1122
11221122 
11231123 ToolResultBlockParam.Content captureScreenshot() {
11241124 ImageBlockParam image = ImageBlockParam.builder()
1125 .source(Base64ImageSource.builder()
1126 .mediaType(Base64ImageSource.MediaType.IMAGE_PNG)
1127 .data(PLACEHOLDER_PNG)
1128 .build())
1129 .build();
1125 .source(Base64ImageSource.builder()
1126 .mediaType(Base64ImageSource.MediaType.IMAGE_PNG)
1127 .data(PLACEHOLDER_PNG)
1128 .build())
1129 .build();
11301130 return ToolResultBlockParam.Content.ofBlocks(
1131 List.of(ToolResultBlockParam.Content.Block.ofImage(image)));
1131 List.of(ToolResultBlockParam.Content.Block.ofImage(image)));
11321132 }
11331133 
11341134 String clickAt(long x, long y) {
from line 1419
14191419 }
14201420 
14211421 // processToolCalls runs the computer actions in Claude's response in order and
1422 // builds one tool_result per tool_use block. After the first failure it skips
1422 // builds one tool_result for each tool_use block. After the first failure it skips
14231423 // the rest: Claude planned them assuming the earlier actions succeeded.
14241424 func processToolCalls(response *anthropic.Message) []anthropic.ContentBlockParamUnion {
14251425 var toolResults []anthropic.ContentBlockParamUnion
from line 1460
14601460 /** Every result answering a computer toolset member echoes toolset_name. */
14611461 ToolResultBlockParam.Builder computerResult(ToolUseBlock toolUse) {
14621462 return ToolResultBlockParam.builder()
1463 .toolUseId(toolUse.id())
1464 .toolsetName("computer");
1463 .toolUseId(toolUse.id())
1464 .toolsetName("computer");
14651465 }
14661466 
14671467 /**
14681468 * Run the computer actions in Claude's response in order and build one
1469 * tool_result per tool_use block. After the first failure, skip the rest:
1469 * tool_result for each tool_use block. After the first failure, skip the rest:
14701470 * Claude planned them assuming the earlier actions succeeded.
14711471 */
14721472 List<ContentBlockParam> processToolCalls(Message response) {
from line 1480
14801480 ToolUseBlock toolUse = block.asToolUse();
14811481 ToolResultBlockParam result;
14821482 if (failed) {
1483 result = computerResult(toolUse).content(HALT_TEXT).isError(true).build();
1483 result = computerResult(toolUse)
1484 .content(HALT_TEXT)
1485 .isError(true)
1486 .build();
14841487 } else {
14851488 try {
14861489 Map<String, JsonValue> input =
1487 (Map<String, JsonValue>) toolUse._input().asObject().get();
1490 (Map<String, JsonValue>) toolUse._input().asObject().get();
14881491 // A string, or the image block that screenshot returns
14891492 ToolResultBlockParam.Content output = handleComputerAction(toolUse.name(), input);
1490 result = computerResult(toolUse).content(output).build();
1493 result = computerResult(toolUse)
1494 .content(output)
1495 .build();
14911496 } catch (RuntimeException e) {
14921497 failed = true;
1493 result = computerResult(toolUse).content("Error: " + e.getMessage()).isError(true).build();
1498 result = computerResult(toolUse)
1499 .content("Error: " + e.getMessage())
1500 .isError(true)
1501 .build();
14941502 }
14951503 }
14961504 toolResults.add(ContentBlockParam.ofToolResult(result));
from line 1542
15341542 NOT_EXECUTED = "Not executed: an earlier computer action in this turn failed."
15351543 
15361544 # Run the computer actions in Claude's response in order and build one
1537 # tool_result per tool_use block. After the first failure, skip the rest:
1545 # tool_result for each tool_use block. After the first failure, skip the rest:
15381546 # Claude planned them assuming the earlier actions succeeded.
15391547 def process_tool_calls(response)
15401548 tool_results = []
from line 1824
18161824 
18171825To keep [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) effective while bounding context:
18181826 
1819* Place one `cache_control` breakpoint after the system prompt and tool definitions, and up to three more on the last `tool_result` block of each of the most recent turns, advancing them each turn. Within a [batch action](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#batch-actions), markers on several blocks act as a single breakpoint but each still counts toward the limit of four, so use one for each turn.
1827* Place one `cache_control` breakpoint after the system prompt and tool definitions, and up to three more on the last `tool_result` block of each of the most recent turns, advancing them each turn. Within a [batch action](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool#batch-actions), markers on several blocks act as a single breakpoint, but each still counts toward the limit of four, so use at most one in any turn.
18201828* Prune old screenshots in *batches*, not one each turn. Dropping a screenshot every turn changes the prefix every turn and invalidates the cache. A reasonable default is to keep the last three screenshots and prune every 25 turns, so the prefix stays byte-identical between prune events; if your screenshots exceed 2000 px on either side, choose an interval that keeps each request at 20 or fewer images.
18211829* On Claude Fable 5.1, Claude Opus 5.5, Claude Sonnet 5.5, and Claude Haiku 5.5, avoid pruning on the client: removing an earlier screenshot [invalidates every later thinking block](https://platform.claude.com/docs/en/build-with-claude/thinking#preserved-in-conversation) in every request that still carries those turns. Resize screenshots to 2000 px or less per side instead, and use server-side [tool result clearing](https://platform.claude.com/docs/en/build-with-claude/context-editing#tool-result-clearing) to drop old ones from the context. If you must prune, keep [`prefix_mismatch_behavior: "drop_block"`](https://platform.claude.com/docs/en/build-with-claude/thinking#preserved-thinking-controls) set from then on; after each prune, Claude continues without the thinking produced since the pruned screenshot, on that request and every later one. On Claude Sonnet 5.5, `block_binding` works only with `thinking: {"type": "adaptive"}`. With `between_tools`, keep the history append-only, or strip the thinking blocks from the edited turn on. On Claude Haiku 5.5, `block_binding` works only with `thinking: {"type": "adaptive"}`; with `thinking: {"type": "disabled"}`, keep the history append-only, or strip the thinking blocks from the edited turn on.
18221830 
Feedback