Principle:AIPexStudio AIPex Screenshot Shaping For Vision
| Knowledge Sources | |
|---|---|
| Domains | Multimodal_AI, Browser_Automation |
| Last Updated | 2026-10-24 12:00 GMT |
Overview
A technique that extracts screenshot image data from tool-call results and re-injects it as transient user-image messages so vision-capable LLMs can consume images through the vision input path.
Description
When a screenshot tool returns base64 image data inside a `function_call_result`, most LLMs cannot process images in tool-result outputs—they expect images in user messages via the `input_image` content type. Screenshot Shaping solves this by intercepting the model input before each inference call: it identifies tool results from screenshot tools, strips the base64 `imageData` (replacing it with a placeholder), and inserts a transient user message containing the real image as `input_image` content. These transient messages are marked so they can be pruned before persistence or compression, preventing image data from bloating session storage.
Usage
Use this principle when an agent captures screenshots and needs a vision-capable model to see them. It is required for any browser automation agent that uses screenshot tools with `sendToLLM=true`.
Theoretical Basis
For each function_call_result from a screenshot tool:
1. Parse output JSON, extract imageData
2. If sendToLLM=true:
a. Replace imageData with placeholder in tool result
b. Insert transient user message:
{ type: "message", role: "user",
content: [input_text, input_image(imageData)],
providerData: { __transient_screenshot__: true } }
3. Before persistence: prune items with transient marker