feat(event_handler): add Bedrock Agent event handler#3285
feat(event_handler): add Bedrock Agent event handler#3285rubenfonseca merged 13 commits intodevelopfrom
Conversation
|
@heitorlessa @leandrodamascena opening up this for early code review, while I finish the documentation this morning |
heitorlessa
left a comment
There was a problem hiding this comment.
NICE!!! That's gonna be a real life saver for so many people.. and even more when Lambda supports streaming responses for Python one day perhaps.
one important question about response builder into a public attr as it isn't clear to me why that is.
The cast also makes me think we can do better but I only had 20 seconds to look before a meeting.
275e7e7 to
9a288aa
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #3285 +/- ##
===========================================
+ Coverage 95.26% 95.32% +0.06%
===========================================
Files 207 208 +1
Lines 9581 9607 +26
Branches 1756 1759 +3
===========================================
+ Hits 9127 9158 +31
+ Misses 337 333 -4
+ Partials 117 116 -1
☔ View full report in Codecov by Sentry. |
aws_lambda_powertools/utilities/data_classes/bedrock_agent_event.py
Outdated
Show resolved
Hide resolved
heitorlessa
left a comment
There was a problem hiding this comment.
code to delete after your latest improvement ;)
|
@heitorlessa ready for another review: I've removed dead code and added more tests, which uncovered a small bug :) yeah! |
|
@rubenfonseca failing on pydantic FAILED tests/functional/event_handler/test_bedrock_agent.py::test_bedrock_agent_event_with_validation_errorassert 'value is not a valid dict' in '{"detail": [{"type": "dict_type", "loc": ["response"], "msg": "Input should be a valid dictionary", "input": "oh no, this is not a dict", "url": "https://errors.pydantic.dev/2.4/v/dict_type"}]}' |
Co-authored-by: Heitor Lessa <[email protected]> Signed-off-by: Ruben Fonseca <[email protected]>
Co-authored-by: Heitor Lessa <[email protected]> Signed-off-by: Ruben Fonseca <[email protected]>
Co-authored-by: Heitor Lessa <[email protected]> Signed-off-by: Ruben Fonseca <[email protected]>
db718bb to
fd7c974
Compare
|
Kudos, SonarCloud Quality Gate passed!
|








Issue number: #3261
Summary
Changes
This PR adds support for a new type of event handler: Bedrock Agents.
User experience
Before this PR, this would be the code necessary to build a Bedrock Agent (taken from here):
After this PR, this is that the code above looks like:
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.