feat(strands-memory): add converter injection and optional restored-tool filtering#288
feat(strands-memory): add converter injection and optional restored-tool filtering#288dharamendrak wants to merge 5 commits intoaws:mainfrom
Conversation
…converters and tests
… and enhance OpenAI converter handling - Added AutoConverseConverter to facilitate automatic converter selection based on agent model. - Updated AgentCoreMemorySessionManager to support auto converter mode. - Enhanced OpenAI converter to preserve reasoning content and handle oversized payloads. - Updated tests to validate new auto converter functionality and reasoning content preservation.
- Changed module paths for OpenAI, Anthropic, and Gemini models in test files to align with the updated project structure. - Ensured consistency across tests for accurate model identification.
| @@ -0,0 +1,85 @@ | |||
| """Automatic converter selection for mixed-model sessions.""" | |||
There was a problem hiding this comment.
I'm not convinced this is necessary. Although it may be possible that someone will have mixed messages, I see it as a really rare use case so I'm not convinced it's worth the tech debt.
There was a problem hiding this comment.
I agree this is case is rare
| @@ -0,0 +1,7 @@ | |||
| """Strands-native message-shape converter adapter.""" | |||
There was a problem hiding this comment.
I think this should not be necessary as strands is natively bedrock. We can just leave the converter as None
| @@ -0,0 +1,200 @@ | |||
| """Anthropic-format converter for AgentCore Memory. | |||
There was a problem hiding this comment.
I would be in favor of progressively adding these converters only as we need them. I think we can leave this one out for now.
There was a problem hiding this comment.
We can incrementally add it
| self.converter = AutoConverseConverter | ||
| AutoConverseConverter.set_write_converter(BedrockConverseConverter) | ||
| else: | ||
| self.converter = converter or BedrockConverseConverter |
There was a problem hiding this comment.
nit: consider just leaving it as None for bedrock (native) format
| Defaults to None. | ||
| **kwargs (Any): Additional keyword arguments. | ||
| """ | ||
| self._auto_converter_enabled = converter == "auto" |
There was a problem hiding this comment.
I think this _auto_converter_enabled is over engineering for now. consider yagni
Issue #, if available:
#254
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.