Bedrock computer use tools availability
Via Anthropic, Amazon Bedrock provides three computer use tools available via `amazonBedrock.tools`: Bash Tool (run bash commands), Text Editor Tool (view and edit text files), and Computer Tool (control keyboard and mouse). Amazon Bedrock does not support strict mode on tool definitions; setting `strict: true` will be ignored with a warning.
Bedrock Bash tool parameters
Bash tool parameters: `command` (string, the bash command to run, required unless restarting), `restart` (boolean, optional, set true to restart the tool).
Bedrock Text Editor tool for Claude 4 models
For Claude 4 models, use `amazonBedrock.tools.textEditor_20250429()`. Parameters: `command` ('view' | 'create' | 'str_replace' | 'insert' | 'undo_edit'), `path` (string, file/directory path), `file_text` (string, optional, required for 'create'), `insert_line` (number, optional, required for 'insert'), `new_str` (string, optional, for 'str_replace'), `insert_text` (string, optional, required for 'insert'), `old_str` (string, optional, required for 'str_replace'), `view_range` (number[], optional, line range for 'view').
Bedrock Text Editor tool for Claude 3.5 Sonnet and earlier
For Claude 3.5 Sonnet and earlier models, use `amazonBedrock.tools.textEditor_20241022()`. Same parameters as Claude 4 version but supports `undo_edit` command (only for these earlier models).
Bedrock Text Editor tool naming requirement
When using the Text Editor Tool, the tool key in the tools object must match the model: use `str_replace_based_edit_tool` for Claude 4 models, and `str_replace_editor` for Claude 3.5 Sonnet and earlier models.
Bedrock Computer tool parameters
Computer tool parameters: `action` ('key' | 'type' | 'mouse_move' | 'left_click' | 'left_click_drag' | 'right_click' | 'middle_click' | 'double_click' | 'screenshot' | 'cursor_position'), `coordinate` (number[], optional, required for 'mouse_move' and 'left_click_drag' as [x, y]), `text` (string, optional, required for 'type' and 'key' actions).
Bedrock Anthropic computer use tools
Bedrock Anthropic provider supports three computer use tools via `bedrockAnthropic.tools`: Bash Tool (`bash_20241022`), Text Editor Tool (`textEditor_20241022`), Computer Tool (`computer_20241022`). Computer use tools require Claude 3.7 Sonnet or newer. Claude 3.5 Sonnet v2 does not support these tools.
Bedrock Anthropic Bash tool example
Use Bash tool: `import { bedrockAnthropic } from '@ai-sdk/amazon-bedrock/anthropic'; const result = await generateText({ model: bedrockAnthropic('us.anthropic.claude-sonnet-4-5-20250929-v1:0'), tools: { bash: bedrockAnthropic.tools.bash_20241022({ execute: async ({ command }) => [{ type: 'text', text: 'Executed: ' + command }] }) }, prompt: 'List the files in my directory.', stopWhen: isStepCount(2) });`
Bedrock Anthropic Text Editor tool example
Use Text Editor tool: `const result = await generateText({ model: bedrockAnthropic('us.anthropic.claude-sonnet-4-5-20250929-v1:0'), tools: { str_replace_editor: bedrockAnthropic.tools.textEditor_20241022({ execute: async ({ command, path, old_str, new_str, insert_text }) => 'File updated successfully' }) }, prompt: 'Update my README file.', stopWhen: isStepCount(5) });`
Bedrock Anthropic Computer tool example
Use Computer tool: `const result = await generateText({ model: bedrockAnthropic('us.anthropic.claude-sonnet-4-5-20250929-v1:0'), tools: { computer: bedrockAnthropic.tools.computer_20241022({ displayWidthPx: 1024, displayHeightPx: 768, execute: async ({ action, coordinate, text }) => action === 'screenshot' ? { type: 'image', data: fs.readFileSync('./screenshot.png').toString('base64') } : 'executed ' + action, toModelOutput({ output }) { return { type: 'content', value: typeof output === 'string' ? [{ type: 'text', text: output }] : [{ type: 'image-data', data: output.data, mediaType: 'image/png' }] } }) }, prompt: 'Take a screenshot.', stopWhen: isStepCount(3) });`