feat(skills): add agent skills as a plugin#1755
Merged
mkmeral merged 33 commits intostrands-agents:mainfrom Mar 10, 2026
Merged
feat(skills): add agent skills as a plugin#1755mkmeral merged 33 commits intostrands-agents:mainfrom
mkmeral merged 33 commits intostrands-agents:mainfrom
Conversation
BREAKING CHANGE: Plugin is now an abstract base class instead of a Protocol. Plugins must explicitly inherit from Plugin and implement the abstract name property and init_plugin method. - Convert Plugin from @runtime_checkable Protocol to ABC - Make name an abstract property - Make init_plugin an abstract method - Update all tests to use inheritance - Maintain support for both sync and async init_plugin - All tests pass (1985 passed) 🤖 Assisted by the code-assist SOP
Implement the SkillsPlugin that adds AgentSkills.io skill support to the Strands Agents SDK. The plugin enables progressive disclosure of skill instructions: metadata is injected into the system prompt upfront, and full instructions are loaded on demand via a tool. Key components: - Skill dataclass with from_path classmethod for loading from SKILL.md - Loader module for discovering, parsing, and validating skills - SkillsPlugin extending the Plugin ABC with: - skills tool (activate/deactivate actions) - BeforeInvocationEvent hook for system prompt injection - AfterInvocationEvent hook for prompt restoration - Single active skill management - Dynamic skill management via property setter - Session persistence via agent.state Files added: - src/strands/plugins/skills/__init__.py - src/strands/plugins/skills/skill.py - src/strands/plugins/skills/loader.py - src/strands/plugins/skills/skills_plugin.py - tests/strands/plugins/skills/ (90 tests) Files modified: - src/strands/plugins/__init__.py (added SkillsPlugin export) - src/strands/__init__.py (added Skill to top-level exports)
- Create @hook decorator for declarative hook registration in plugins - Convert Plugin from Protocol to base class (breaking change) - Add auto-discovery of @hook and @tool decorated methods in Plugin.__init__() - Add auto-registration of hooks and tools in Plugin.init_plugin() - Support union types for multiple event types (e.g., BeforeModelCallEvent | AfterModelCallEvent) - Export hook from strands.plugins and strands namespaces - Update existing tests to use inheritance-based approach - Add comprehensive test coverage for new functionality BREAKING CHANGE: Plugin is now a base class instead of a Protocol. Existing plugins must inherit from Plugin instead of just implementing the protocol.
- Simplify skills tool to single activate action (remove deactivate/action param) - Capture original system prompt once instead of save/restore pattern - Remove AfterInvocationEvent hook (no longer needed) - Replace optional pyyaml with required dependency - Remove _parse_yaml_simple fallback parser - Export Skill and SkillsPlugin from strands top-level
Replace manual hook registration and standalone tool factory with declarative @hook and @tool decorators on SkillsPlugin methods. - Remove _make_skills_tool() standalone function - Convert skills() to @tool decorated instance method - Convert _on_before_invocation() to @hook decorated method - Remove register_hooks() (old HookProvider pattern) - Rename skills property to available_skills (avoids collision) - Delegate hook/tool registration to super().init_plugin() - Update tests to match new API surface
This reverts commit 29f9bf4.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Assessment: Request Changes
The implementation is excellent and all technical feedback has been addressed. However, the PR description still shows "Documentation PR: TBD" which needs to be resolved before merge.
Review Summary
Technical Implementation: ✅ Ready
- Clean plugin architecture following repository patterns
- Comprehensive test coverage (unit + integration)
- Lenient validation per AgentSkills.io spec
- Proper XML escaping and error handling
- Skill activation tracking for session persistence
Blocking Item:
- Documentation PR: The PR description states "TBD" under Documentation PR. Per repository guidelines, either:
- Link to a documentation PR at
https://github.com/strands-agents/docs/pull/... - Provide justification why documentation updates are not required
- Link to a documentation PR at
Once the documentation requirement is addressed, this PR is ready to merge. Great work on iterating through the feedback! 🎉
Member
|
don't block on docs /strands review |
Unshure
reviewed
Mar 9, 2026
Contributor
Author
|
/strands review |
Unshure
reviewed
Mar 10, 2026
Unshure
previously approved these changes
Mar 10, 2026
Unshure
reviewed
Mar 10, 2026
Co-authored-by: Nick Clegg <nac542@gmail.com>
Unshure
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
See design strands-agents/docs#528
This PR adds
SkillsPlugin, a first-class plugin that brings Agent Skills support to Strands. It follows the spec's progressive disclosure model: lightweight metadata (name + description) is injected into the system prompt at startup, and full instructions are loaded on-demand when the agent activates a skill via a tool call. This keeps context usage low while giving agents access to rich, task-specific instructions when needed.Public API Changes
New
SkillsPluginclass andSkilldataclass, both exported from the top-levelstrandspackage:The plugin registers a
skillstool that the agent calls to activate a skill by name. When activated, the tool returns the full instructions along with metadata (allowed tools, compatibility, location) and a listing of available resource files (scripts/,references/,assets/) for filesystem-based skills.Skills can be managed at runtime via a symmetric property and a resolution method:
Skill metadata is injected into the system prompt as XML before each invocation, with special characters escaped:
The active skill selection is persisted to
agent.statefor session recovery.Use Cases
Resolves: #1181
Documentation PR
TBD
Type of Change
New feature
Testing
Manually tested using jupyter notebook and set of skills from
anthropic/skillsrepository100 unit tests covering the plugin, tool, XML generation/escaping, response formatting, resource listing, session persistence, and skill resolution
2 integration tests against a real Bedrock model: model-driven skill activation with codeword verification, and direct tool invocation with state persistence checks
All existing tests (2145 total) continue to pass
I ran
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.