Skip to content

feat(bedrock): stream Converse tool arguments - #101

Merged
Kinfe123 merged 2 commits into
mainfrom
feat/bedrock-converse-stream
Oct 30, 2026
Merged

Kinfe123 merged 2 commits into
mainfrom
feat/bedrock-converse-stream

Conversation

@Kinfe123

Copy link
Copy Markdown
Collaborator

Closes #100.

Problem

Bedrock ConverseStream uses content-block events rather than the envelopes accepted by the existing adapters. Applications currently need their own index-to-tool-ID mapping to consume partial tool arguments with Streamfold.

Change

Add streamfold/bedrock, reusing the shared integration and parser pool. Tool-use starts bind content block indexes to tool-use IDs, argument deltas update those calls, and block stops finalize them. Complete pending JSON is finalized at EOF. Text, reasoning, and metadata events are ignored; service error events fail the integration and abort active parsers.

The event declaration accepts the AWS SDK's decoded event union directly, including its optional fields. AWS remains a development-only dependency.

Verification

  • node --test packages/core/src/bedrock.test.js: four focused tests pass, covering interleaved calls, immutable partial values, duplicate stops, empty arguments, EOF, truncation, byte limits, service errors, and unmatched-event diagnostics.
  • pnpm typecheck: the actual BedrockRuntimeClient.send(new ConverseStreamCommand(...)) stream compiles with readStructured and manual consumption.
  • pnpm release:check: 201 JavaScript tests and 11 Rust tests pass, plus type/syntax, WASM, formatting, Clippy, and package checks.
  • No live AWS request was made. Runtime fixtures follow the documented ConverseStream protocol; the SDK consumer boundary is checked at compile time.

Public surface

Adds the streamfold/bedrock subpath, bedrock, createStructuredStream, and BedrockToolCallEvent. Updates the README, API guide, and unreleased changelog. No existing export or runtime dependency changes.

@Kinfe123 Kinfe123 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

lgtm, bedrock tool streams preserve call ids and clean up on errors.

@Kinfe123
Kinfe123 merged commit 8c0dc10 into main Oct 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Bedrock ConverseStream tool arguments

1 participant