Skip to content
Source
Sign inSign up
TanStack/ai

feat(ai-bedrock): add Amazon Bedrock adapter (Converse default + OpenAI-compatible chat/responses) #665

MergedAlemTuzlakmerged 55 commits intomain fromrefs/pull/665/headmerged by AlemTuzlak View on GitHub

AlemTuzlakcommented

🎯 Summary

Adds the first-party @tanstack/ai-bedrock package: an Amazon Bedrock adapter whose default path uses Bedrock's Converse API (@aws-sdk/client-bedrock-runtime), with Bedrock's OpenAI-compatible Chat Completions and Responses APIs available as opt-in modes.

import { bedrockText } from '@tanstack/ai-bedrock'
import { chat } from '@tanstack/ai'

// Converse (DEFAULT) — model-agnostic; reaches Claude, Nova, Llama, Mistral, …
const adapter = bedrockText('us.anthropic.claude-haiku-4-5-20251001-v1:0', { region: 'us-east-1' })

// OpenAI-compatible Chat Completions (open-weight models, e.g. gpt-oss)
const chatCompletions = bedrockText('openai.gpt-oss-120b-1:0', { region: 'us-east-1', api: 'chat' })

// OpenAI-compatible Responses (gpt-oss, stateful)
const responses = bedrockText('openai.gpt-oss-120b-1:0', { region: 'us-east-1', api: 'responses' })

Why Converse is the default

Per AWS's API-compatibility matrix, the OpenAI-compatible Chat Completions / Responses endpoints reach open-weight models only — Anthropic Claude, Amazon Nova, and Meta Llama are not exposed via those endpoints (they are Converse / Invoke only). Converse is a strict superset for text/chat models: 0 models are ChatCompletions-only, 41 are Converse-only. To "support the most models," Converse must be the default.

bedrockText / createBedrockText branch on api: 'converse' | 'chat' | 'responses' (default 'converse'). The Converse adapter extends BaseTextAdapter directly and implements its own translation layer (messages, tools, streaming, structured output); the Chat Completions and Responses adapters are unchanged, built on @tanstack/openai-base.

✨ What's included

  • BedrockConverseTextAdapter (default) — streaming, client-side tool calling, structured output (forced single-tool), reasoning-output deltas, and the agent loop, mapping TanStack types ⇄ the Converse wire format.
  • Three per-API type-safe catalogs (BEDROCK_CONVERSE_MODELS / BEDROCK_CHAT_MODELS / BEDROCK_RESPONSES_MODELS) derived from a generated catalog with per-API support flags + a compile-time Extract filter that preserves literal model-id unions.
  • Unified auth — apiKey → BEDROCK_API_KEY → AWS_BEARER_TOKEN_BEDROCK → SigV4 via the AWS credential chain. SigV4 is handled natively by @aws-sdk for the Converse path and by @aws-sdk's SignatureV4 signer for the OpenAI-compatible paths. The previous aws-sigv4-fetch optional peer is removed.
  • Maintainer refresh script — scripts/fetch-bedrock-models.ts (ListFoundationModels + a curated API-compatibility seed) regenerates src/model-catalog.generated.ts.
  • 66 unit tests across the converters, stream processor, structured output, adapter, factory, auth, and catalogs. pnpm test:pr green (sherif, knip, docs, eslint, lib, types, build).

⚠️ Maintainer notes (please read)

  • The committed model catalog is a verified 14-model seed, not the full Converse catalog. Model IDs were not fabricated — there were no AWS credentials in the implementation environment to run ListFoundationModels. The architecture reaches every Converse model; run scripts/fetch-bedrock-models.ts with AWS credentials to expand the catalog to the full set with confirmed IDs/modalities. Per-account/region availability depends on your model access.
  • Converse E2E is deferred — @copilotkit/aimock cannot mock the AWS binary event-stream (vnd.amazon.eventstream) Converse protocol, so bedrock-converse is not in the Playwright matrix. The translation layer is covered by unit tests; the OpenAI-compatible bedrock / bedrock-responses entries remain in the E2E matrix. Tracked in #669.
  • Reasoning request-side enable is deferred (per-model additionalModelRequestFields differ); reasoning output deltas already surface.
  • This PR also fixes a docs/config.json regression where a stale rewrite had dropped the React Native quickstart, the Structured Outputs nav section, and the Typed Options guide — the nav diff vs main is now purely additive.

🚀 Release Impact

  • New published package @tanstack/ai-bedrock (changeset: minor).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added Amazon Bedrock adapter package with three selectable API modes (Converse default, Chat Completions, Responses), plus adapters for bedrock, bedrock-responses, and bedrock-converse supporting streaming, tools, structured output, and reasoning.
    • Added Bedrock multimodal message metadata types.
  • Authentication

    • Documented flexible auth resolution (explicit key, BEDROCK_API_KEY, legacy token, or AWS SigV4).
  • Documentation

    • Updated Bedrock adapter docs, provider/reference links, and added package-level README and getting-started navigation.
  • Tests / E2E

    • Expanded unit tests and included Bedrock variants in the E2E provider matrix.
  • Chores

    • Added generated model catalog and generator, plus tooling/config updates.
    1. Review Change Stack

      Note

      Reviews paused

      It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

      Use the following commands to manage reviews:

      • @coderabbitai resume to resume automatic reviews.
      • @coderabbitai review to trigger a single review.

      Use the checkboxes below for quick actions:

      • ▶️ Resume reviews
      • 🔍 Trigger review
      📝 Walkthrough

      Walkthrough

      Adds a new @tanstack/ai-bedrock package with Converse, Chat Completions, and Responses adapters, generated model metadata, SigV4 authentication support, documentation updates, and E2E provider wiring.

      Changes

      Bedrock Adapter Implementation

      Layer / File(s)Summary
      Package structure and tooling
      packages/ai-bedrock/package.json, packages/ai-bedrock/tsconfig.json, packages/ai-bedrock/vite.config.ts, packages/ai-bedrock/README.md, package.json, knip.json
      New workspace package, TypeScript/Vitest config, root dependency updates, and package README are added.
      Model catalog and capability types
      scripts/bedrock-api-compatibility.json, scripts/fetch-bedrock-models.ts, packages/ai-bedrock/src/model-catalog.generated.ts, packages/ai-bedrock/src/model-meta.ts, packages/ai-bedrock/src/message-types.ts, packages/ai-bedrock/src/text/*, packages/ai-bedrock/tests/model-meta.test.ts
      Generated Bedrock model data, compatibility rules, provider option types, message metadata types, and model catalog tests are added.
      Auth resolution and Bedrock client defaults
      packages/ai-bedrock/src/utils/auth.ts, packages/ai-bedrock/src/utils/openai-sigv4-fetch.ts, packages/ai-bedrock/src/utils/client.ts, packages/ai-bedrock/src/utils/index.ts, packages/ai-bedrock/tests/auth.test.ts, packages/ai-bedrock/tests/client.test.ts, packages/ai-bedrock/tests/openai-sigv4-fetch.test.ts
      Bedrock auth selection, SigV4 signing fetch, OpenAI client defaults, and corresponding tests are added.
      Factory entry point and API branching
      packages/ai-bedrock/src/index.ts, packages/ai-bedrock/tests/factory.test.ts, packages/ai-bedrock/tests/adapter.test.ts
      The package entrypoint adds discriminated config types and routes between Converse, Chat, and Responses adapters, with factory tests.
      Chat Completions and Responses adapters
      packages/ai-bedrock/src/adapters/text.ts, packages/ai-bedrock/src/adapters/responses-text.ts, packages/ai-bedrock/tests/adapter.test.ts
      Bedrock OpenAI-compatible adapters are implemented with Bedrock defaults and reasoning extraction.
      Converse adapter and stream processing
      packages/ai-bedrock/src/adapters/converse-text.ts, packages/ai-bedrock/src/converse/*, packages/ai-bedrock/tests/converse/*
      Converse message translation, streaming lifecycle mapping, structured output, tool conversion, and Converse adapter tests are added.
      Documentation, skills, and reference links
      docs/adapters/bedrock.md, docs/config.json, docs/getting-started/overview.md, .claude/*, packages/ai/skills/ai-core/adapter-configuration/SKILL.md, testing/e2e/README.md
      User docs, navigation, gap-analysis references, adapter configuration guidance, and coverage-gap notes are updated for Bedrock.
      E2E provider wiring and support matrix
      testing/e2e/package.json, testing/e2e/src/lib/types.ts, testing/e2e/src/lib/providers.ts, testing/e2e/src/lib/feature-support.ts, testing/e2e/tests/test-matrix.ts
      Bedrock providers are added to E2E types, provider factories, feature support, and execution ordering.

      Estimated code review effort: 🎯 4 (Complex) | ⏱️ ~60 minutes

      • TanStack/ai#571 — Related Bedrock provider documentation and gap-analysis updates.
      • TanStack/ai#577 — Related structured-output event flow used by the Converse structured-output path.
      • TanStack/ai#609 — Related structured-output/tool capability handling referenced by the adapter implementation.
      • TanStack/ai#666 — Related message conversion and tool-result semantics used by Converse message translation.

      Poem

      A bunny hopped through Bedrock land, With streams and tools close at hand. SigV4 sparkled, models shone bright, Converse and chat danced through the night. 🐰✨

      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 45.95% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly summarizes the new Amazon Bedrock adapter and its Converse default plus chat/responses modes.
      Description check✅ PassedThe description covers the change, motivation, and release impact, but it does not follow the repository template exactly.
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      ✏️ Tip: You can configure your own custom pre-merge checks in the settings.
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `feat/ai-bedrock-adapter`

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. 🚀 Changeset Version Preview

      2 package(s) bumped directly, 0 bumped as dependents.

      🟨 Minor bumps

      PackageVersionReason
      @tanstack/ai-bedrock0.0.1 → 0.1.0Changeset
      @tanstack/ai-mistral0.1.0 → 0.2.0Changeset
    3. View your CI Pipeline Execution ↗ for commit 2074006435777a224ccb0dd1fa300ac1429dab65

      CommandStatusDurationResult
      nx run-many --targets=build --exclude=examples/...✅ Succeeded1m 41sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-06-30 11:15:44 UTC

    4. Open in StackBlitz

      @tanstack/ai

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai@665

      @tanstack/ai-angular

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-angular@665

      @tanstack/ai-anthropic

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-anthropic@665

      @tanstack/ai-bedrock

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-bedrock@665

      @tanstack/ai-client

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-client@665

      @tanstack/ai-code-mode

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode@665

      @tanstack/ai-code-mode-skills

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode-skills@665

      @tanstack/ai-devtools-core

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-devtools-core@665

      @tanstack/ai-elevenlabs

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-elevenlabs@665

      @tanstack/ai-event-client

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-event-client@665

      @tanstack/ai-fal

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-fal@665

      @tanstack/ai-gemini

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-gemini@665

      @tanstack/ai-grok

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok@665

      @tanstack/ai-groq

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-groq@665

      @tanstack/ai-isolate-cloudflare

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-cloudflare@665

      @tanstack/ai-isolate-node

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-node@665

      @tanstack/ai-isolate-quickjs

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs@665

      @tanstack/ai-mcp

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mcp@665

      @tanstack/ai-mistral

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mistral@665

      @tanstack/ai-ollama

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollama@665

      @tanstack/ai-openai

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openai@665

      @tanstack/ai-openrouter

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openrouter@665

      @tanstack/ai-preact

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-preact@665

      @tanstack/ai-react

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react@665

      @tanstack/ai-react-ui

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react-ui@665

      @tanstack/ai-solid

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid@665

      @tanstack/ai-solid-ui

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid-ui@665

      @tanstack/ai-svelte

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-svelte@665

      @tanstack/ai-utils

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-utils@665

      @tanstack/ai-vue

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue@665

      @tanstack/ai-vue-ui

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue-ui@665

      @tanstack/openai-base

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/openai-base@665

      @tanstack/preact-ai-devtools

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/preact-ai-devtools@665

      @tanstack/react-ai-devtools

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/react-ai-devtools@665

      @tanstack/solid-ai-devtools

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/solid-ai-devtools@665

      commit: 2074006

    5. Actionable comments posted: 8

      🧹 Nitpick comments (4)
      packages/ai-bedrock/vite.config.ts (1)

      12-12: ⚡ Quick win

      Broaden test include glob to support colocated *.test.ts files.

      Line 12 only includes tests/**/*.test.ts, which can skip colocated tests under src/**. Consider including both patterns so discovery matches the repository guideline.

      Proposed diff
      -    include: ['tests/**/*.test.ts'],
      +    include: ['tests/**/*.test.ts', 'src/**/*.test.ts'],

      As per coding guidelines: "**/*.test.ts: Place unit tests in *.test.ts files alongside source files".

      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@packages/ai-bedrock/vite.config.ts` at line 12, The current vite.config.ts
      includes only 'tests/**/*.test.ts' which misses colocated tests; update the
      include array in the Vite config (the include setting in vite.config.ts) to
      include both 'tests/**/*.test.ts' and '**/*.test.ts' so test discovery matches
      the repo guideline (keep the existing pattern and add the '**/*.test.ts' glob to
      the include array).
      packages/ai-bedrock/src/model-meta.ts (1)

      223-226: ⚡ Quick win

      Add a compile-time parity guard for BEDROCK_RESPONSES_MODELS too.

      You already protect chat catalog drift; responses catalog can still silently diverge from model metadata. Add a matching _AssertTrue check derived from CHAT_MODELS filtered by supports.endpoints.

      Also applies to: 235-248

      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@packages/ai-bedrock/src/model-meta.ts` around lines 223 - 226, Add a
      compile-time parity guard to ensure BEDROCK_RESPONSES_MODELS stays in sync with
      model metadata: create a type-level assertion (using the existing _AssertTrue
      pattern) that compares BEDROCK_RESPONSES_MODELS to the tuple derived from
      CHAT_MODELS filtered by model.supports.endpoints including "responses" (i.e.,
      the same technique used for the chat catalog parity check). Reference the
      symbols BEDROCK_RESPONSES_MODELS, CHAT_MODELS, supports.endpoints and the
      existing _AssertTrue helper so the compiler will fail if the two sets diverge.
      testing/e2e/src/lib/feature-support.ts (1)

      11-197: ⚡ Quick win

      Add Bedrock to reasoning as well, or call out why it is intentionally excluded.

      The PR objectives say the adapter supports reasoning extraction, but this matrix still leaves Line 33 unchanged. That means the new provider ships without E2E coverage for one of its advertised capabilities.

      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@testing/e2e/src/lib/feature-support.ts` around lines 11 - 197, The reasoning
      feature matrix (the Set assigned to the "reasoning" key) omits 'bedrock' while
      the PR claims the adapter supports reasoning; update the "reasoning" Set to
      include 'bedrock' (i.e., add 'bedrock' to the new Set for the reasoning entry)
      or, if omission is intentional, add a comment next to the reasoning = new
      Set([...]) explaining why Bedrock is excluded and link to the tracking issue;
      target the "reasoning" symbol in feature-support.ts for this change.
      testing/e2e/src/lib/providers.ts (1)

      10-10: ⚡ Quick win

      ai-bedrock doesn’t expose a /adapters subpath—keep the root import @tanstack/ai-bedrock package exports only . and ./sigv4 (no ./adapters entrypoint), so importing createBedrockText from @tanstack/ai-bedrock in testing/e2e/src/lib/providers.ts is the only supported option; the /adapters-surface guideline can’t be applied to this provider yet. Optional: add an ./adapters export in ai-bedrock if you want E2E to follow the guideline uniformly.

      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@testing/e2e/src/lib/providers.ts` at line 10, The import should use the
      package root instead of a non-existent adapters subpath: change any import
      referencing '`@tanstack/ai-bedrock/adapters`' back to the package root and import
      createBedrockText from '`@tanstack/ai-bedrock`' (locate usages in
      testing/e2e/src/lib/providers.ts and the createBedrockText symbol) so the code
      relies on the package's supported entrypoints; if you need adapters-style
      exports later, add an './adapters' export in the ai-bedrock package separately.
      🤖 Prompt for all review comments with AI agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      Inline comments:
      In `@docs/config.json`:
      - Around line 95-97: Replace the user-facing navigation label value "Structured
      Outputs (Moved)" with a stable label "Structured Outputs" in the nav entry that
      points to "chat/structured-outputs" (update the JSON object's "label" key where
      it currently equals "Structured Outputs (Moved)"). Ensure only the label string
      changes and the "to" value "chat/structured-outputs" remains unchanged.
      
      In `@packages/ai-bedrock/package.json`:
      - Around line 55-57: In package.json update the peerDependencies entry for the
      internal package by changing the `@tanstack/ai` version specifier from
      "workspace:^" to "workspace:*" so it follows the repo convention; locate the
      peerDependencies block and modify the `@tanstack/ai` value accordingly.
      
      In `@packages/ai-bedrock/src/adapters/responses-text.ts`:
      - Around line 66-73: The factory createBedrockResponsesText currently spreads
      config before apiKey which allows config.apiKey to override the explicit apiKey
      parameter; change the merge order so the explicit apiKey is authoritative (e.g.,
      construct the adapter options by spreading config first and then setting apiKey
      or otherwise assign apiKey after spreading) when instantiating
      BedrockResponsesTextAdapter to ensure the apiKey argument cannot be overridden
      by config.apiKey.
      
      In `@packages/ai-bedrock/src/adapters/text.ts`:
      - Around line 92-97: The createBedrockChat function currently constructs the
      adapter options as { apiKey, ...config } which allows a config.apiKey to
      override the explicit apiKey parameter; change the object spread order so the
      explicit apiKey takes precedence (build options from config first and then set
      apiKey last) when instantiating BedrockTextAdapter in createBedrockChat to
      ensure the apiKey parameter remains authoritative.
      
      In `@packages/ai-bedrock/src/index.ts`:
      - Around line 93-97: The bedrockText function currently forces env-key auth by
      calling getBedrockApiKeyFromEnv() before building the adapter, which
      short-circuits other auth modes; change bedrockText (the exported function) to
      stop invoking getBedrockApiKeyFromEnv() and instead pass the raw config through
      to build so withBedrockDefaults()/resolveBedrockAuth() can apply the fallback
      chain and lazily resolve auth (i.e., remove the env-key call and let
      build(model, config) or build(model, undefined, config) — whichever matches
      build's signature — handle auth resolution).
      
      In `@packages/ai-bedrock/src/sigv4/index.ts`:
      - Around line 53-60: The lazy import block around import('aws-sigv4-fetch')
      currently swallows all errors and always throws the "install aws-sigv4-fetch"
      message; change it to distinguish a module-not-found (or cannot-resolve) error
      from other evaluation/runtime errors by checking the thrown error (e.g.,
      error.code === 'ERR_MODULE_NOT_FOUND' or message includes "Cannot find module" /
      "Cannot resolve") and only then throw the friendly install instruction,
      otherwise rethrow or include the original error details in the thrown Error so
      createSignedFetcher assignment failure surfaces real evaluation errors; update
      the import handling around the createSignedFetcher variable initialization
      accordingly.
      
      In `@packages/ai/skills/ai-core/adapter-configuration/SKILL.md`:
      - Around line 8-10: Update the top-level "API key env vars" summary line in
      SKILL.md to include the Bedrock secondary env var AWS_BEARER_TOKEN_BEDROCK in
      addition to BEDROCK_API_KEY so the list matches the later documentation; locate
      the "API key env vars:" line (the summary string) and add
      AWS_BEARER_TOKEN_BEDROCK to that comma-separated list.
      
      In `@scripts/fetch-bedrock-models.ts`:
      - Around line 27-31: ListInferenceProfilesCommand is paginated but the current
      fetch only gets the first page; change the profiles fetch to loop calling
      client.send(new ListInferenceProfilesCommand({ nextToken })) until
      response.nextToken is falsy, accumulating inferenceProfileSummaries into the
      profiles variable (or a new array) so all summaries/IDs are collected before
      further processing; leave ListFoundationModelsCommand as-is.
      
      ---
      
      Nitpick comments:
      In `@packages/ai-bedrock/src/model-meta.ts`:
      - Around line 223-226: Add a compile-time parity guard to ensure
      BEDROCK_RESPONSES_MODELS stays in sync with model metadata: create a type-level
      assertion (using the existing _AssertTrue pattern) that compares
      BEDROCK_RESPONSES_MODELS to the tuple derived from CHAT_MODELS filtered by
      model.supports.endpoints including "responses" (i.e., the same technique used
      for the chat catalog parity check). Reference the symbols
      BEDROCK_RESPONSES_MODELS, CHAT_MODELS, supports.endpoints and the existing
      _AssertTrue helper so the compiler will fail if the two sets diverge.
      
      In `@packages/ai-bedrock/vite.config.ts`:
      - Line 12: The current vite.config.ts includes only 'tests/**/*.test.ts' which
      misses colocated tests; update the include array in the Vite config (the include
      setting in vite.config.ts) to include both 'tests/**/*.test.ts' and
      '**/*.test.ts' so test discovery matches the repo guideline (keep the existing
      pattern and add the '**/*.test.ts' glob to the include array).
      
      In `@testing/e2e/src/lib/feature-support.ts`:
      - Around line 11-197: The reasoning feature matrix (the Set assigned to the
      "reasoning" key) omits 'bedrock' while the PR claims the adapter supports
      reasoning; update the "reasoning" Set to include 'bedrock' (i.e., add 'bedrock'
      to the new Set for the reasoning entry) or, if omission is intentional, add a
      comment next to the reasoning = new Set([...]) explaining why Bedrock is
      excluded and link to the tracking issue; target the "reasoning" symbol in
      feature-support.ts for this change.
      
      In `@testing/e2e/src/lib/providers.ts`:
      - Line 10: The import should use the package root instead of a non-existent
      adapters subpath: change any import referencing '`@tanstack/ai-bedrock/adapters`'
      back to the package root and import createBedrockText from
      '`@tanstack/ai-bedrock`' (locate usages in testing/e2e/src/lib/providers.ts and
      the createBedrockText symbol) so the code relies on the package's supported
      entrypoints; if you need adapters-style exports later, add an './adapters'
      export in the ai-bedrock package separately.
      🪄 Autofix (Beta)

      Fix all unresolved CodeRabbit comments on this PR:

      • Push a commit to this branch (recommended)
      • Create a new PR with the fixes

      ℹ️ Review info
      ⚙️ Run configuration

      Configuration used: defaults

      Review profile: CHILL

      Plan: Pro

      Run ID: 219780dc-6685-46f6-8b5e-450ec58cb149

      📥 Commits

      Reviewing files that changed from the base of the PR and between bdadc4b78027609accc6164e122e9145c370e128 and f8460d2fbef4f395531d9f88dbc4be02ec4efaff.

      ⛔ Files ignored due to path filters (1)
      • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
      📒 Files selected for processing (33)
      • .changeset/ai-bedrock-adapter.md
      • .claude/skills/gap-analysis/SKILL.md
      • .claude/skills/gap-analysis/references/provider-doc-urls.md
      • docs/adapters/bedrock.md
      • docs/config.json
      • docs/getting-started/overview.md
      • knip.json
      • packages/ai-bedrock/README.md
      • packages/ai-bedrock/package.json
      • packages/ai-bedrock/src/adapters/responses-text.ts
      • packages/ai-bedrock/src/adapters/text.ts
      • packages/ai-bedrock/src/index.ts
      • packages/ai-bedrock/src/message-types.ts
      • packages/ai-bedrock/src/model-meta.ts
      • packages/ai-bedrock/src/sigv4/aws-sigv4-fetch.d.ts
      • packages/ai-bedrock/src/sigv4/index.ts
      • packages/ai-bedrock/src/text/responses-provider-options.ts
      • packages/ai-bedrock/src/text/text-provider-options.ts
      • packages/ai-bedrock/src/utils/client.ts
      • packages/ai-bedrock/src/utils/index.ts
      • packages/ai-bedrock/tests/adapter.test.ts
      • packages/ai-bedrock/tests/client.test.ts
      • packages/ai-bedrock/tests/model-meta.test.ts
      • packages/ai-bedrock/tests/sigv4.test.ts
      • packages/ai-bedrock/tsconfig.json
      • packages/ai-bedrock/vite.config.ts
      • packages/ai/skills/ai-core/adapter-configuration/SKILL.md
      • scripts/fetch-bedrock-models.ts
      • testing/e2e/package.json
      • testing/e2e/src/lib/feature-support.ts
      • testing/e2e/src/lib/providers.ts
      • testing/e2e/src/lib/types.ts
      • testing/e2e/tests/test-matrix.ts
      OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
    6. Thanks @coderabbitai — addressed the review in 6ac6e40c (rebased onto the autofix commit):

      Fixed

      • bedrockText() short-circuiting non-API-key auth — removed the eager getBedrockApiKeyFromEnv() call; the env-key factory now passes config through and lets withBedrockDefaults/resolveBedrockAuth resolve auth lazily, so { auth: 'sigv4' } no longer throws. Added a regression test.
      • Authoritative apiKey — createBedrockChat / createBedrockResponsesText now spread { ...config, apiKey } so the explicit parameter wins over a stray config.apiKey.
      • SigV4 error passthrough — the aws-sigv4-fetch dynamic import now only remaps genuine module-not-found errors to the install hint and rethrows everything else.
      • adapter-configuration skill — added AWS_BEARER_TOKEN_BEDROCK to the env-var list.
      • refresh script — ListFoundationModels / ListInferenceProfiles now paginate via nextToken.

      Intentionally not changed

      • @tanstack/ai peer workspace:^ — kept to match every sibling adapter (ai-groq, ai-grok, ai-openrouter all use workspace:^ for the @tanstack/ai peer); test:sherif passes.
      • "Structured Outputs (Moved)" nav label — that (and other nav churn) came from sync-docs-config resyncing a config.json that was stale on main, unrelated to this adapter. I reverted docs/config.json to a surgical diff containing only the new Bedrock adapter entry, so this PR doesn't carry the unrelated nav changes.
    7. @AlemTuzlak Thanks for the thorough summary! All the addressed items look solid:

      • Lazy auth — passing config through to resolveBedrockAuth is the right approach; the regression test is a good guard.
      • Authoritative apiKey — { ...config, apiKey } spread order is clean and correct.
      • SigV4 error passthrough — scoping the remap to genuine module-not-found errors is the right precision.
      • workspace:^ peer — consistency with sibling adapters + sherif passing is a reasonable justification.
      • docs/config.json surgical revert — keeping unrelated nav churn out of this PR is the right call.

      Everything looks good to me. 🎉

      (ノ◕ヮ◕)ノ*:・゚✧ 🐇

      ✅ Actions performed

      Comments resolved. Approval is disabled; enable reviews.request_changes_workflow to allow explicit top-level @coderabbitai resolve or @coderabbitai approve commands.

    8. AlemTuzlak changed the title

    9. Actionable comments posted: 4

      Caution

      Some comments are outside the diff and can’t be posted inline due to platform limitations.

      ⚠️ Outside diff range comments (1)
      packages/ai-bedrock/src/index.ts (1)

      61-80: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

      Add the same runtime model guard on the api: 'chat' branch.

      The responses path rejects unsupported models locally, but the chat path only casts. JS callers can still route a converse-only model into api: 'chat' and won't get a clear error until the Bedrock call fails.

      Suggested fix
      -import { BEDROCK_RESPONSES_MODELS } from './model-meta'
      +import { BEDROCK_CHAT_MODELS, BEDROCK_RESPONSES_MODELS } from './model-meta'
      @@
       function isResponsesModel(model: string): model is BedrockResponsesModels {
         return BEDROCK_RESPONSES_MODELS.some((m) => m === model)
       }
      +
      +function isChatModel(model: string): model is BedrockChatModels {
      +  return BEDROCK_CHAT_MODELS.some((m) => m === model)
      +}
      @@
         if (config?.api === 'chat') {
      -    return new BedrockTextAdapter(stripApi(config), model as BedrockChatModels)
      +    if (!isChatModel(model)) {
      +      throw new Error(
      +        `Model "${model}" is not available on the Bedrock Chat Completions API. ` +
      +          `Chat-capable models: ${BEDROCK_CHAT_MODELS.join(', ')}.`,
      +      )
      +    }
      +    return new BedrockTextAdapter(stripApi(config), model)
         }
      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@packages/ai-bedrock/src/index.ts` around lines 61 - 80, The chat branch in
      build(...) currently just casts the model and can accept converse-only models at
      runtime; add the same runtime guard used for responses: call an
      isChatModel(model) check before constructing BedrockTextAdapter (use
      stripApi(config) as now) and throw a clear Error if the model is not
      chat-capable (include a message like `Model "${model}" is not available on the
      Bedrock Chat API. Chat-capable models: ${BEDROCK_CHAT_MODELS.join(', ')}.`).
      Reference symbols: function build, config?.api === 'chat' branch, isChatModel
      (create it if missing), BEDROCK_CHAT_MODELS, stripApi, and BedrockTextAdapter.
      🧹 Nitpick comments (4)
      packages/ai-bedrock/tests/client.test.ts (1)

      1-127: 🏗️ Heavy lift

      Move this unit test next to src/utils/client.ts.

      This package is still adding unit tests under packages/ai-bedrock/tests/, which conflicts with the repo’s colocated-test rule. If you keep this coverage, please move it alongside the source file and update the Vitest include glob accordingly.

      As per coding guidelines, **/*.test.ts: Place unit tests in *.test.ts files alongside source files.

      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@packages/ai-bedrock/tests/client.test.ts` around lines 1 - 127, Tests for
      withBedrockDefaults and resolveBedrockAuth belong colocated with their
      implementation: move the test file so it sits beside the source module that
      exports resolveBedrockAuth and withBedrockDefaults, update the test's import to
      use the local relative path to that module (instead of the current ../src/...
      import), and adjust the Vitest include glob/config to pick up colocated
      *.test.ts files (e.g., ensure the runner includes **/*.test.ts next to sources)
      so the tests run without violating the repo’s colocated-test rule.
      packages/ai-bedrock/tests/openai-sigv4-fetch.test.ts (1)

      1-34: ⚡ Quick win

      Move this test next to src/utils/openai-sigv4-fetch.ts.

      Keeping this under packages/ai-bedrock/tests/ breaks the repo’s test-colocation rule and makes the wrapper/test pair harder to maintain.

      As per coding guidelines, **/*.test.ts: Place unit tests in *.test.ts files alongside source files.

      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@packages/ai-bedrock/tests/openai-sigv4-fetch.test.ts` around lines 1 - 34,
      The test file should be colocated with its implementation: move the test from
      packages/ai-bedrock/tests/openai-sigv4-fetch.test.ts into the same directory as
      the implementation (next to src/utils/openai-sigv4-fetch.ts), update the import
      path for createSigV4Fetch if needed, and ensure any package-level test runner
      configs still discover the new location; keep the test filename as
      openai-sigv4-fetch.test.ts and verify imports (e.g., import { createSigV4Fetch }
      from './openai-sigv4-fetch') resolve correctly after the move.
      packages/ai-bedrock/tests/auth.test.ts (2)

      1-42: ⚡ Quick win

      Move this test next to src/utils/auth.ts.

      This adds a second test layout under packages/ai-bedrock/tests/ instead of colocating the unit test with the implementation it covers.

      As per coding guidelines, **/*.test.ts: Place unit tests in *.test.ts files alongside source files.

      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@packages/ai-bedrock/tests/auth.test.ts` around lines 1 - 42, The test file is
      located in packages/ai-bedrock/tests/ instead of colocating it with the
      implementation; move the test next to src/utils/auth.ts and update its import
      path accordingly: relocate the file to the same folder as auth.ts (e.g.,
      src/utils/auth.test.ts), ensure the test imports resolveBedrockAuth via the
      correct relative path (import { resolveBedrockAuth } from './auth'), and remove
      the duplicate test under tests/ so there is a single unit test file adjacent to
      the implementation.

      13-41: ⚡ Quick win

      Add coverage for the documented AWS_BEARER_TOKEN_BEDROCK fallback.

      The suite never exercises the second env-var lookup, so that branch in readApiKeyFromEnv() can regress unnoticed. A case with only AWS_BEARER_TOKEN_BEDROCK set would close that gap.

      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@packages/ai-bedrock/tests/auth.test.ts` around lines 13 - 41, Add a test that
      verifies readApiKeyFromEnv()/resolveBedrockAuth falls back to
      AWS_BEARER_TOKEN_BEDROCK when BEDROCK_API_KEY is absent: in the
      tests/auth.test.ts suite create a new case which clears BEDROCK_API_KEY, sets
      process.env.AWS_BEARER_TOKEN_BEDROCK to a token value, calls
      resolveBedrockAuth({ region: 'us-east-1' }, 'runtime') (or resolveBedrockAuth({
      auth: 'apikey' }, 'runtime') as appropriate), asserts the returned auth is {
      kind: 'bearer', token: '<value>' }, and finally deletes the
      AWS_BEARER_TOKEN_BEDROCK env var in a finally block to avoid test pollution;
      reference resolveBedrockAuth and the env var names BEDROCK_API_KEY and
      AWS_BEARER_TOKEN_BEDROCK to locate the relevant code paths.
      🤖 Prompt for all review comments with AI agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      Inline comments:
      In `@packages/ai-bedrock/src/converse/structured-output.ts`:
      - Around line 11-23: buildStructuredToolConfig(schema) currently passes the raw
      schema into inputSchema.json which can leak Zod/schema objects to Bedrock;
      update buildStructuredToolConfig to normalize the incoming schema by calling
      convertSchemaToJsonSchema(schema) (the same conversion used by other tools) and
      assign the resulting JSON Schema to inputSchema.json (ensuring the type remains
      DocumentType) before returning the ToolConfiguration, so Bedrock always receives
      a proper JSON Schema.
      
      In `@packages/ai-bedrock/src/converse/tool-converter.ts`:
      - Around line 19-43: toToolConfig currently always returns a ToolConfiguration
      when tools exist even if mapChoice(choice) returns undefined for the special
      case choice === 'none', which keeps tool-calling enabled; change toToolConfig
      (or add an early check) so that if choice === 'none' it returns undefined (i.e.,
      no ToolConfiguration) instead of returning { tools: ... }, otherwise proceed as
      before; reference the toToolConfig function and mapChoice function/choice values
      to locate and implement this early-return behavior.
      
      In `@packages/ai-bedrock/src/utils/openai-sigv4-fetch.ts`:
      - Around line 23-53: When wrapping and signing requests in the anonymous async
      fetch wrapper, preserve the original Request's method, headers and body instead
      of always using init.*: if input is a Request, derive method from input.method,
      start headers from input.headers and then apply/override with init?.headers, and
      derive body from input (or from a cloned Request if you need to read it) unless
      init.body is provided; then pass this merged method/headers/body into the
      HttpRequest sent to signer.sign and into the final baseFetch call so the sent
      request matches the caller's original Request; update the construction of
      request (and the baseFetch call) to use these merged values and keep using
      signer.sign and baseFetch as before.
      
      In `@testing/e2e/README.md`:
      - Around line 187-195: Update the provider summary and feature counts in the
      testing/e2e/README.md to reflect the Bedrock discussion: reconcile the "7
      providers / 7-provider feature counts" claim with the new "Bedrock Converse
      coverage gap" section by either removing Bedrock-converse from the claimed live
      matrix or adjusting the provider list/counts and any aggregate feature numbers
      to match the actual matrix entries (which currently include bedrock and
      bedrock-responses but not a Converse-capable bedrock-converse); update the
      provider list and any numeric summaries so they consistently reflect the current
      E2E matrix.
      
      ---
      
      Outside diff comments:
      In `@packages/ai-bedrock/src/index.ts`:
      - Around line 61-80: The chat branch in build(...) currently just casts the
      model and can accept converse-only models at runtime; add the same runtime guard
      used for responses: call an isChatModel(model) check before constructing
      BedrockTextAdapter (use stripApi(config) as now) and throw a clear Error if the
      model is not chat-capable (include a message like `Model "${model}" is not
      available on the Bedrock Chat API. Chat-capable models:
      ${BEDROCK_CHAT_MODELS.join(', ')}.`). Reference symbols: function build,
      config?.api === 'chat' branch, isChatModel (create it if missing),
      BEDROCK_CHAT_MODELS, stripApi, and BedrockTextAdapter.
      
      ---
      
      Nitpick comments:
      In `@packages/ai-bedrock/tests/auth.test.ts`:
      - Around line 1-42: The test file is located in packages/ai-bedrock/tests/
      instead of colocating it with the implementation; move the test next to
      src/utils/auth.ts and update its import path accordingly: relocate the file to
      the same folder as auth.ts (e.g., src/utils/auth.test.ts), ensure the test
      imports resolveBedrockAuth via the correct relative path (import {
      resolveBedrockAuth } from './auth'), and remove the duplicate test under tests/
      so there is a single unit test file adjacent to the implementation.
      - Around line 13-41: Add a test that verifies
      readApiKeyFromEnv()/resolveBedrockAuth falls back to AWS_BEARER_TOKEN_BEDROCK
      when BEDROCK_API_KEY is absent: in the tests/auth.test.ts suite create a new
      case which clears BEDROCK_API_KEY, sets process.env.AWS_BEARER_TOKEN_BEDROCK to
      a token value, calls resolveBedrockAuth({ region: 'us-east-1' }, 'runtime') (or
      resolveBedrockAuth({ auth: 'apikey' }, 'runtime') as appropriate), asserts the
      returned auth is { kind: 'bearer', token: '<value>' }, and finally deletes the
      AWS_BEARER_TOKEN_BEDROCK env var in a finally block to avoid test pollution;
      reference resolveBedrockAuth and the env var names BEDROCK_API_KEY and
      AWS_BEARER_TOKEN_BEDROCK to locate the relevant code paths.
      
      In `@packages/ai-bedrock/tests/client.test.ts`:
      - Around line 1-127: Tests for withBedrockDefaults and resolveBedrockAuth belong
      colocated with their implementation: move the test file so it sits beside the
      source module that exports resolveBedrockAuth and withBedrockDefaults, update
      the test's import to use the local relative path to that module (instead of the
      current ../src/... import), and adjust the Vitest include glob/config to pick up
      colocated *.test.ts files (e.g., ensure the runner includes **/*.test.ts next to
      sources) so the tests run without violating the repo’s colocated-test rule.
      
      In `@packages/ai-bedrock/tests/openai-sigv4-fetch.test.ts`:
      - Around line 1-34: The test file should be colocated with its implementation:
      move the test from packages/ai-bedrock/tests/openai-sigv4-fetch.test.ts into the
      same directory as the implementation (next to src/utils/openai-sigv4-fetch.ts),
      update the import path for createSigV4Fetch if needed, and ensure any
      package-level test runner configs still discover the new location; keep the test
      filename as openai-sigv4-fetch.test.ts and verify imports (e.g., import {
      createSigV4Fetch } from './openai-sigv4-fetch') resolve correctly after the
      move.
      🪄 Autofix (Beta)

      Fix all unresolved CodeRabbit comments on this PR:

      • Push a commit to this branch (recommended)
      • Create a new PR with the fixes

      ℹ️ Review info
      ⚙️ Run configuration

      Configuration used: defaults

      Review profile: CHILL

      Plan: Pro

      Run ID: 2ba44ccd-b490-4163-a577-b313c08cd665

      📥 Commits

      Reviewing files that changed from the base of the PR and between f8460d2fbef4f395531d9f88dbc4be02ec4efaff and b5a15e7ec3ce0f73cc70289df5ac576108ba4a3f.

      ⛔ Files ignored due to path filters (1)
      • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
      📒 Files selected for processing (38)
      • .changeset/ai-bedrock-adapter.md
      • .claude/skills/gap-analysis/SKILL.md
      • .claude/skills/gap-analysis/references/provider-doc-urls.md
      • docs/adapters/bedrock.md
      • docs/config.json
      • knip.json
      • package.json
      • packages/ai-bedrock/package.json
      • packages/ai-bedrock/src/adapters/converse-text.ts
      • packages/ai-bedrock/src/adapters/responses-text.ts
      • packages/ai-bedrock/src/adapters/text.ts
      • packages/ai-bedrock/src/converse/message-converter.ts
      • packages/ai-bedrock/src/converse/stream-processor.ts
      • packages/ai-bedrock/src/converse/structured-output.ts
      • packages/ai-bedrock/src/converse/tool-converter.ts
      • packages/ai-bedrock/src/index.ts
      • packages/ai-bedrock/src/model-catalog.generated.ts
      • packages/ai-bedrock/src/model-meta.ts
      • packages/ai-bedrock/src/utils/auth.ts
      • packages/ai-bedrock/src/utils/client.ts
      • packages/ai-bedrock/src/utils/index.ts
      • packages/ai-bedrock/src/utils/openai-sigv4-fetch.ts
      • packages/ai-bedrock/tests/adapter.test.ts
      • packages/ai-bedrock/tests/auth.test.ts
      • packages/ai-bedrock/tests/client.test.ts
      • packages/ai-bedrock/tests/converse/adapter.test.ts
      • packages/ai-bedrock/tests/converse/message-converter.test.ts
      • packages/ai-bedrock/tests/converse/stream-processor.test.ts
      • packages/ai-bedrock/tests/converse/structured-output.test.ts
      • packages/ai-bedrock/tests/converse/tool-converter.test.ts
      • packages/ai-bedrock/tests/factory.test.ts
      • packages/ai-bedrock/tests/openai-sigv4-fetch.test.ts
      • packages/ai-bedrock/vite.config.ts
      • packages/ai/skills/ai-core/adapter-configuration/SKILL.md
      • scripts/bedrock-api-compatibility.json
      • scripts/fetch-bedrock-models.ts
      • testing/e2e/README.md
      • testing/e2e/src/lib/providers.ts
      💤 Files with no reviewable changes (1)
      • packages/ai-bedrock/src/utils/index.ts
      ✅ Files skipped from review due to trivial changes (5)
      • .claude/skills/gap-analysis/references/provider-doc-urls.md
      • scripts/bedrock-api-compatibility.json
      • packages/ai-bedrock/src/model-catalog.generated.ts
      • packages/ai-bedrock/package.json
      • packages/ai/skills/ai-core/adapter-configuration/SKILL.md
      🚧 Files skipped from review as they are similar to previous changes (6)
      • .changeset/ai-bedrock-adapter.md
      • .claude/skills/gap-analysis/SKILL.md
      • packages/ai-bedrock/tests/adapter.test.ts
      • testing/e2e/src/lib/providers.ts
      • packages/ai-bedrock/src/adapters/responses-text.ts
      • packages/ai-bedrock/src/adapters/text.ts
      Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      Resolvedby tombeckenham
      Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
      testing/e2e/README.md lines 189 to 197
      @@ -184,3 +184,12 @@
      184184 3. **Add to `tests/test-matrix.ts`** — mirror the support matrix
      185185 4. **No fixture changes needed** — aimock translates to correct wire format
      186186
      187+### Bedrock Converse coverage gap
      188+
      189+The `bedrock` and `bedrock-responses` providers in this matrix use `createBedrockText` with a `baseURL` pointing at aimock — they speak Bedrock's **OpenAI-compatible** endpoint, which aimock's OpenAI replay handles fine.
      190+
      191+The default `bedrock-converse` adapter (introduced later) uses `@aws-sdk/client-bedrock-runtime` and speaks AWS's **binary event-stream (`vnd.amazon.eventstream`) Converse protocol**, which `@copilotkit/aimock` does not currently mock. Adding `bedrock-converse` to the live matrix would fail without a Converse-capable aimock provider.
      192+
      193+**Coverage today:** the Converse translation layer (message converter, tool converter, stream processor, structured output, adapter) is covered by unit tests in `packages/ai-bedrock/tests/converse/` (64 tests). The OpenAI-compatible `bedrock` and `bedrock-responses` entries remain in the E2E matrix as-is.
      194+
      195+**Follow-up:** a Bedrock/Converse provider will be added to aimock to close this gap and enable full E2E coverage of the Converse path.

      ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

      Sync the provider list/counts above with this new Bedrock section.

      This section says bedrock and bedrock-responses are already in the matrix, but the README still advertises 7 providers and 7-provider feature counts. That contradiction will send contributors to the wrong test surface.

      🤖 Prompt for AI Agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      In `@testing/e2e/README.md` around lines 187 - 195, Update the provider summary
      and feature counts in the testing/e2e/README.md to reflect the Bedrock
      discussion: reconcile the "7 providers / 7-provider feature counts" claim with
      the new "Bedrock Converse coverage gap" section by either removing
      Bedrock-converse from the claimed live matrix or adjusting the provider
      list/counts and any aggregate feature numbers to match the actual matrix entries
      (which currently include bedrock and bedrock-responses but not a
      Converse-capable bedrock-converse); update the provider list and any numeric
      summaries so they consistently reflect the current E2E matrix.
    10. Actionable comments posted: 1

      🤖 Prompt for all review comments with AI agents
      Verify each finding against current code. Fix only still-valid issues, skip the
      rest with a brief reason, keep changes minimal, and validate.
      
      Inline comments:
      In `@packages/ai-bedrock/src/adapters/converse-text.ts`:
      - Around line 107-140: The getClient method currently caches a failing promise
      in this.clientPromise so transient startup/auth errors persist; modify getClient
      (the async initializer that calls importBedrockRuntime and resolveBedrockAuth
      and constructs a BedrockRuntimeClient) to clear the cache on rejection: when
      creating this.clientPromise wrap the async factory so any thrown error or a
      rejected promise resets this.clientPromise to undefined before rethrowing (or
      attach a .catch that sets this.clientPromise = undefined and rethrows), ensuring
      subsequent calls will retry client initialization.
      🪄 Autofix (Beta)

      Fix all unresolved CodeRabbit comments on this PR:

      • Push a commit to this branch (recommended)
      • Create a new PR with the fixes

      ℹ️ Review info
      ⚙️ Run configuration

      Configuration used: defaults

      Review profile: CHILL

      Plan: Pro

      Run ID: 93cdd5eb-8bd6-4b99-b37f-74d80e5cf860

      📥 Commits

      Reviewing files that changed from the base of the PR and between b5a15e7ec3ce0f73cc70289df5ac576108ba4a3f and 6a4e71e2bf186123892d49593fa79fad2ae421cd.

      ⛔ Files ignored due to path filters (1)
      • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
      📒 Files selected for processing (3)
      • packages/ai-bedrock/package.json
      • packages/ai-bedrock/src/adapters/converse-text.ts
      • packages/ai-bedrock/src/utils/auth.ts
      🚧 Files skipped from review as they are similar to previous changes (1)
      • packages/ai-bedrock/src/utils/auth.ts
      Resolvedby tombeckenham
    11. tombeckenham reviewed

      Resolvedby tombeckenham
    12. tombeckenham reviewed

      Resolvedby tombeckenham
    13. tombeckenham reviewed

      OutdatedResolvedby tombeckenham
    14. tombeckenham reviewed

      Resolvedby tombeckenham
    15. tombeckenham reviewed

      Automated review pass (Claude Code, multi-agent). Posting the Critical and Important findings as inline comments below. Freshness: PR is 0 behind main, mergeable, no rebase needed — these are content findings, not staleness.

      Critical

      1. Structured-output second pass can return the wrong tool's data — converse-text.ts
      2. Unguarded model as BedrockChatModels cast in the chat factory branch — index.ts

      Important 3. README documents a removed aws-sigv4-fetch peer dependency 4. Docs chat sample uses a non-existent model id 5. Auth: blind nested catches + silent SigV4 fallback 6. Malformed tool-call args silently coerced to {} 7. chatStream discards incoming threadId/parentRunId on RUN_STARTED 8. Unit gaps where Converse E2E was deferred (stream finish/usage, tool drain, reasoning order)

      OutdatedResolvedby tombeckenham
      OutdatedResolvedby tombeckenham
      OutdatedResolvedby tombeckenham
      OutdatedResolvedby tombeckenham
      OutdatedResolvedby tombeckenham
      OutdatedResolvedby tombeckenham
      OutdatedResolvedby tombeckenham
      Resolvedby tombeckenham
    16. Added examples and tested all the way through. It works. image

    17. tombeckenham approved these changes

      Tested all the way through. Good for me

    18. KevinVandy approved these changes

    19. AlemTuzlak merged this27ba4c7

    20. AlemTuzlak closed this

Sign in to join this conversation.