From Reading Files to Writing Code: Engineering Multimodal Agents

    Multimodal agents become useful only when they move beyond localized answers and deliver verified task outcomes. This article outlines an engineering approach built around three layers: perception and understanding, reasoning and planning, and action and verification. It covers structure-preserving parsing and evidence records for heterogeneous inputs, context and task-state management, controlled tool invocation, a verification loop for coding agents, boundary setting for multi-agent collaboration, a four-dimensional evaluation framework, and a phased enterprise adoption path. The focus is on evidence, permissions, execution state, and acceptance mechanisms so that automation can scale with verification rather than with the number of files or tools.

    1. From Answering Questions to Completing Tasks Requires a Different System Design

    A business analysis task may include multiple spreadsheets, dozens of documents, and meeting recordings at the same time. What the user ultimately needs is not a few summaries, but an analysis report with consistent data definitions, traceable evidence, and reviewable conclusions. Software development is similar: understanding requirements is only the starting point. Real delivery also includes locating code, implementing changes, running tests, explaining risks, and organizing change records.

    These tasks share common characteristics: heterogeneous inputs, interdependent steps, and more than one completion criterion. Even if a model can answer a local question correctly, that does not mean it can reliably complete the entire chain.

    When discussing multimodal agents, it is therefore useful to distinguish three layers:

    The first layer is perception and understanding: whether the system can accurately extract information from text, tables, figures, and audio.

    The second layer is reasoning and planning: whether it can identify task constraints, establish evidence relationships, and arrange a reasonable execution order.

    The third layer is action and verification: whether it can operate the environment through controlled tools, adjust the plan based on execution results, and prove that the final artifact meets the requirements.

    A reliable system must connect these three layers. It cannot treat “generated an answer” as equivalent to “completed the work.”

    2. Multimodal Data Processing: Preserve Structure First, Then Organize Evidence

    Different input types need different parsing paths

    Important information in a spreadsheet is not limited to the numbers in cells. It also includes header hierarchy, formula dependencies, hidden regions, units, and time ranges. Simply converting an entire sheet into continuous text can easily break existing relationships and cause the model to confuse metrics and dimensions.

    Layout-rich documents require attention to reading order, section hierarchy, page numbers, footnotes, and figure-text correspondences. For scanned documents, OCR errors should also be considered. For engineering drawings and complex charts, image regions should be preserved, and visual analysis should be used when necessary rather than relying only on extracted text.

    Audio and video require a different focus. Speech transcription should preserve timestamps, speaker distinctions, and unintelligible segments as much as possible. For video, key frames should be associated with the corresponding speech to avoid stitching events from different times into an incorrect conclusion.

    These processing steps do not guarantee that the content is accurate, but they provide the necessary foundation for later verification.

    Establish a unified evidence record

    After multiple types of material enter the system, they should be converted into evidence units that carry source information. Each record should include at least:

    • Source file and version;
    • Page number, worksheet, cell range, or time position;
    • Extracted content and its structural type;
    • Extraction method and issues requiring review;
    • Relationships with other evidence.

    For example, a cost data item may come from a spreadsheet, while the expense definition may come from meeting minutes. The system should explicitly record the correspondence between the two rather than merging them directly based on semantic similarity when generating a report.

    When materials conflict, the conflict should be preserved and verified according to business rules. A document should not be treated as more authoritative on every issue merely because it was updated later.

    3. Long Context Is Not a Substitute for Data Management

    A larger context window allows a model to reference more material at once, but it does not mean that every detail will be used with equal accuracy. Duplicate content, irrelevant attachments, and conflicting versions can all reduce reasoning quality.

    A more reliable approach is to organize materials into three layers.

    The first layer is the raw material layer, which stores complete files as the final basis for traceability.

    The second layer is the structured index layer, which records sections, tables, image regions, key entities, and citation locations to support on-demand lookup.

    The third layer is the task working set, which provides only the materials needed for the current step, explicit constraints, and confirmed intermediate results.

    During execution, the system should also maintain a task state that records the current goal, completed steps, open issues, key decisions, and artifact locations. This reduces repeated reading and makes it easier to resume after an interruption.

    Note that compressed summaries may lose conditions or qualifiers. For high-risk information such as amounts, dates, formulas, and contract clauses, the original evidence should be checked rather than treating the summary as the sole basis.

    4. Tool Calls: Turning Model Intent into Controlled Operations

    Tools allow agents to read files, perform calculations, modify code, and generate deliverables, but they also introduce new risks. An operation plan produced by a model is not inherently correct or authorized for execution.

    A complete call process should include:

    Task intent recognition → parameter validation → permission check → controlled execution → result parsing → state update.

    Tool return values should distinguish between execution success, empty results, insufficient permissions, invalid input, and temporary failures. Otherwise, the model may misinterpret “no permission to read” as “the file does not exist” and make further incorrect decisions.

    Operations with side effects require additional controls. For example, batch overwriting files, deleting data, or sending content externally should require human confirmation according to risk level. Retry mechanisms also cannot be treated uniformly: read-only queries are usually easy to retry, while write operations must consider whether repeated execution will create duplicate records or corrupt data.

    In addition, external documents, web pages, and tool-returned content should all be treated as data to be analyzed, not as new system instructions. Even if material contains text asking to upload files, disable checks, or leak credentials, it must not be allowed to change permission boundaries.

    5. Coding Agents: Replace One-Shot Generation with a Verification Loop

    The most common mistake in coding tasks is treating “the code looks reasonable” as “the change is complete.” In real projects, cross-file dependencies, configuration constraints, and runtime environments all affect the result.

    A more reliable execution flow can be divided into six steps.

    1. Define acceptance criteria

    Before making changes, confirm the expected behavior, inputs and outputs, compatibility requirements, and areas that must not be changed. If a defect cannot be reproduced reliably, record the symptoms and conditions first, and avoid broad rewrites based on an unclear problem.

    1. Establish a baseline

    Run existing checks to distinguish pre-existing issues from issues introduced by the current change. Without a baseline, it is difficult to determine responsibility even when failures appear later.

    1. Locate the smallest relevant area

    Narrow the scope using directory structure, references, error messages, and test results. Reducing irrelevant file reads helps control cost, but key dependencies must not be missed.

    1. Implement the smallest sufficient change

    Prioritize fixing the root cause and keep interfaces and behavior boundaries clear. Functional fixes and large-scale refactoring should usually be handled separately to support review and rollback.

    1. Verify in layers

    Run checks directly related to the change first, then expand to integration tests and regression tests according to the impact scope. If a check cannot be executed, state the reason and remaining risk clearly. “Theoretically workable” cannot replace a verification conclusion.

    1. Produce a delivery record

    The final explanation should include the modification goal, affected scope, verification performed, uncovered scenarios, and rollback method. Only when this information is complete can users judge whether the change is ready for merge or release.

    6. Multi-Agent Collaboration: Define Boundaries Before Parallelizing

    Multi-agent setups are suitable for scenarios where tasks can be divided, inputs are relatively independent, and results can be clearly accepted. For example, one role analyzes requirements, one reviews the design, and another handles implementation and testing within a limited scope.

    However, more roles do not necessarily produce higher efficiency. Sharing the same set of files, repeatedly reading the same materials, and interpreting interfaces differently all increase coordination cost.

    In practice, a structure of “unified coordination, divided execution, and centralized verification” can be used:

    The coordinating role maintains task decomposition, common constraints, and dependencies. Execution roles handle only explicitly authorized scopes. Review roles check interface consistency, evidence completeness, and verification results.

    When modifying shared code in parallel, workspaces should be isolated as much as possible, and interfaces and file ownership should be agreed in advance. The fact that multiple roles agree on the same conclusion does not mean the conclusion is correct. If they rely on the same erroneous input, they may still form a consistent misjudgment. Final verification must therefore return to tests, original evidence, and business rules.

    7. Evaluation: Do Not Rely on a Single Score

    Agent performance is the result of the model, tool environment, task instructions, and execution strategy working together. In different environments, even the same underlying model may have different completion rates. Therefore, a ranking alone cannot determine whether an agent is suitable for enterprise workflows.

    It is advisable to build an evaluation system covering four dimensions.

    Quality: whether the task is completed, whether conclusions are supported by evidence, whether key numbers are correct, and whether code passes necessary verification.

    Efficiency: end-to-end time, number of repeated reads, proportion of invalid calls, and total resource consumption per successful task.

    Reliability: whether repeated execution of the same task is stable, whether the system can recover from tool failures, and whether it can continue after an interruption.

    Security: whether unauthorized access, sensitive information leakage, dangerous writes, or bypassing of confirmation mechanisms occurs.

    The test set should include normal samples as well as abnormal cases such as corrupted files, missing fields, contradictory materials, tool timeouts, and insufficient permissions. Beyond average performance, high-risk tasks and failure cases should be analyzed separately to prevent aggregate metrics from hiding serious problems.

    8. Enterprise Adoption: Build a Traceable Loop First, Then Expand Autonomy

    In the early stage, it is more appropriate to choose tasks with clear scope and strong reversibility, such as internal material organization, report draft generation, code change suggestions, and automated test supplementation. For operations such as data deletion, production configuration changes, and external publishing, stricter authorization and approval should be maintained.

    Before data enters the workflow, permission mapping, sensitive information identification, and necessary redaction should be completed. During execution, the system should save operation traces, input versions, tool results, and human approval records, while avoiding writing plaintext credentials or unnecessary sensitive content into logs.

    When a task fails, the system should still deliver a valuable state: which steps have been completed, which evidence has been confirmed, where the failure occurred, and what conditions are needed to continue. An explainable, recoverable failure has more engineering value than a “success report” that hides uncertainty.

    The capability that truly matters for multimodal agents is not how many files they can read or how many tools they can call, but whether they can turn heterogeneous materials into verifiable actions and artifacts under explicit constraints. For developers and enterprises, systems should be built around evidence, permissions, execution state, and acceptance mechanisms, allowing automation to grow as verification becomes more sufficient.