Skip to content

Conversation

@mkmeral
Copy link

@mkmeral mkmeral commented Nov 18, 2025

Merge Upstream Main

This PR merges the latest changes from strands-agents/sdk-python main branch into our fork.

Key Changes to Our Refactored Code

src/strands/tools/caller.py

Our fork previously extracted ToolCaller from Agent into a standalone _ToolCaller class. This merge integrates upstream improvements into our refactored version:

Integrated Upstream Improvements:

  1. Interrupt State Handling

    • Added check for _interrupt_state.activated before tool execution
    • Prevents direct tool calls during active interrupts
    • Uses hasattr() for backward compatibility with agents lacking interrupt state
  2. Interrupt Event Detection

    • Monitors ToolInterruptEvent during tool execution streaming
    • Deactivates interrupt state when detected
    • Raises RuntimeError to prevent interrupts in direct tool calls
  3. Async Tool Recording

    • Updated _record_tool_execution to use await for proper async handling
    • Ensures recording happens within the async event loop
  4. Standardized Async Execution

    • Replaced manual ThreadPoolExecutor + asyncio.run() with run_async() utility
    • Uses run_async from _async.py for consistent async-to-sync bridging
    • Maintains proper context variable propagation

Preserved Fork Features:

  • Agent-agnostic design supporting both traditional Agent and BidirectionalAgent
  • Conditional conversation management (only applied when agent supports it)
  • Flexible architecture for future agent types

@github-actions github-actions bot added size/xl and removed size/xl labels Nov 18, 2025
@mehtarac mehtarac merged commit 3346dfa into mehtarac:main Nov 18, 2025
1 of 13 checks passed
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.

2 participants