Skip to content

Conversation

@StuartLox
Copy link

@StuartLox StuartLox commented Aug 10, 2025

Description

Currently, SpringAI does not expose a way to pass custom requestMetadata to the Bedrock Converse API.

AWS Bedrock allows including requestMetadata in requests so that additional contextual information can appear in Bedrock audit logs in CloudWatch.

This is particularly useful for tracing requests, where correlation IDs, user session IDs, or other operational tags are required for audit and compliance purposes.

See RequestMetadata in Converse API here: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html

Proposed Change

This change leverages the metadata field from the user prompt Object to provide a mechanism to set the requestMetadata parameter in the ConverseAPI Request.

@StuartLox StuartLox force-pushed the feature/bedrock-converse-request-metadata branch from ca2a531 to 8f89a11 Compare August 10, 2025 13:41
@StuartLox StuartLox changed the title [Enhancement] - Add requestMetadata to converse request [Enhancement] - Enable passing of requestMetadata to the Bedrock Converse API. Aug 10, 2025
Copy link
Contributor

@sunyuhan1998 sunyuhan1998 left a comment

Choose a reason for hiding this comment

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

Thanks!

@StuartLox StuartLox force-pushed the feature/bedrock-converse-request-metadata branch 2 times, most recently from a75a707 to 142d5dc Compare August 11, 2025 11:14
@StuartLox StuartLox requested a review from sunyuhan1998 August 11, 2025 11:14
@StuartLox StuartLox force-pushed the feature/bedrock-converse-request-metadata branch from 5e37932 to ff85ea1 Compare August 11, 2025 11:29
@StuartLox
Copy link
Author

@sunyuhan1998 just checking do you know how to get a review from the maintainers?

@StuartLox
Copy link
Author

@sobychacko any feedback on this one?

@sunyuhan1998
Copy link
Contributor

@sunyuhan1998 just checking do you know how to get a review from the maintainers?

I suppose they'll get to it once they see this PR—after all, the team might be busy with other tasks at times.

@ilayaperumalg ilayaperumalg self-assigned this Sep 9, 2025
@ilayaperumalg ilayaperumalg added this to the 1.1.0.M2 milestone Sep 9, 2025
@ilayaperumalg
Copy link
Member

@StuartLox Thanks for the PR! The changes look good; Please check if you can improve the Integration test coverage. Thanks!

@StuartLox StuartLox force-pushed the feature/bedrock-converse-request-metadata branch from 68ad61e to 529c47e Compare September 10, 2025 23:19
@StuartLox
Copy link
Author

@ilayaperumalg have incorporated your suggestions, by updating the IT to validate the expected metadata is in the response output.

@StuartLox StuartLox force-pushed the feature/bedrock-converse-request-metadata branch from 181b5a0 to aeba66d Compare September 11, 2025 13:08
@StuartLox
Copy link
Author

@ilayaperumalg the problem is that the requestMetadata is not returned in the response, so its not possible to assert any details related to the requestMetadata in the Response unfortunatly:

See the Response details here:
https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html#API_runtime_Converse_ResponseElements

@ilayaperumalg
Copy link
Member

@StuartLox ok, thanks for clarifying. I manually verified that request metadata is being passed as part of Converse client request. Will merge this PR soon.

@ilayaperumalg
Copy link
Member

@StuartLox Thanks once again for the changes. Rebased, squashed and merged as 45baa39

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.

3 participants