Skip to content

Bedrock Converse Streaming Support#1565

Merged
umaannamalai merged 15 commits intomainfrom
feat-converse-streaming
Nov 18, 2025
Merged

Bedrock Converse Streaming Support#1565
umaannamalai merged 15 commits intomainfrom
feat-converse-streaming

Conversation

@TimPansino
Copy link
Contributor

Overview

  • Add support for BedrockRuntime.converse_stream in botocore and boto3.

@TimPansino TimPansino requested a review from a team as a code owner October 31, 2025 20:06
@github-actions
Copy link

github-actions bot commented Oct 31, 2025

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 7 0 0 0.96s
✅ MARKDOWN markdownlint 7 0 0 0 1.34s
✅ PYTHON ruff 949 0 0 0 1.01s
✅ PYTHON ruff-format 949 0 0 0 0.36s
✅ YAML prettier 15 0 0 0 1.57s
✅ YAML v8r 15 0 0 4.95s
✅ YAML yamllint 15 0 0 0.7s

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security

@mergify mergify bot added the tests-failing Tests failing in CI. label Oct 31, 2025
@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 85.71429% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.83%. Comparing base (f181585) to head (67351de).

Files with missing lines Patch % Lines
newrelic/hooks/external_botocore.py 84.52% 7 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1565      +/-   ##
==========================================
- Coverage   81.83%   81.83%   -0.01%     
==========================================
  Files         207      207              
  Lines       23970    24008      +38     
  Branches     3803     3812       +9     
==========================================
+ Hits        19615    19646      +31     
- Misses       3087     3091       +4     
- Partials     1268     1271       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TimPansino TimPansino force-pushed the feat-converse-streaming branch 3 times, most recently from 71d4d32 to d992b41 Compare October 31, 2025 21:23
@mergify mergify bot added merge-conflicts Merge conflicts detected. and removed tests-failing Tests failing in CI. labels Oct 31, 2025
@TimPansino TimPansino force-pushed the feat-converse-streaming branch from 472ec94 to c9ff7cb Compare November 4, 2025 21:31
@mergify mergify bot removed the merge-conflicts Merge conflicts detected. label Nov 4, 2025
@mergify mergify bot added the tests-failing Tests failing in CI. label Nov 14, 2025
@TimPansino TimPansino force-pushed the feat-converse-streaming branch from 3f96f91 to 955f403 Compare November 17, 2025 21:17
@TimPansino TimPansino force-pushed the feat-converse-streaming branch from 59d3f56 to d3e7cb9 Compare November 18, 2025 01:01
@mergify mergify bot removed the tests-failing Tests failing in CI. label Nov 18, 2025
@umaannamalai umaannamalai merged commit 060ddbd into main Nov 18, 2025
99 of 108 checks passed
@umaannamalai umaannamalai deleted the feat-converse-streaming branch November 18, 2025 22:25
sgoel-nr added a commit to sgoel-nr/newrelic-python-agent that referenced this pull request Nov 25, 2025
* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
sgoel-nr pushed a commit to sgoel-nr/newrelic-python-agent that referenced this pull request Nov 25, 2025
* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
sgoel-nr added a commit to sgoel-nr/newrelic-python-agent that referenced this pull request Nov 25, 2025
* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
sgoel-nr pushed a commit to sgoel-nr/newrelic-python-agent that referenced this pull request Nov 25, 2025
* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
sgoel-nr pushed a commit to sgoel-nr/newrelic-python-agent that referenced this pull request Nov 25, 2025
* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
sgoel-nr pushed a commit to sgoel-nr/newrelic-python-agent that referenced this pull request Nov 25, 2025
* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
umaannamalai added a commit that referenced this pull request Dec 1, 2025
…Bedrock support (#1580)

* Record the request message as the time the request started for LangChain.

* Tracking the original timestamp of the request for input messages that are
recorded as LlmChatCompletionMessage event types.

* First pass at preserving LlmChatCompletionMessage timestamp for the request
with Bedrock methods.

* the `kwargs` was being mapped directly to the OpenAI client
and having timestamp in there caused a problem. As a quick test,
only add the request timestamp after the wrapped function has been
invoked.

* Moved the request timestamp to its own variable instead of part of kwargs.

* OpenAI async request messages were not being assigned the correct timestamp.

* Trying to improve the passing of the request timestamp through for Bedrock.

* Passing too many parameters.

* Set a default role on input/output messages within LangChain.

* [MegaLinter] Apply linters fixes

* Fix request_timestamp for LlmChatCompletionSummary table

* Fix request_timestamp for LlmChatCompletionSummary table

* [MegaLinter] Apply linters fixes

* Bedrock Converse Streaming Support (#1565)

* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Bedrock Converse Streaming Support (#1565)

* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* [MegaLinter] Apply linters fixes

* request_timestamp is now passed across different method

* Fixed gemini model kwargs issue

* [MegaLinter] Apply linters fixes

* Update tests to validate presence of timestamp/ role and fix bugs in instrumentation.

* Update aiobotocore instrumentation to receive request timestamp.

---------

Co-authored-by: Josh Bonczkowski <[email protected]>
Co-authored-by: sgoel-nr <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Timothy Pansino <[email protected]>
Co-authored-by: Uma Annamalai <[email protected]>
hmstepanek pushed a commit that referenced this pull request Dec 5, 2025
* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
hmstepanek pushed a commit that referenced this pull request Dec 5, 2025
…Bedrock support (#1580)

* Record the request message as the time the request started for LangChain.

* Tracking the original timestamp of the request for input messages that are
recorded as LlmChatCompletionMessage event types.

* First pass at preserving LlmChatCompletionMessage timestamp for the request
with Bedrock methods.

* the `kwargs` was being mapped directly to the OpenAI client
and having timestamp in there caused a problem. As a quick test,
only add the request timestamp after the wrapped function has been
invoked.

* Moved the request timestamp to its own variable instead of part of kwargs.

* OpenAI async request messages were not being assigned the correct timestamp.

* Trying to improve the passing of the request timestamp through for Bedrock.

* Passing too many parameters.

* Set a default role on input/output messages within LangChain.

* [MegaLinter] Apply linters fixes

* Fix request_timestamp for LlmChatCompletionSummary table

* Fix request_timestamp for LlmChatCompletionSummary table

* [MegaLinter] Apply linters fixes

* Bedrock Converse Streaming Support (#1565)

* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Bedrock Converse Streaming Support (#1565)

* Add more formatting to custom event validatators

* Add streamed responses to converse mock server

* Add streaming fixtures for testing for converse

* Rename other bedrock test files

* Add tests for converse streaming

* Instrument converse streaming

* Move GeneratorProxy adjacent functions to mixin

* Fix checking of supported models

* Reorganize converse error tests

* Port new converse botocore tests to aiobotocore

* Instrument response streaming in aiobotocore converse

* Fix suggestions from code review

* Port in converse changes from strands PR

* Delete commented code

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* [MegaLinter] Apply linters fixes

* request_timestamp is now passed across different method

* Fixed gemini model kwargs issue

* [MegaLinter] Apply linters fixes

* Update tests to validate presence of timestamp/ role and fix bugs in instrumentation.

* Update aiobotocore instrumentation to receive request timestamp.

---------

Co-authored-by: Josh Bonczkowski <[email protected]>
Co-authored-by: sgoel-nr <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Timothy Pansino <[email protected]>
Co-authored-by: Uma Annamalai <[email protected]>
@hmstepanek hmstepanek added this to the v11.2.0 milestone Dec 8, 2025
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.

4 participants