Skip to content

fix(aws-strands): preserve plugins on per-thread agents#1954

Closed
2830500285 wants to merge 2 commits into
ag-ui-protocol:mainfrom
2830500285:codex/strands-plugin-preservation
Closed

fix(aws-strands): preserve plugins on per-thread agents#1954
2830500285 wants to merge 2 commits into
ag-ui-protocol:mainfrom
2830500285:codex/strands-plugin-preservation

Conversation

@2830500285

Copy link
Copy Markdown

Fixes #1933

Summary

  • add an explicit plugins option to the Python StrandsAgent wrapper
  • forward plugin providers to each per-thread Strands agent when the installed Strands version accepts plugins
  • fall back to _plugin_registry.add_and_init(...) when available, and warn instead of silently dropping plugins otherwise
  • add regression coverage for kwarg forwarding, per-thread list isolation, falsy plugin inputs, and registry fallback

Validation

  • uv run pytest tests/test_template_plugins_preservation.py tests/test_template_agent_propagation.py tests/test_template_hooks_preservation.py -q
  • uv run pytest -q
  • uv run python -m compileall -q src tests/test_template_plugins_preservation.py tests/test_template_agent_propagation.py
  • git diff --check
  • uv run ruff format --check tests/test_template_plugins_preservation.py && uv run ruff check tests/test_template_plugins_preservation.py

@2830500285
2830500285 requested a review from a team as a code owner June 13, 2026 02:45
@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

@2830500285 is attempting to deploy a commit to the CopilotKit Team on Vercel.

A member of the Team first needs to authorize it.

@tylerslaton

Copy link
Copy Markdown
Contributor

Thanks for tackling this. The explicit plugins path is a reasonable direction, but I think this still needs changes before it can safely close #1933.

The current tests prove that an explicit kwarg is forwarded through a mocked core, but they do not cover the linked issue's actual shape: a template Strands Agent that was already constructed with a plugin such as AgentSkills, then wrapped as StrandsAgent(agent=agent, name="...").

The main risk is around tool registration. This PR forwards the plugin list while still passing tools=self._tools to each per-thread Strands agent. For the issue's concrete shape, plugin-provided tools may already be present in agent.tool_registry.registry.values(). Current Strands processes explicit tools before it initializes plugins, and duplicate tool names raise, so AgentSkills can end up double-registering the skills tool if callers pass the same plugin to the wrapper.

I think this needs a regression test with a real plugin that registers both a tool and a hook, ideally AgentSkills or a small test plugin, and the fix should either recover plugins from the template or filter plugin-provided tools out of self._tools before forwarding plugins.

@BenTaylorDev

Copy link
Copy Markdown
Contributor

Closing in favor of #2141, which addresses the same aws-strands per-thread plugin preservation (same files) and has already been reviewed/approved. Let's land it there. Thanks @2830500285 — appreciate the fix.

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.

[Bug]: StrandsAgent silently drops plugins from per-thread agents

3 participants