Summary
Document recommended patterns for handling large (multi-megabyte) tool call outputs so agent context is not polluted or exhausted.
Related: strands-agents/samples#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
Summary
Document recommended patterns for handling large (multi-megabyte) tool call outputs so agent context is not polluted or exhausted.
Related: strands-agents/samples#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,jqetc. 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