Same LLM, Different AI Agents: Why Results Diverge and What Engineering Makes the Difference

    An agent's performance is not determined by the model alone. This article explains why the same LLM behaves differently inside different agent frameworks, examining how context organization, tool design, state management, validation, and stopping strategies shape task outcomes. Through a code-fixing walkthrough and a set of evaluation criteria, it shows what engineering mechanisms—deterministic workflows, permission boundaries, idempotent operations, and auditable traces—turn a model's generation ability into reliable execution.

    Same LLM, Different AI Agents: Why Results Diverge and What Engineering Makes the Difference

    1. Models Are Getting Better—So Why Do We Still Need Agents?

    As large language models improve, the scope of what a single generation can cover keeps expanding: from completing a few lines of code to generating full functions; from answering a factual question to producing an analysis report based on multiple documents. However, “producing a more complete output in one pass” and “reliably completing an entire task” are not the same thing.

    For example, asking a model to explain a piece of code usually requires nothing more than providing the code and the question, then checking whether the answer is correct. But asking it to fix a bug in a real system requires locating relevant files, understanding dependencies, identifying the root cause, modifying code, running verification, and handling new problems that emerge when verification fails.

    The former mainly tests the model’s input understanding and generation ability. The latter simultaneously tests the execution environment, information organization, and process control.

    So a stronger model does not mean the surrounding system matters less. Quite the opposite: when models take on more complex tasks, the system must solve a growing set of problems beyond generation:

    • Which information should the model retrieve first?
    • Which operations can be executed directly, and which require authorization?
    • How should results produced across multiple rounds be persisted?
    • How do you determine that a task is actually complete, rather than the model believing it is complete?
    • If an operation fails, should the system retry, adjust the approach, or stop and escalate to a human?

    The value of an agent lies in organizing the model’s local capabilities into a process that can advance continuously, be checked, and be recovered.

    One common misconception should be corrected here: an explanation, summary, or step-by-step narrative produced by the model is not a faithful representation of its internal reasoning, nor can it substitute for external verification. In engineering systems, trustworthy evidence comes from file changes, tool returns, test results, and traceable execution records.

    2. One Dish vs. a Full Meal: The Structural Gap Between Generation Tasks and Execution Tasks

    Think of an LLM as a skilled chef.

    If the task is simply to cook one dish, the inputs are relatively clear: ingredients, recipe, taste requirements. The output is also focused: one finished dish. As long as you check the dish against the requirements, you can evaluate the operation.

    But organizing a full meal means handling orders, preparation, cooking order, dietary restrictions, serving rhythm, and checkout. A missing ingredient for one dish can affect the whole menu; a last-minute change from a guest may force downstream steps to be rescheduled.

    The core difference between these two kinds of tasks is not just scale—it is dependencies and state changes.

    1. Single-point tasks focus on local output

    The typical pattern is:

    Input → model generation → check the result

    The model does not necessarily need to operate on an external environment or maintain state across multiple rounds. When generation fails, you can usually adjust the prompt and try again.

    2. Long-horizon tasks focus on sustained execution

    The typical pattern is:

    Understand the goal → gather information → decide the next step → execute an operation → check feedback → update state → continue or finish

    Every step here can change the facts that subsequent decisions depend on.

    For instance, after a code change, the original file contents no longer represent the current state. After a test fails, the next actions should be based on the new error information, not the original plan.

    An agent, therefore, is not simply “asking the model to answer a few more times.” It is a control loop that runs on environmental feedback. The model can participate in planning and decision-making, but responsibilities such as state persistence, permission checks, and operation execution typically belong to deterministic program components.

    3. Why Does the Same Model Produce Different Task Performance?

    Think of agent performance as the combined result of multiple factors:

    Task performance depends on model capability, input quality, tool availability, workflow design, validation strength, and resource and permission constraints.

    This is not a formula for computing a score. It is a reminder that the model is only one part of the system. If any critical link fails, even a strong model may fail to deliver reliable results.

    1. Different context means the model sees a different “problem”

    Given the same bug, if one agent supplies only the error message while another also provides the relevant functions, call relationships, configuration, and recent changes, the model is effectively facing two different information conditions.

    Context organization should not aim for “more is better.” It should aim for relevance, accuracy, and timeliness.

    Large amounts of irrelevant material dilute key evidence; outdated files can induce wrong judgments; when conclusions from different phases are mixed together, the model may treat invalidated assumptions as facts.

    A more reasonable approach is to manage information in layers:

    • Goals and constraints: what needs to be accomplished, and which actions are forbidden.
    • Verified facts: file contents, test results, tool feedback.
    • Current hypotheses: unconfirmed cause analysis and candidate solutions.
    • Execution log: what has been done, and with what results.
    • Open items: problems that remain to be solved.

    In particular, avoid automatically promoting “the model once said this” to “the system has proven this.”

    2. Different tool interfaces mean different action reliability

    A tool is not just a name in a list—it is the operational boundary through which the model affects the external environment.

    A vague “modify file” capability and one that requires explicitly specifying the file, checking the original contents, applying the change, and returning the actual diff can differ dramatically in reliability.

    Well-designed tools make the operation target, input constraints, and return values clearly inspectable. For example:

    • Read operations return the actual contents plus necessary location information.
    • Modify operations are restricted to authorized directories and files.
    • Verification operations return success status, failure reasons, and relevant output.
    • Failures clearly distinguish insufficient permissions, invalid input, execution errors, and timeouts.

    Tool granularity also requires trade-offs. Tools that are too fine-grained increase call overhead; tools that are too coarse hide intermediate state and magnify the blast radius of errors. A reasonable goal is that every operation has a clear purpose, clear boundaries, and a verifiable result.

    3. Different state management means different continuity in long tasks

    Do not entrust all task state to the conversation history.

    As execution rounds grow, the conversation may be truncated or summarized; the model may also ignore early constraints or repeat steps that have already been completed. A more reliable design is to persist key state as structured records.

    For example, a code-fixing task might record:

    • The current goal and acceptance criteria;
    • Files already inspected;
    • Changes already made;
    • Verification already run;
    • Unresolved issues;
    • Items requiring human confirmation.

    State updates should also reflect changes in fact. For example, if a file modification succeeds but verification fails, the task should be in a “needs fixing” state—not “completed.”

    4. Different feedback and validation mean different error accumulation

    If an agent relies only on the model “checking its own work,” the checking process may still share the original misunderstanding. The model believing the code is correct does not mean the code has passed verification.

    More valuable feedback comes from independent evidence: program execution results, rule checks, test output, data constraints, and human confirmation.

    Validation should also cover multiple levels:

    • Structural correctness: output format, fields, and types meet requirements.
    • Execution correctness: operations actually succeeded, rather than merely generating suggested operations.
    • Behavioral correctness: results satisfy business rules and acceptance criteria.
    • Contained impact: no unauthorized modifications or obvious irrelevant changes were introduced.

    An agent that can detect failure and adjust in time is often more reliable than one that always delivers confident answers.

    5. Different stopping strategies mean different quality and cost

    Stopping too early leaves unverified half-finished work; having no stopping condition leads to endless revision, repeated queries, or futile retries.

    Reasonable stopping conditions should include at least:

    • Acceptance criteria have been met;
    • Required information is missing and needs to be supplied by the user;
    • An operation requires further authorization;
    • Consecutive failures with no new, valid evidence;
    • Time, call-count, or cost budgets have been exhausted.

    “Autonomous execution” does not mean “unlimited execution.” Recognizing its own boundaries and handing control back at the right moment is also part of an agent’s capability.

    4. A Code-Fixing Example: Two Ways of Executing the Task

    Suppose a user says: “Fix a calculation error caused by a boundary condition in an input.”

    Approach 1: Directly generate a fix suggestion

    The agent passes the problem description to the model; the model outputs a cause analysis and patched code, and the task is declared complete.

    This may work for teaching demos or local suggestions, but in real engineering it has obvious gaps:

    • The target function was never confirmed to be the source of the bug;
    • Callers’ reliance on the return value was never checked;
    • Whether the change was actually written to the file was never confirmed;
    • Whether the boundary condition was actually fixed was never verified;
    • Whether normal inputs were affected was never checked.

    Approach 2: Execute around acceptance criteria

    A more reliable process can be broken into six steps.

    Step 1: Define acceptance criteria.
    Determine what the abnormal input is, what the expected result is, and which existing behaviors must not change. If the user’s description is insufficient, gather more information first instead of guessing requirements.

    Step 2: Collect relevant evidence.
    Read the relevant implementation, call sites, and existing test material to build the necessary context. There is no need to load the entire codebase indiscriminately.

    Step 3: Form a falsifiable hypothesis.
    State the suspected location of the error, and what result would support or refute that judgment. Hypotheses should remain revisable, not be treated as established facts.

    Step 4: Make the minimal necessary change.
    Keep the change scope as small as possible and avoid casually refactoring unrelated code. Check the file state before modifying, and review the actual diff afterward.

    Step 5: Run verification and handle feedback.
    Verify the target boundary first, then check the related normal paths. If verification fails, distinguish between an ineffective fix, an introduced regression, or a problem with the verification environment itself.

    Step 6: Deliver based on evidence.
    Describe what was changed, which verifications were completed, what remains unverified, and the possible risks. Do not present “no errors were observed” as “all cases have been proven correct.”

    The same model tends to perform better under the second process because the system provides better information, clearer operational boundaries, and more reliable opportunities for correction. This does not mean more steps are always better—each step should serve to reduce real uncertainty.

    5. What Engineering Mechanisms Does a Reliable Agent Need?

    1. Separate deterministic processes from model decisions

    Operations that can be completed with explicit rules should not all be handed to the model.

    Permission checks, parameter validation, state persistence, and budget accounting are well suited to stable programmatic execution. Models are better suited to semantic understanding, synthesizing complex information, and judgments whose rules cannot be exhaustively enumerated.

    For tasks with fixed workflows, adopt a workflow-first approach with the model involved only in specific steps; for tasks with uncertain paths, give the model more latitude in choosing the next action.

    2. Define authorization boundaries for high-risk operations

    Querying data and deleting data carry different risks; reading a file and publishing a change likewise differ.

    Risks should be tiered by operational impact, accessible resources should be restricted, and irreversible or high-impact actions should require human confirmation. Content coming from web pages, documents, or tool returns should be treated as data to be processed—not automatically elevated into high-priority instructions that control system behavior.

    3. Design recovery paths for failure

    Retries only apply to failures that may be transient. For invalid parameters, insufficient permissions, or logic defects, repeated execution is usually pointless.

    Operations with external side effects must also consider idempotency: when the same request is submitted twice, it should not produce accidents like duplicate deductions, duplicate creation, or duplicate sends.

    Note that external operations cannot always be truly rolled back. In some scenarios only compensating actions are possible, so it should be determined in advance which operations are reversible and which require human handling.

    4. Build observable execution records

    The system should record the sources of key inputs, tool invocations, state changes, verification results, and failure causes, while avoiding the leakage of sensitive information.

    The purpose of these records is not to showcase how much the model “thought,” but to answer engineering questions: why the task failed, at which step the failure occurred, what facts support the final conclusion, and how to reproduce and fix the issue.

    6. How to Evaluate Different Agents Fairly?

    When comparing agents, do not judge by whether a single demo runs smoothly or by how detailed the answers are. The more reasonable target of evaluation is the ability to complete tasks under well-defined conditions.

    First, align the baseline conditions as much as possible: the same model version, comparable resource budgets, the same task data, the same tool permissions, and consistent acceptance criteria. Results obtained under different conditions still have value, but the differences must be stated—do not mistake a configuration advantage for a difference in model capability.

    Second, evaluate across multiple dimensions:

    • Completion rate: whether pre-defined acceptance criteria were met.
    • Correctness: whether results were independently checked.
    • Recovery capability: whether the agent can adjust when tools fail or information is insufficient.
    • Operational safety: whether there were unauthorized actions or unnecessary side effects.
    • Cost and latency: how many resources completing the task consumed.
    • Auditability: whether the sources of results and the scope of validation can be explained.

    Finally, use multiple task categories and run repeated tests. A single success proves nothing about stability, and a single failure does not fully represent the system.

    To pinpoint the source of improvements, you can vary context organization, tool constraints, or validation mechanisms one at a time under identical conditions and observe how results change. That is the only way to determine which specific design delivered the benefit.

    7. Conclusion: The Model Determines the Capability Ceiling; the Agent Determines How That Capability Is Realized

    That the same model behaves differently inside different agents is not mysterious. The information the model receives, the actions it can perform, the way task state is preserved, and the adjustment mechanisms after failure—all of these change.

    A good agent is not one that wraps the model in more prompts, or lets it call tools in an endless loop. It is one where every judgment is backed by appropriate information, every action stays within controllable boundaries, and every claim of completion is supported by evidence.

    For developers and enterprises, building agents should not stop at asking “is the model smart enough?” The next question should be: can the system reliably acquire facts, advance tasks, detect failures, control risks, and deliver verifiable results?

    Only when all of these pieces work together does a model’s generation capability genuinely translate into reliable engineering capability.