# Visual Input for Multimodal AI Agents: From Understanding Images to Completing Tasks

    This article explains why AI agents need visual input, how a perceive-plan-act-verify loop works, how to estimate image token costs, how to evaluate experimental multimodal models, and what to check before putting a visual agent into production.

    1. Why Agents Need Visual Capabilities

    Text-only agents can only process information that has already been converted into text. Much information exists only as images: web page screenshots, device dashboards, table photos, interface mockups, and receipts photographed in the field. If an agent cannot read an image directly, the workflow needs an extra optical recognition step or manual data entry. Each step adds errors and delay.

    Multimodal capability shortens this pipeline. The model can extract structured information directly from an image and pass the result to later reasoning and tool-calling steps. This matters most for long-running tasks, because information loss at each intermediate step accumulates in the steps that follow.

    It is useful to separate two kinds of capability. The first is “answering about images,” where the model describes a single image or answers questions about it. Evaluation focuses on recognition accuracy. The second is “acting on images,” where the agent reads the screen, repeatedly calls tools, changes state, and verifies results until the task is complete. Evaluation of this capability focuses on task success rate, step efficiency, and error recovery. A model that scores well on image question answering may not work reliably across multi-step operations.

    2. The Perception, Planning, and Execution Loop

    A reliable visual agent typically includes four stages.

    1. Perception: Capture a screenshot or image and encode it as input the model can process.
    2. Understanding: Extract the elements relevant to the task, such as button positions, error messages, and data fields.
    3. Planning: Decide the next action based on the goal and the current state.
    4. Execution and verification: Call a tool to perform the action, then take another screenshot or read the result to confirm the state matches expectations.

    The fourth stage is the one most often overlooked. Many failures do not come from recognition. They come from actions that were never verified after execution. The agent assumes the operation succeeded and continues from a wrong state. In engineering practice, each critical action should have preconditions and postcondition checks. For example, after clicking a button, check whether the page title changed. After submitting a form, check the returned status code.

    The simplified loop below shows how perception, planning, execution, and verification relate to each other. The interfaces are illustrative. For actual calls, follow the documentation for the service you use.

    1. def run_visual_agent(task, client, tools, max_steps=20):
    2. history = []
    3. for step in range(max_steps):
    4. screenshot = tools.capture_screen()
    5. observation = {
    6. "task": task,
    7. "image": screenshot,
    8. "history": history[-5:], # Keep only the most recent steps to control context length
    9. }
    10. action = client.plan(observation) # The model outputs the next action
    11. if action["type"] == "finish":
    12. return action.get("result")
    13. ok, detail = tools.execute(action)
    14. verified = tools.verify(action, expected=action.get("expected"))
    15. history.append({"action": action, "ok": ok, "verified": verified, "detail": detail})
    16. if not (ok and verified):
    17. history.append({"note": "Action failed verification. The next step needs to re-plan."})
    18. raise RuntimeError("Maximum number of steps exceeded without completing the task")

    This code reflects three engineering principles. First, the history keeps only what is necessary, so the context does not grow without limit as steps accumulate. Second, each step produces two layers of feedback: an execution result and a verification result. Third, the loop sets a maximum step count to stop the agent from getting stuck in a cycle and consuming resources indefinitely.

    3. A Cost Model for Image Input

    The cost of a multimodal request is typically determined by both text tokens and image tokens. Image billing varies by service, but most services first resize the image and then split it into blocks of a fixed size. Each block maps to a set number of tokens. Larger images consume more tokens. Many services also cap the tokens for a single image, and anything beyond that cap may be compressed or ignored.

    To estimate image cost, you can use the following approach:

    1. import math
    2. def estimate_image_tokens(width, height, patch=32, max_tokens=384):
    3. # Illustrative estimate. Actual tiling rules and limits follow the provider's documentation.
    4. cols = math.ceil(width / patch)
    5. rows = math.ceil(height / patch)
    6. return min(cols * rows, max_tokens)
    7. def estimate_cost(text_in, image_tokens, output_tokens, price_in, price_out):
    8. # Price unit: amount per million tokens
    9. total_in = text_in + image_tokens
    10. return total_in / 1e6 * price_in + output_tokens / 1e6 * price_out

    The patch and max_tokens values are only examples. In practice, calibrate the estimation model against the usage data returned by actual requests rather than relying on the formula over time. Another useful practice is to crop unrelated areas during preprocessing, keeping only the parts relevant to the task, and reduce the resolution to the minimum that still meets recognition needs.

    Cost also depends on how often calls are made. A visual agent may attach a new screenshot at every step, so a 20-step task produces 20 image inputs. When planning, first estimate the average number of images per task, multiply by the tokens per image to get the image cost per task, and then multiply by the expected task volume.

    4. How to Evaluate Experimental Multimodal Models

    Evaluation should start from business tasks, not only from public leaderboards. Public benchmarks have reference value, but their task construction, scoring criteria, and runtime environment may not match a specific use case.

    The following steps are recommended.

    First, compile real tasks. Select 20 to 50 representative tasks from the business. Cover common paths and edge cases, and define an automatically checkable success criterion for each task.

    Second, fix the runtime environment. Use the same set of screenshots, the same tools, and the same temperature and retry settings. Otherwise, differences between two runs may come from environment variation rather than model capability.

    Third, record multiple metrics. Besides success rate, track the average number of steps, time per task, cost per task, and the distribution of failure types. Failure types matter most. Recognition errors, incorrect action parameters, missing verification, and loops each require different fixes.

    Fourth, analyze stability. Run the same task several times and observe how much the results vary. A model with a high average success rate but large variance can cause unpredictable failures in production.

    5. Production Risks of Experimental Versions

    Experimental versions often mean that interfaces may change, behavior may be adjusted, and documentation may be incomplete. Before deciding whether to adopt one, confirm the following points.

    • Has the provider stated its stability commitments and how it notifies users of changes?
    • Is there sufficiently detailed technical documentation that explains how the model behaves in edge cases?
    • Is the output format stable enough to pass structured validation?
    • If quality regresses, can you quickly switch to a validated fallback model?

    A safer approach is to limit experimental versions to low-risk scenarios, such as internal productivity tools, offline batch processing, or workflows where results are reviewed by a person. Keep a well-tested stable model as the fallback path, and manage the model identifier as a configuration setting rather than hardcoding it in business code.

    Low-cost or free access options are suitable for early validation, but they require attention to data retention and privacy policies. When the input includes sensitive content, such as user screenshots, financial receipts, or medical images, complete data desensitization first and confirm the provider’s data usage terms.

    6. Engineering Checklist for Launch

    Before a formal launch, check each item below.

    1. Define the task scope and success criteria, and make sure a script can judge success automatically.
    2. Set preconditions and postcondition verification for every action.
    3. Set limits on the maximum number of steps, the budget per task, and the timeout.
    4. Build an image preprocessing pipeline that includes cropping, resizing, and masking of sensitive information.
    5. Log the token usage, latency, and action records for each request to support later review.
    6. Store the model identifier and pricing parameters in configuration so you can switch or roll back quickly.
    7. Design a human takeover mechanism that pauses the agent and requests confirmation after repeated failures or before high-risk operations.

    7. Summary

    Visual capability moves an agent from understanding an image to completing a task based on that image. The value of this shift can be measured by task success rate, the number of human interventions, and processing time. Multi-step execution also raises the cost of errors, so verification, cost control, and fallback plans need to be designed alongside the model’s capabilities. For models still in the experimental stage, a reasonable strategy is to run small-scale pilots to collect real data, then decide whether to expand usage based on business metrics.