Add documentation: Patterns for handling large tool call outputs
Summary
Document recommended patterns for handling large (multi-megabyte) tool call outputs so agent context is not polluted or exhausted.
Related: https://github.com/strands-agents/samples/issues/244
Patterns to document
1. File Reference Pattern
Write large output to disk, return only the file path to the agent. Agent then uses cat, grep, jq etc. to query data lazily.
2. AfterToolCallEvent Hook
Intercept tool results via hooks and truncate/summarize before they enter context.
3. Wrapper/Pipeline Tool
Chain tools internally inside a single tool so only the compact final result enters agent context.
References
- Hooks docs: https://strandsagents.com/docs/user-guide/concepts/agents/hooks/
- Tool Executors: https://strandsagents.com/docs/user-guide/concepts/tools/executors/
In addition to docs that we'll do first, lets also brainstorm around if there is an opportunity to provide constructs in the SDK itself to simplify this kind of pattern.
This will likely be resolved through a context management best practices section after the context management optimization roadmap.
Closing out, considering this done from https://strandsagents.com/docs/user-guide/concepts/plugins/context-offloader/