-
Notifications
You must be signed in to change notification settings - Fork 428
Description
Checks
- I have updated to the lastest minor and patch version of Strands
- I have checked the documentation and this is not expected behavior
- I have searched ./issues and there are no duplicates of my issue
Strands Version
1.10.0
Python Version
3.12
Operating System
ghcr.io/astral-sh/uv:python3.12-bookworm-slim
Installation Method
pip
Steps to Reproduce
- Code attached for execution in Amazon Bedrock AgentCore Runtime
- Create a Cognito User Pool and client (note the client ID and user pool ID)
- Create a Google credential provider in Amazon Bedrock AgentCore
- Unzip and replace information in the troubleshooting jupyter notebook (Cognito client ID, User pool ID, user name, and user password)
- Run through all cells to create, deploy, and execute agent.
- Observe that the agent responds that it was unable to retrieve credentials for Google and that CloudWatch logs show an error retrieving the workload access token and that the access token from
BedrockAgentCoreContext.get_workload_access_token()
returns a valid access token outside of the Strands agent butNone
within the tool execution. (This is retrieving a request-scoped ContextVar where the context has shifted when invoking the Strands agent and thus breaking 3LO flows.)
There may be a simpler way to showcase this - I have not yet tried creating a ContextVar directly outside of the agent and then referencing this within a tool execution, instead using the Bedrock AgentCore constructs per my use case. (Note also that there is a global variable workaround that is commented out in this file.)
Expected Behavior
I expect that the workload access token is the same within AgentTask and GetCalendarEventsToday. Essentially that the agent executes in the same context (ContextVar) as the overall request rather than creating a net new context.
Actual Behavior
Actual behavior is that the AgentTask has a correct workload access token (from ContextVar) and the GetCalendarEventsToday returns None
.
Additional Context
No response
Possible Solution
No response
Related Issues
No response