Skip to content

fix(aws): normalize Bedrock reasoning blocks#11200

Merged
Hunter Lovell (hntrl) merged 3 commits into
mainfrom
fix/bedrock-reasoning-replay
Jul 14, 2026
Merged

fix(aws): normalize Bedrock reasoning blocks#11200
Hunter Lovell (hntrl) merged 3 commits into
mainfrom
fix/bedrock-reasoning-replay

Conversation

@hntrl

Copy link
Copy Markdown
Member

Summary

Normalize Bedrock Converse reasoning into LangChain's standard reasoning block shape by default, including opaque signatures and streaming block indexes. Prevent incomplete signature-only reasoning from being replayed as an invalid Bedrock reasoningText block while preserving tool calls and compatibility with persisted provider-native content.

Changes

@langchain/aws

  • Emit { type: "reasoning", reasoning, signature } for ordinary Bedrock reasoning without requiring output_version: "v1".
  • Associate streamed reasoning text and signature deltas by content-block index so they merge into a single standard block.
  • Validate reasoning at the Bedrock request boundary and omit signature-only or empty reasoning while retaining subsequent tool-use and tool-result ordering.
  • Preserve complete signed reasoning, legacy provider-native reasoning, legacy non_standard wrappers, and redacted reasoning.
  • Combine streamed redacted reasoning as bytes instead of concatenating independently padded base64 fragments.

@langchain/core

  • Recognize Bedrock's object-valued reasoning shape and normalize its text and signature into a standard reasoning block.
  • Retain compatibility with the legacy string-valued reasoning representation without changing public core content types.
@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7894e35

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@langchain/aws Patch
@langchain/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@open-swe open-swe Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open SWE Review found 1 potential issue.

Open in WebView Open SWE trace

Comment thread libs/providers/langchain-aws/src/utils/message_outputs.ts
block.type === "reasoning_content"
) {
const reasoningContent =
langchainReasoningBlockToBedrockReasoningBlock(block);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this

@hntrl
Hunter Lovell (hntrl) merged commit 08e5888 into main Jul 14, 2026
39 checks passed
@hntrl
Hunter Lovell (hntrl) deleted the fix/bedrock-reasoning-replay branch July 14, 2026 21:22
Hunter Lovell (hntrl) pushed a commit that referenced this pull request Jul 14, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @langchain/core@1.2.3

### Patch Changes

- [#11200](#11200)
[`08e5888`](08e5888)
Thanks [@hntrl](https://github.com/hntrl)! - fix(aws): normalize and
safely replay Bedrock reasoning blocks

Emit standard reasoning blocks with preserved signatures, omit
incomplete signature-only reasoning during replay, and retain
compatibility with legacy and redacted Bedrock reasoning.
## @langchain/aws@1.4.3

### Patch Changes

- [#11200](#11200)
[`08e5888`](08e5888)
Thanks [@hntrl](https://github.com/hntrl)! - fix(aws): normalize and
safely replay Bedrock reasoning blocks

Emit standard reasoning blocks with preserved signatures, omit
incomplete signature-only reasoning during replay, and retain
compatibility with legacy and redacted Bedrock reasoning.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants