Find a file
Hannes Rudolph ca7e3b6161
feat: migrate Bedrock provider to AI SDK (#11243)
* feat: migrate Bedrock provider to AI SDK

Replace the raw AWS SDK (@aws-sdk/client-bedrock-runtime) Bedrock handler
with the Vercel AI SDK (@ai-sdk/amazon-bedrock). Reduces provider from
1,633 lines to 575 lines (65% reduction).

Key changes:
- Use streamText()/generateText() instead of ConverseStreamCommand/ConverseCommand
- Use createAmazonBedrock() with native auth (access key, secret, session,
  profile via credentialProvider, API key, VPC endpoint as baseURL)
- Reasoning config via providerOptions.bedrock.reasoningConfig
- Anthropic beta headers via providerOptions.bedrock.anthropicBeta
- Thinking signature captured from providerMetadata.bedrock.signature
  on reasoning-delta stream events
- Thinking signature round-tripped via providerOptions.bedrock.signature
  on reasoning parts in convertToAiSdkMessages()
- Redacted thinking captured from providerMetadata.bedrock.redactedData
- isAiSdkProvider() returns true for reasoning block preservation
- Keep: getModel, ARN parsing, cross-region inference, cost calculation,
  service tier pricing, 1M context beta

Tests: 83 tests skipped (mock old AWS SDK internals, need rewrite for
AI SDK mocking). 106 tests pass. 0 tests fail.

* fix: address review feedback for Bedrock AI SDK migration

- Wire usePromptCache into AI SDK via providerOptions.bedrock.cachePoint
  on system prompt and last two user messages
- Remove debug logger.info that fires on every stream event with
  providerMetadata
- Tighten isThrottlingError to match 'rate limit' instead of broad
  'rate'/'limit' substrings that false-positive on context length errors
- Use shared handleAiSdkError utility for consistent error handling
  with status code preservation for retry logic

* fix: bedrock AI SDK migration - fix usage metrics, rewrite tests, remove dead code

- Fix reasoningTokens always 0 (usage.details?.reasoningTokens → usage.reasoningTokens)
- Fix cacheReadInputTokens always 0 (read from usage.inputTokenDetails instead of providerMetadata)
- Fix invokedModelId not extracted for prompt router cost calculation
- Rewrite all 6 skipped bedrock test suites for AI SDK mocking pattern (140 tests pass)
- Remove dead code: bedrock-converse-format.ts, cache-strategy/ (6 files, ~2700 lines)

* chore: remove dead @anthropic-ai/bedrock-sdk dep and stale AWS SDK mocks

* chore: update pnpm-lock.yaml after removing @anthropic-ai/bedrock-sdk

* fix: compute cache point indices from original Anthropic messages before AI SDK conversion

The previous approach naively targeted the last 2 user messages in the
post-conversion AI SDK array, but convertToAiSdkMessages() splits user
messages containing tool_results into separate tool + user messages,
causing cache points to land on the wrong messages (tiny text fragments
instead of the intended meaty user turns).

Now we identify the last 2 user messages in the original Anthropic
message array (matching the Anthropic provider's caching strategy) and
build a parallel-walk mapping to apply cachePoint to the correct
corresponding AI SDK message.

* perf: optimize prompt caching with 3-point message strategy + anchor for 20-block window

Previous approach only cached the last 2 user messages (using 2 of 4
available cache checkpoints for messages). This left significant cache
savings on the table for longer conversations.

New strategy uses up to 3 message cache points (+ 1 system = 4 total):
- Last user message: write to cache for next request
- Second-to-last user message: read from cache for current request
- Anchor message at ~1/3 position: ensures the 20-block lookback window
  from the second-to-last breakpoint hits a stable cache entry, covering
  all assistant/tool messages in the middle of the conversation

Also extracted the parallel-walk mapping logic into a reusable
applyCachePointsToAiSdkMessages() helper method.

Industry benchmarks show 70-95% token cache rates are achievable;
this change should significantly improve our 39% baseline for longer
multi-turn conversations.

* chore: remove stale bedrock-sdk external, fix arnInfo property name, remove unused exports

---------

Co-authored-by: daniel-lxs <ricciodaniel98@gmail.com>
2026-02-06 18:39:17 -05:00
.changeset Changeset version bump (#11258) 2026-02-06 11:39:26 -05:00
.github Drop MacOS-13 cli support (#11169) 2026-02-02 22:33:56 -08:00
.husky fix: prevent shell injection in pre-push hook environment loading (#9059) 2025-11-06 16:40:03 -05:00
.roo Roo Code CLI v0.0.50 (#11204) 2026-02-04 18:14:15 -08:00
.vscode Rate limit when starting a subtask (#4453) 2025-06-18 12:45:36 -04:00
apps feat: migrate Bedrock provider to AI SDK (#11243) 2026-02-06 18:39:17 -05:00
locales Update and improve zh-TW Traditional Chinese locale and docs (#10953) 2026-01-25 07:07:23 -05:00
packages feat: remove Enable URL context and Enable Grounding with Google search checkboxes (#11253) 2026-02-06 09:43:54 -05:00
releases Release v3.47.0 (#11227) 2026-02-05 12:50:52 -08:00
scripts feat: add pnpm serve command for code-server development (#10964) 2026-01-30 10:02:43 -05:00
src feat: migrate Bedrock provider to AI SDK (#11243) 2026-02-06 18:39:17 -05:00
webview-ui feat: remove Enable URL context and Enable Grounding with Google search checkboxes (#11253) 2026-02-06 09:43:54 -05:00
.dockerignore Add an option to use our cli for evals (#10456) 2026-01-05 11:33:19 -08:00
.env.sample Expose thinking tokens for roo/sonic (#7212) 2025-08-19 07:01:01 -07:00
.git-blame-ignore-revs Moved repo to new org (#3756) 2025-05-20 16:42:18 -04:00
.gitattributes feat: mark non-English package.nls.*.json files as linguist-generated (#7271) 2025-08-21 02:56:55 -07:00
.gitconfig Set up ignoring revisions for git blame 2025-01-17 11:21:25 -08:00
.gitignore feat: add support for AGENTS.local.md personal override files (#11183) 2026-02-04 12:53:13 -08:00
.nvmrc Upgrade Node.js to v20.19.2 for security enhancements (#4212) 2025-06-01 17:02:44 -04:00
.prettierrc.json Fix Posthog by correctly copying .env in the build process (#4049) 2025-05-27 11:19:21 -07:00
.rooignore Add telemetry and privacy policy 2025-03-07 03:03:44 -05:00
.roomodes refactor(docs-extractor): simplify mode to focus on raw fact extraction (#11129) 2026-02-04 17:14:31 -08:00
.tool-versions chore(deps): update node.js to v20.19.2 (#4159) 2025-05-30 22:48:46 -04:00
AGENTS.md fix: resolve race condition in context condensing prompt input (#10876) 2026-01-21 15:11:39 -07:00
CHANGELOG.md Changeset version bump (#11258) 2026-02-06 11:39:26 -05:00
CODE_OF_CONDUCT.md Fix inconsistencies in markdown file i18n (#4681) 2025-06-13 23:05:25 -04:00
CONTRIBUTING.md CONTRIBUTING.md tweaks and issue template rewrite (#8014) 2025-09-16 00:29:45 -04:00
ellipsis.yaml Revert "Turn off ellipsis quiet mode" 2025-03-07 02:26:25 -05:00
knip.json Browser Use 2.0 (#8941) 2025-11-21 17:26:15 -05:00
LICENSE Update LICENSE (#2275) 2025-04-03 23:54:26 -04:00
package.json feat: add pnpm serve command for code-server development (#10964) 2026-01-30 10:02:43 -05:00
pnpm-lock.yaml feat: migrate Bedrock provider to AI SDK (#11243) 2026-02-06 18:39:17 -05:00
pnpm-workspace.yaml Remove the "test" custom tools (#10255) 2025-12-21 14:19:25 -08:00
PRIVACY.md Make Posthog telemetry the default (#7909) 2025-09-11 15:50:40 -04:00
README.md docs: Replace Todo Lists video with Context Management video (#10375) 2025-12-29 20:34:06 -08:00
renovate.json Ignore @vscode/vsce in renovate (#4170) 2025-05-31 00:22:14 -04:00
SECURITY.md Create SECURITY.md 2025-06-05 10:22:15 -04:00
tsconfig.json Task metadata (#7092) 2025-08-14 03:14:17 -07:00
turbo.json Improve turbo task dependency declarations (#4323) 2025-06-04 09:32:27 -07:00

VS Code Marketplace X YouTube Join Discord Join r/RooCode

Get help fast → Join Discord • Prefer async? → Join r/RooCode

Roo Code

Your AI-Powered Dev Team, Right in Your Editor

🌐 Available languages

What Can Roo Code Do For YOU?

  • Generate Code from natural language descriptions and specs
  • Adapt with Modes: Code, Architect, Ask, Debug, and Custom Modes
  • Refactor & Debug existing code
  • Write & Update documentation
  • Answer Questions about your codebase
  • Automate repetitive tasks
  • Utilize MCP Servers

Modes

Roo Code adapts to how you work:

  • Code Mode: everyday coding, edits, and file ops
  • Architect Mode: plan systems, specs, and migrations
  • Ask Mode: fast answers, explanations, and docs
  • Debug Mode: trace issues, add logs, isolate root causes
  • Custom Modes: build specialized modes for your team or workflow
  • Roomote Control: Roomote Control lets you remotely control tasks running in your local VS Code instance.

Learn more: Using ModesCustom ModesRoomote Control

Tutorial & Feature Videos


Installing Roo Code

Configuring Profiles

Codebase Indexing

Custom Modes

Checkpoints

Context Management

More quick tutorial and feature videos...

Resources


Local Setup & Development

  1. Clone the repo:
git clone https://github.com/RooCodeInc/Roo-Code.git
  1. Install dependencies:
pnpm install
  1. Run the extension:

There are several ways to run the Roo Code extension:

Development Mode (F5)

For active development, use VSCode's built-in debugging:

Press F5 (or go to RunStart Debugging) in VSCode. This will open a new VSCode window with the Roo Code extension running.

  • Changes to the webview will appear immediately.
  • Changes to the core extension will also hot reload automatically.

Automated VSIX Installation

To build and install the extension as a VSIX package directly into VSCode:

pnpm install:vsix [-y] [--editor=<command>]

This command will:

  • Ask which editor command to use (code/cursor/code-insiders) - defaults to 'code'
  • Uninstall any existing version of the extension.
  • Build the latest VSIX package.
  • Install the newly built VSIX.
  • Prompt you to restart VS Code for changes to take effect.

Options:

  • -y: Skip all confirmation prompts and use defaults
  • --editor=<command>: Specify the editor command (e.g., --editor=cursor or --editor=code-insiders)

Manual VSIX Installation

If you prefer to install the VSIX package manually:

  1. First, build the VSIX package:
    pnpm vsix
    
  2. A .vsix file will be generated in the bin/ directory (e.g., bin/roo-cline-<version>.vsix).
  3. Install it manually using the VSCode CLI:
    code --install-extension bin/roo-cline-<version>.vsix
    

We use changesets for versioning and publishing. Check our CHANGELOG.md for release notes.


Disclaimer

Please note that Roo Code, Inc does not make any representations or warranties regarding any code, models, or other tools provided or made available in connection with Roo Code, any associated third-party tools, or any resulting outputs. You assume all risks associated with the use of any such tools or outputs; such tools are provided on an "AS IS" and "AS AVAILABLE" basis. Such risks may include, without limitation, intellectual property infringement, cyber vulnerabilities or attacks, bias, inaccuracies, errors, defects, viruses, downtime, property loss or damage, and/or personal injury. You are solely responsible for your use of any such tools or outputs (including, without limitation, the legality, appropriateness, and results thereof).


Contributing

We love community contributions! Get started by reading our CONTRIBUTING.md.


License

Apache 2.0 © 2025 Roo Code, Inc.


Enjoy Roo Code! Whether you keep it on a short leash or let it roam autonomously, we cant wait to see what you build. If you have questions or feature ideas, drop by our Reddit community or Discord. Happy coding!