Skip to content

feat: add AWS Bedrock provider - #1559

Merged
avoidwork merged 2 commits into
mainfrom
feat/aws-bedrock-provider
Oct 28, 2026
Merged

avoidwork merged 2 commits into
mainfrom
feat/aws-bedrock-provider

Conversation

@avoidwork

@avoidwork avoidwork commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Description

Adds an AWS Bedrock provider (type: "bedrock") backed by ChatBedrockConverse from @langchain/aws, so madz can run against foundation models (Claude, Llama, Nova, etc.) hosted in Amazon Bedrock. Authentication is read from environment variables or the standard AWS credential chain, never from config files. This is the sibling of the recently-landed azure-openai provider.

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • tests/unit/provider/bedrock.test.js — 21 unit tests covering schema validation, auth precedence (bearer token, static credentials, session token, default chain), region resolution, missing-region error, maxRetries → maxAttempts mapping, and maxTokens/applicationInferenceProfile handling.
  • tests/integration/provider/bedrock.test.js — 5 integration tests using a mocked Bedrock Runtime client asserting the Converse request shape, usage metadata, streaming, tool-call round trips, and ThrottlingException retry behavior.
  • Full suite: 4440 tests pass, 0 fail. npm run lint clean (0 warnings/errors). Coverage maintained (overall 90.88% statements; bedrock.js 100% statements).

Coverage

  • Line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with maintained line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Closes #1554

Adds OpenSpec proposal, design, specs, and tasks for the AWS Bedrock
provider (type: bedrock) backed by ChatBedrockConverse from @langchain/aws.

Closes #1554
@avoidwork avoidwork self-assigned this Oct 28, 2026
Adds a bedrock provider type backed by ChatBedrockConverse from
@langchain/aws. Authentication is read from environment variables or the
AWS credential chain (AWS_BEARER_TOKEN_BEDROCK, then the BEDROCK_AWS_* key
pair, then the default chain). Region resolves from BEDROCK_AWS_REGION then
AWS_REGION. Adds BedrockProviderConfigSchema, dispatches type: bedrock from
createChatModel, falls back to configured contextWindow in modelInfo.js,
and maps rateLimit.maxRetries to the SDK maxAttempts.

Closes #1554
@avoidwork

Copy link
Copy Markdown
Owner Author

Implementation Audit Results — aws-bedrock-provider

Goal Fulfillment

  • Goal 1 (provider type + factory + dispatch): src/provider/bedrock.js exports createBedrockChatModel; createChatModel dispatches type: "bedrock" to it. Verified: returns ChatBedrockConverse.
  • Goal 2 (auth precedence): Factory resolves AWS_BEARER_TOKEN_BEDROCK, then the BEDROCK_AWS_* key pair (+ optional session token), then the default credential chain (omits explicit credentials). Verified by unit tests.
  • Goal 3 (region resolution): resolveBedrockRegion() prefers BEDROCK_AWS_REGION then AWS_REGION; throws a clear error when missing. Verified.
  • Goal 4 (config schema): BedrockProviderConfigSchema added with type: z.literal("bedrock"), enabled, model, region, optional applicationInferenceProfile, temperature, maxTokens, contextWindow, rateLimit, no credentials block. Exported from schemas/index.js and config.js.
  • Goal 5 (model metadata / contextWindow fallback): modelInfo.js getModelContextLength falls back to configured contextWindow for bedrock. Verified.
  • Goal 6 (retry mapping): rateLimit.maxRetries maps to SDK clientOptions.maxAttempts. Verified. Copilot retry middleware not applied to Bedrock (gated on github-copilot).
  • Goal 7 (tests): Unit tests (21) + integration tests (5) all pass. Full suite: 4440 pass, 0 fail.
  • Goal 8 (documentation): JSDoc on all public functions; docs/FEATURES.md provider section with env vars and least-privilege IAM note.

Spec Compliance

  • All requirements in specs/aws-bedrock-provider/spec.md and the model-context-length delta are satisfied by the implementation.

Task Completion

  • All 19 tasks in tasks.md complete (marked [x]), including verification.

Quality Check

  • npm run lint: 0 warnings, 0 errors, formatting clean.
  • npm run test: 4440 pass, 0 fail.
  • npm run coverage: overall 90.88% statements / 87.83% branches / 86.44% functions; bedrock.js 100% statements / 93.33% branches / 100% functions.
  • App starts; the only error is Ink's "Raw mode not supported" which is a non-TTY environment limitation, not an implementation crash.

Verdict

All goals fulfilled, spec-compliant, tasks complete, no obvious issues. Proceed to Step 10 (archive).

@avoidwork
avoidwork merged commit 2ea8dd9 into main Oct 28, 2026
2 checks passed
@avoidwork
avoidwork deleted the feat/aws-bedrock-provider branch October 28, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add AWS Bedrock provider

1 participant