computer-use-tool changedagents-and-tools/tool-use/computer-use-tool
Nearest release: v2.1.304, published 6 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+18added
Lines−20removed
From line
510
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits26to this page, all time
The whole hunk
from line 510, old and new numbered
/
from line 510
510510 async function samplingLoop(
511511 model: string,
512512 messages: Anthropic.MessageParam[],
513 maxIterations = 10,
513 maxIterations = 10
514514 ): Promise<Anthropic.MessageParam[]> {
515515 // Run the computer-use agent loop until Claude stops requesting tools
516516 // or the iteration limit is reached.
from line 519
519519 model,
520520 max_tokens: 4096,
521521 messages,
522 tools,
522 tools
523523 });
524524
525525 // Add Claude's response to the conversation history
from line 615
615615 }
616616 return messages, nil
617617 }
618
619618 ```
620619
621620 ```java Java
from line 935
936935 return [
937936 {
938937 "type": "image",
939 "source": {"type": "base64", "media_type": "image/png", "data": PLACEHOLDER_PNG},
938 "source": {
939 "type": "base64",
940 "media_type": "image/png",
941 "data": PLACEHOLDER_PNG,
942 },
940943 }
941944 ]
942945
from line 970
967970
968971 ```typescript TypeScript
969972 // Placeholder image data; a real executor captures the screen as PNG bytes
970 const PLACEHOLDER_PNG = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";
973 const PLACEHOLDER_PNG =
974 "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";
971975
972976 function captureScreenshot(): Anthropic.ImageBlockParam[] {
973977 // screenshot answers with an image block rather than text
from line 981
977981 source: {
978982 type: "base64",
979983 media_type: "image/png",
980 data: PLACEHOLDER_PNG,
981 },
982 },
984 data: PLACEHOLDER_PNG
985 }
986 }
983987 ];
984988 }
985989
from line 1001
9971001
9981002 function handleComputerAction(
9991003 action: string,
1000 input: unknown,
1004 input: unknown
10011005 ): string | Anthropic.ImageBlockParam[] {
1002 const params: object =
1003 typeof input === "object" && input !== null ? input : {};
1006 const params: object = typeof input === "object" && input !== null ? input : {};
10041007 switch (action) {
10051008 case "screenshot":
10061009 return captureScreenshot();
from line 1128
11251128 // Reached when a member's input is missing a field or a field has the wrong type
11261129 return nil, fmt.Errorf("invalid input for %s", action)
11271130 }
1128
11291131 ```
11301132
11311133 ```java Java
from line 1308
13061308 ```
13071309
13081310 ```typescript TypeScript
1309 const HALT_TEXT =
1310 "Not executed: an earlier computer action in this turn failed.";
1311 const HALT_TEXT = "Not executed: an earlier computer action in this turn failed.";
13111312
13121313 function computerResult(
13131314 toolUseId: string,
13141315 content: string | Anthropic.ImageBlockParam[],
1315 isError?: boolean,
1316 isError?: boolean
13161317 ): Anthropic.ToolResultBlockParam {
13171318 return {
13181319 type: "tool_result",
from line 1320
13191320 tool_use_id: toolUseId,
13201321 toolset_name: "computer",
13211322 content,
1322 is_error: isError,
1323 is_error: isError
13231324 };
13241325 }
13251326
1326 function processToolCalls(
1327 response: Anthropic.Message,
1328 ): Anthropic.ToolResultBlockParam[] {
1327 function processToolCalls(response: Anthropic.Message): Anthropic.ToolResultBlockParam[] {
13291328 const toolResults: Anthropic.ToolResultBlockParam[] = [];
13301329 let failed = false;
13311330 for (const block of response.content) {
from line 1465
14661465 }
14671466 return toolResults
14681467 }
1469
14701468 ```
14711469
14721470 ```java Java
No line in this hunk matches that.