sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[BUG] In Agent As Tool pattern, the invocation_state from main agent is not respected by subagents

Open LeoYao opened this issue 3 months ago • 1 comments

Checks

  • [x] I have updated to the lastest minor and patch version of Strands
  • [x] I have checked the documentation and this is not expected behavior
  • [x] I have searched ./issues and there are no duplicates of my issue

SDK Language

Python

Strands Version

1.41.0

Language Runtime Version

Python 3.13.13

Operating System

macOS 16.6.`

Installation Method

other

Steps to Reproduce

In Agent As Tool pattern, the invocation_state passed in https://github.com/strands-agents/harness-sdk/blob/v1.41.0/src/strands/agent/_agent_as_tool.py#L135 is not passed into the actual call to underlying subagent at https://github.com/strands-agents/harness-sdk/blob/v1.41.0/src/strands/agent/_agent_as_tool.py#L199.

This leads to critical information stored in invocation_state is not carried in subagent call. For example, some authentication related information needs to be pass around main agent to subagent such that those information can be injected by a BeforeToolCall hook into all tool calls that the subagent will make.

Expected Behavior

invocation_state from main agent can be passed into subagent when using Agent As Tool pattern.

Actual Behavior

invocation_state from main agent is lost in subagent call when using Agent As Tool pattern.

Additional Context

No response

Possible Solution

No response

Related Issues

No response

LeoYao avatar Aug 21 '26 23:08 LeoYao

Hello strands team, wanted to check the status of the bug fixing. Looks like there are 2 PRs linked to the bug fixing, but none of them get approved and/or merged. Wondering if the maintainer/reviewers can take a look on them given the changes are relatively small.

LeoYao avatar Oct 07 '26 00:10 LeoYao