Skip to content

Strands Plugin Tutorial#265

Open
trigan wants to merge 3 commits into
strands-agents:mainfrom
trigan:main
Open

Strands Plugin Tutorial#265
trigan wants to merge 3 commits into
strands-agents:mainfrom
trigan:main

Conversation

@trigan
Copy link
Copy Markdown

@trigan trigan commented May 16, 2026

Summary

Adds a new tutorial at samples/python/01-learn/14-plugins/ that introduces the Strands Agents Plugin abstraction. The tutorial fills the empty 14- slot between 13-human-in-the-loop (raw hooks) and 15-skills (which uses a plugin as a black box), so readers progress naturally: hooks → plugins → skills.

What's in the tutorial

A single notebook (plugins-in-strands.ipynb) with five sections plus a recap, covering four plugin concepts:

  1. Raw hooks → Plugin transition — same hook behavior written twice (HookProvider vs Plugin with @hook), with an equivalence assert on captured event sequences.
  2. @tool inside a pluginMetricsPlugin collects per-tool counts via hooks and exposes them through a bundled get_audit_metrics tool the agent can call.
  3. Plugin state and sharing — isolated instances per agent vs one shared instance across agents, plus a "where should this state live?" table covering plugin attrs / agent.state / external store.
  4. Composing multiple pluginsSecurityPlugin → LoggingPlugin → MetricsPlugin stacked in two registration orders, demonstrating that registration order drives execution order and that cancel_tool does not auto-suppress downstream Before* handlers.

Files

  • samples/python/01-learn/14-plugins/README.md — tutorial overview, follows the same heading order as 15-skills and 16-hooks-lifecycle.
  • samples/python/01-learn/14-plugins/plugins-in-strands.ipynb — single end-to-end notebook.
  • samples/python/01-learn/14-plugins/requirements.txtstrands-agents, strands-agents-tools.
  • samples/python/01-learn/README.md — one new index row for 14-plugins.

Tested

  • Notebook runs end-to-end against Claude Haiku 4.5 on Amazon Bedrock with all in-notebook asserts passing.
  • All assertions check plugin-internal state (counters, captured event sequences, self.blocks), never model-generated text — keeps the demos deterministic against a non-deterministic model.

Notes

  • No additional dependencies beyond strands-agents and strands-agents-tools.
  • No AWS services beyond Bedrock.
  • No deployment scripts or cleanup steps.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions
Copy link
Copy Markdown

Latest scan for commit: 45098b1 | Updated: 2026-05-24 20:12:54 UTC

✅ Security Scan Report (PR Files Only)

Scanned Files

  • python/01-learn/14-plugins/README.md
  • python/01-learn/14-plugins/plugins-in-strands.ipynb
  • python/01-learn/14-plugins/requirements.txt
  • python/01-learn/README.md

Security Scan Results

Critical High Medium Low Info
0 0 0 0 0

Threshold: High

No security issues detected in your changes. Great job!

This scan only covers files changed in this PR.

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.

1 participant