Skip to content

Conversation

statefb
Copy link
Contributor

@statefb statefb commented Jul 31, 2025

Issue #, if available:
close #897

Description of changes:
To introduce MCP support (#866), refactor to replace current implementation with strands SDK

Tool Implementation

  • Refactored Strands tools to be thin wrappers around existing implementations
  • knowledge_tool_strands.py: Uses existing search_knowledge and KnowledgeToolInput
  • bedrock_agent_tool_strands.py: Uses existing _bedrock_agent_invoke and BedrockAgentInput
  • internet_search_tool_strands.py: Already implemented with Firecrawl → DuckDuckGo fallback
  • Utilizes Strands tool execution hooks (BeforeToolInvocationEvent / AfterToolInvocationEvent) to include source_id for citation support.

Chat Routing System

  • Split chat() into common and framework specific implementation.
    1. (Common preprocess) Setup messages and LLM parameters.
    2. (Framework specific) Converse with LLM and build response messages.
    • USE_STRANDS == true → Routes to converse_with_strands() (Strands implementation)
    • USE_STRANDS == false → Routes to converse_legacy() (original implementation with deprecation warning)
    1. (Common postprocess) Update conversation and store into database.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@statefb statefb changed the title Refactor strands [WIP] Refactor strands Jul 31, 2025
@statefb statefb changed the title [WIP] Refactor strands [WIP] Refactor with strands Jul 31, 2025
statefb added 23 commits August 1, 2025 11:28
- Update _extract_reasoning_content_from_agent_result to handle Strands' actual reasoning structure
- Change from looking for 'type' == 'reasoning' to 'reasoningContent' key
- Extract reasoning text from reasoningContent.reasoningText.text path
- Use actual signature from Strands instead of hardcoded value
- Ensure reasoning content is properly added to thinking_log for persistence
- Align with chat_legacy logic for reasoning content handling
@statefb statefb changed the title [WIP] Refactor with strands Refactor with strands Aug 29, 2025
@statefb
Copy link
Contributor Author

statefb commented Sep 18, 2025

Memo: reflect #927 as well

- Split `chat()` into common and framework specific implementation.
  1. (Common preprocess) Setup messages and LLM parameters.
  2. (Framework specific) Converse with LLM and build response messages.
  3. (Common postprocess) Update conversation and store into database.

- Consolidate the code for converting between application-defined models (messages, contents and tools) and Strands models into `converters` module.

- Fix some bugs in streaming processing
  - Fail to continue generation based on a message with `ReasoningContent`.
  - Not handling `redactedContent` correctly.
@HirokiNakatani
Copy link

When is it scheduled to be released?
If MCP can be used, the range of support will be greatly expanded.

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.

[Feature Request] Utilizing Strands for Agent implementation

3 participants