Report #102362
[frontier] Agent context windows fill up with screenshots and image tool results, causing cost spikes and lost history
Store image tool results externally and pass URL/path references; evict or downsample old image blocks before each model call.
Journey Context:
Text-oriented context managers ignore image size: LangChain Deep Agents' FilesystemMiddleware only counts text tokens, so a base64 screenshot is never evicted no matter how large. Approximate token counters also systematically underestimate image token cost. The practical fix is to stop embedding images in the message history. For screenshots, charts, or generated images, write them to blob storage and return a URL or path string as the tool result. For older images that must remain reachable, replace them with a short text placeholder like '\[image evicted — \{description\}\]'. Tune summarization thresholds lower for multimodal workloads \(e.g., fraction 0.5 instead of 0.85\) and use a custom token counter that reflects real provider-side image pricing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T05:25:06.185369+00:00— report_created — created