[Bug]: aws-strands template round-trip tests read back a ContextManager where they set 'auto'
The aws-strands-python-latest job in unit-python-sdk.yml exists to catch upstream drift: it runs uv sync --locked, then upgrades strands-agents to whatever is newest on PyPI and reruns the suite. It's doing exactly that. On 2026-09-15 it picked up strands-agents 1.56.0 against a lockfile pinned at 1.18.0, and two cases in test_template_agent_propagation.py came back red:
FAILED tests/test_template_agent_propagation.py::test_template_param_round_trips[context_manager]
AssertionError: context_manager: set 'auto' on the template but the per-thread kwargs carry
<strands._context_manager.context_manager.ContextManager object at 0x...>
FAILED tests/test_template_agent_propagation.py::test_template_param_reaches_thread_agent_kwargs[context_manager]
AssertionError: context_manager: set 'auto' on the template but the per-thread agent was built with
<strands._context_manager.context_manager.ContextManager object at 0x...>The rest of that job passed — 1449 passed, 15 skipped. The pinned aws-strands-python job is green, so nothing is broken for anyone on 1.18.0 today.
What moved is on the Strands side. _distinguishable_sentinel synthesizes a value for each param from the Agent.__init__ annotation, and for context_manager that yields the literal 'auto'. Newer Strands resolves that string into a ContextManager instance during construction, so when _extract_agent_kwargs reads the attribute back off the template it gets the resolved object rather than the string it was handed, and _same_value compares the two and fails.
Worth saying that the forwarding itself looks correct: the per-thread agent is built with the ContextManager the template resolved, which is the setting the caller asked for. It's the round-trip identity assertion that no longer holds, not the propagation.
Two directions, and I don't have a strong preference between them:
- Teach the suite about params the upstream constructor normalizes, so the comparison for
context_manageraccepts a resolved value instead of requiring the literal back. - Have the synthesizer avoid literals for params that are known to be normalized and pick a constructed
ContextManageras the sentinel, which keeps the identity assertion meaningful.
Either way this reads as a test-side change unless someone finds a real propagation gap behind it. Happy to be talked out of both if there's a cleaner read.
Surfaced while running CI on #2210. It's unrelated to that branch — noting it here so it doesn't get read as a contributor problem.
Source: ag-ui-protocol/ag-ui