aws-samples / aws-samples/sample-once-upon-agentic-ai

[Docs/Content] Rewrite Chapter 2: Replace Deprecated Tools with Context Injector Plugin

Open
#45 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
58
Forks
38
PR merge metrics
No merged PRs in 30d

Description

### 📌 Summary
Chapter 2 currently focuses on the legacy Tool mechanism. Because Tools are scheduled for deprecation, Chapter 2 needs to be rewritten from the ground up to feature **Context Injector** (`@strandsagents/context-injector` / plugin pattern) as the recommended way to inject runtime state, metadata, and dynamic memory into agent execution loops.

---

### 🎯 Motivation & Problem Statement
* **Upcoming Deprecation:** The current Tool interface is being phased out in favor of the modular plugin architecture.
* **Developer Confusion:** New users following Chapter 2 are implementing patterns that will require immediate refactoring once the deprecation cycle completes.
* **Alignment with Latest Spec:** The official Strands Agents documentation establishes Context Injector as the core standard for dynamic prompt augmentation and context management.

---

### 🛠️ Proposed Changes

1. **Chapter Title & Scope Update**
* Change title from *Chapter 2: Tools & Function Calling* to *Chapter 2: Context Injectors & Dynamic State*.
* Shift the core architectural focus from static tool invocation to plugin-based context injection.

2. **Core Concepts to Cover**
* What Context Injectors are and where they sit in the agent lifecycle.
* Differences between legacy Tools and Context Injectors (lifecycle hooks, state resolution, execution order).
* Implementing custom Context Injectors via the plugin API.

3. **Code Snippets & Examples**
* Replace all legacy tool registration examples with Context Injector implementations.
* Provide an end-to-end working example showing runtime data injection (e.g., user session, dynamic knowledge retrieval, environment variables).

4. **Migration Callout Box**
* Add a `> ⚠️ **Deprecation Notice**` admonition detailing:
* Deprecation timeline for legacy Tools.
* Direct mapping table: legacy tool patterns vs. new context injector equivalents.

---

### ✅ Implementation Checklist

- [ ] Draft updated outline for Chapter 2.
- [ ] Remove all legacy Tool code samples and references.
- [ ] Write conceptual overview for Context Injectors.
- [ ] Add verified, runnable code examples using the new plugin structure.
- [ ] Add a migration callout section for existing users.
- [ ] Verify all internal links, API references, and external doc links.
- [ ] Update table of contents / navigation sidebar metadata.

---

### 🔗 References & Documentation
* **Official Docs:** [Strands Agents Context Injector Guide](https://strandsagents.com/docs/user-guide/concepts/plugins/context-injector/)
* **Relevant Module:** Plugin Architecture / Lifecycle Hooks

---

### 🏷️ Metadata
* **Type:** `documentation`, `breaking-change`
* **Priority:** `high`
* **Area:** `guides/chapter-2`

Contributor guide

Open the contributing guide

Research direction

Start with the official Context Injector guide and the existing guides/chapter-2 content, then inspect the table of contents or navigation metadata. Rewrite the chapter around the plugin pattern, replacing legacy Tool references with verified examples and adding the migration callout. Done means the chapter, navigation, API references, and internal and external links are updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.