Building Multimodal Agents in Practice: Architecture, Evaluation, and Cost Control

    This article explains how to build multimodal agents that can perceive an interface and then complete tasks, rather than merely describe images. It covers the difference between descriptive and execution-oriented vision, why text reasoning must stay at parity, which evaluation layers matter, and how to control the most overlooked cost driver: images being billed repeatedly. It also outlines a six-layer reference architecture, practices for using experimental models safely, and typical scenarios such as travel planning, front-end recreation, operations troubleshooting, and form processing.

    1. The Starting Problem: Agents Don’t Lack a “Mouth,” They Lack “Eyes”

    Over the past two years, the capability boundary of large language models has kept expanding. Yet in real business scenarios, agents often get stuck in an awkward position: they can write code, look up information, and break down tasks, but they cannot see the buttons on a screen, read the error in a screenshot, or understand the table structure of a scanned document. Once a task requires “perceive the interface first, then operate the tools,” a text-only model has to rely on a human to transcribe visual information into text, and the chain is effectively cut.

    So the direction of recent technical progress is becoming clear: multimodal capability is not a showcase feature for agents, but necessary infrastructure for closing the perception loop. Using “giving agents eyes” as the general technical thread, this article discusses how to build a multimodal agent that is executable, evaluable, and ready for production at relatively low cost.

    2. Capability Positioning: From “Describing an Image” to “Finishing the Job After Looking”

    2.1 Two Fundamentally Different Capabilities

    • Descriptive visual capability: input an image, output a natural language description; evaluated by similarity, coverage, and human preference.
    • Execution-oriented visual capability: input an image plus a task goal, output an executable action sequence or structured artifact; evaluated by whether the task is completed.

    The latter requires three things at once: locating visual elements, cross-modal semantic alignment, and long-chain planning with self-correction. Only when these three stack up does an agent have the foundation to keep working in the real world.

    2.2 Why Text Capability Must Hold the Line

    A common misconception is that adding a vision module dilutes language ability. The safer engineering approach is an explicit constraint: the multimodal version should stay on par with the text version of the same series in general text understanding and reasoning, with vision added only as an increment. This keeps existing pipelines from regressing and avoids the negative transfer of “losing the ability to work in exchange for the ability to see.”

    3. Evaluation: Which Metrics Actually Matter

    Evaluating a multimodal agent should cover at least three layers:

    1. Basic perception: accuracy of image element recognition, text extraction, and layout reconstruction.
    2. Single-step decision: given an interface screenshot, can it select the correct next action.
    3. Long-horizon execution: in complex tasks such as terminal operation and software engineering changes, can it hold the goal without drift over dozens of steps.

    Two high-value public benchmarks correspond exactly to the third layer: one measures an agent’s ability to complete end-to-end tasks in a command-line environment, the other measures the engineering ability to locate and fix issues in real code repositories. In such evaluations, introducing visual information mainly solves the “environment state reading” problem — reading terminal output, recognizing error dialogs, parsing page layout — so the agent can keep moving without human intervention.

    One point deserves emphasis: scores close to top closed-source models do not mean you can copy the setup into production. Evaluation environments and real business differ enormously in tool sets, permissions, and data distribution, so metrics should only serve as reference coordinates.

    4. Cost Structure: The Bill Multimodal Teams Most Often Miss

    Cost overruns in multimodal applications usually come not from high unit prices but from “images being billed repeatedly.” Engineering needs three gates:

    • Input-side compression: lower resolution while keeping text legible, choose precision dynamically by content complexity, and avoid sending full-resolution images directly.
    • Vision token budget: set an explicit cap per image, converting images into a controllable token allowance instead of unconstrained pass-through.
    • Caching and deduplication: hash the content of the same screen or the same document page, and reuse on a hit instead of parsing again.

    Illustrative budget control logic (pseudocode, expressing the idea only):

    1. def build_vision_request(image, task, max_image_tokens=384):
    2. img = resize_keep_text_legible(image, budget=max_image_tokens)
    3. if cache_hit(hash(img), task.type):
    4. return cache_get(hash(img), task.type)
    5. return {
    6. "messages": [
    7. {"role": "system", "content": TASK_PROMPT[task.type]},
    8. {"role": "user", "content": [
    9. {"type": "image", "data": img},
    10. {"type": "text", "text": task.instruction}
    11. ]}
    12. ],
    13. "max_image_tokens": max_image_tokens
    14. }

    Combined with a tiered model strategy — lightweight models for simple perception, stronger models for complex planning — the unit cost per task typically drops by an order of magnitude. If you use general-purpose object storage on the cloud to keep intermediate screenshots, a message queue to smooth peaks, and logging plus monitoring with alerts to track per-step latency and token consumption, cost attribution becomes far clearer.

    5. Reference Architecture: A Deployable Multimodal Agent Loop

    1. Perception layer: screenshot capture, document parsing, image preprocessing and compression.
    2. Memory layer: structured storage of task state, completed actions, and failure reasons.
    3. Planning layer: decompose the goal into subtasks, generate and rank action candidates.
    4. Execution layer: operate the terminal, browser, file system, or internal APIs through tool calls.
    5. Verification layer: read back environment state after each step, judge whether the expected result was reached, and roll back and retry on failure.
    6. Observability layer: full-chain tracing, cost accounting, and quality spot checks.

    The key design principle is “look once, act many steps”: vision calls happen only when the environment state changes materially, and the remaining steps advance on text reasoning. This is the core lever for controlling both latency and cost.

    6. How to Use Experimental Models Properly

    A model marked experimental usually means its interface and behavior may change, and no complete technical report is available. Prudent practices include:

    • Abstract a model adapter layer that gathers prompts, parameters, and parsing logic in one place for quick replacement.
    • Build an offline evaluation set and a regression pipeline that automatically runs long-horizon tasks on every version switch.
    • Keep a fallback in the production path; validate experimental models with canary and shadow traffic first.
    • Output structured results (such as a unified action protocol) to reduce dependence on a specific model’s output style.

    7. Typical Scenarios

    • Road trip planning: read map screenshots and user annotations, then produce a paginated document with route, itinerary, and budget.
    • Front-end page recreation: parse the visual elements and layout hierarchy of a reference page and generate runnable front-end code.
    • Operations troubleshooting: recognize monitoring dashboards and terminal errors, search the knowledge base automatically, and propose repair actions.
    • Invoice and form processing: reconstruct the layout and write directly into business systems instead of only outputting a text summary.

    8. Conclusion

    The competitive focus of multimodal agents has shifted from “can it describe an image” to “can it keep completing tasks based on images,” and the key variables for scaling are unit task cost and engineering controllability. The practical advice for developers is clear: hold the line on text capability, treat vision as an environment perception channel, compress cost with token budgets, caching, and tiered models, and isolate experimental-model risk with an adapter layer and regression evaluation. If you need elastic compute plus supporting data, storage, and monitoring capabilities, you can build on the relevant general-purpose product categories from Baidu AI Cloud, so you can focus your attention on task design and quality tuning.