Skip to content

feat(providers/anthropic): support the computer_toolset_20260801 computer use toolset - #80

Merged
ibetitsmike merged 1 commit into
coder_2_33from
mike/anthropic-computer-toolset
Oct 29, 2026
Merged

ibetitsmike merged 1 commit into
coder_2_33from
mike/anthropic-computer-toolset

Conversation

@ibetitsmike

Copy link
Copy Markdown

Xum (AI agent) opened this PR on behalf of Mike.

Problem

Claude 5.5 and later models on the Claude API accept computer use only through the generally available computer_toolset_20260801 toolset. Sending computer_20251124 fails with 'claude-opus-5-5' does not support tool types: computer_20251124.

Change

ComputerUseToolset20260801 is a new ComputerUseToolVersion. Callers keep the existing contract: a tool call named computer with a {"action": ..., ...} input. The provider maps that to and from the toolset wire format.

  • Tool entry: {"type":"computer_toolset_20260801"}, plus configs.zoom.enabled when EnableZoom is set and cache_control when set. No name or display fields, which the API rejects. No beta header and no beta=true query.
  • Responses (Generate and Stream): a tool_use block with "toolset_name": "computer" is reported as tool computer with input = member input plus "action": <member name>. Batches (several members in one response) come out as separate calls in order. In Stream, member deltas are not forwarded raw; the merged input is emitted once as a single delta at block close, so deltas, end, and the tool call agree. openToolBlock index-drift handling is unchanged.
  • Replay: when the call's tools declare the toolset, every client computer tool_use is replayed as {name: <action>, input: <input minus action>, toolset_name: "computer"}, and every matching tool_result gets toolset_name: "computer". A call with no string action is replayed as the screenshot member (it takes no input), so tool_use and tool_result stay paired, and a CallWarning is emitted. With computer_20251124, computer_20250124, or no computer tool, replay is byte-for-byte unchanged.
  • Version selection: ComputerUseToolVersionForModel(modelID) returns the version the Claude API accepts: Claude 4.8 and later (all 5.x) get the toolset; Opus 4.5 to 4.7 and Sonnet 4.6 get computer_20251124; Sonnet 4.5, Haiku 4.5, and older get computer_20250124. IDs without a parseable version (for example claude-mythos-preview) get the toolset. Bedrock does not offer the toolset, so this mapping is for the Claude API only.
  • ComputerUseInput gains Repeat for the toolset key member.

Tests

New computer_toolset_test.go covers the version table (real IDs, including Vertex @date, anthropic/ and us.anthropic. prefixes), the tool JSON and no beta flag, Generate mapping with no beta header or query, a Stream batch of two members next to a regular tool, and the exact replayed request JSON for the toolset, the missing-action fallback, and unchanged computer_20251124 replay. I mutated each behavior and confirmed the matching test fails.

go build ./..., go vet ./providers/anthropic/..., go test ./... -count=1, go test -race ./providers/anthropic/, gofumpt -l, and golangci-lint run ./providers/anthropic/... pass.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-29T15:04:33.656570Z e351064 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ibetitsmike
ibetitsmike merged commit a35507f into coder_2_33 Oct 29, 2026
7 checks passed
ibetitsmike added a commit to coder/coder that referenced this pull request Oct 29, 2026
Claude 5.5 models accept computer use only through the GA toolset
computer_toolset_20260801, so computer use subagents on those models
failed on their first request. Bump the coder/fantasy pin to
coder/fantasy#80 and pick the Anthropic tool version from the chat's
model.

For the toolset, follow its batch contract: actions answer with text,
the last computer call of a step attaches a screenshot, cursor_position
returns the position, key honors repeat, and zoom stays disabled. For
every Anthropic version, run a step's computer calls serially, skip the
rest of a step after a failed call, and read wait and hold_key
durations as seconds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant