feat(context): add result offload plugin#974
Conversation
|
Assessment: Comment Well-structured plugin with solid error handling, good graceful degradation, and comprehensive test coverage. A few items to address before merging: Review Categories
The plugin design is clean, the graceful degradation on storage failure is well thought out, and the test coverage is thorough across storage backends. |
|
Assessment: Approve All previously raised issues have been addressed well — TSDoc added throughout, the Remaining minor items
Solid work iterating on the feedback — the plugin is in good shape. |
|
Assessment: Approve All feedback from previous review rounds has been addressed. The code is clean, well-documented, and thoroughly tested. No remaining issues — ready to merge. |
|
Assessment: Approve No changes since last review. All previously identified issues have been resolved across three review rounds. The PR is ready to merge. |
|
Assessment: Approve The new commit cleanly removes the One note: the PR description's "Known limitations" section still references the cast workaround and links to #938. Consider updating it since that limitation is now resolved. |
48639b3
Description
TypeScript port of sdk-python#2162 and sdk-python#2222. Adds a
ContextOffloaderplugin that proactively intercepts oversized tool results viaAfterToolCallEvent, stores them in an external storage backend, and replaces the in-context result with a truncated preview plus per-block storage references.What it does:
model.countTokens()(same approach as Python'scount_tokens)maxResultTokens(default: 2,500), offloads each content block to storageretrieve_offloaded_contenttool by default so the agent can fetch full content on demand (can be disabled viaincludeRetrievalTool: false)s3://URIs — so agents can use existing tools (file_read, bash) directlyIncludes:
Storageinterface withInMemoryStorage,FileStorage, andS3Storageimplementations (mirrors all three Python backends)ContextOffloaderplugin implementing thePlugininterfaceUsage:
Related Issues
Documentation PR
strands-agents/docs#772 (Python docs — TS docs TBD)
Type of Change
New feature
Testing
How have you tested the change?
npm run checkChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.