Skip to content
be-human.ai
← Back to the journal

Testing & reliability

Why Your AI Agent Gives Different Answers, and How to Fix It

AI gives different answers because generation is probabilistic and context changes. Here are the sources of variation and the steps that steady business answers.

Be Human typographic cover with the title: Why Your AI Agent Gives Different Answers, and How to Fix It
Conceptual illustration created with AI · Be Human

An AI agent gives different answers to the same question because language models generate text by sampling from probabilities, and because the question is rarely identical from the model's point of view. Wording, conversation history, retrieved documents, tool results and model updates all change what the model sees. You cannot remove all variation, but you can narrow it by fixing the inputs, constraining the outputs and testing the results.

Key takeaways

  • Variation comes from three places: the model's sampling, the context it receives on each run, and the instructions and tools around it.
  • Context drift is usually a bigger cause of business inconsistency than randomness, and it is the part you can control most directly.
  • Decide in advance which parts of an answer may vary (tone, phrasing) and which must not (policy, figures, actions).
  • Consistency is built with approved sources, structured outputs, a small set of fixed test questions and logs that show what the agent saw.
  • Consistency decays over time, so it needs a recurring check, especially after model, instruction or knowledge changes.

What actually changes between two runs of the same question?

When a person asks the same thing twice, it feels like one question. The agent usually receives two different packages. Each package contains the question, but also the instructions, any remembered facts, the recent conversation, passages retrieved from documents and results from tools. If any piece differs, the answer can differ, even if the model were perfectly deterministic.

It helps to think in three layers, and to ask of each one: what can differ from run to run?

  • The model layer: how the next words are chosen, and which model version is answering.
  • The context layer: which documents, memory, history and live data were placed in front of the model.
  • The instruction layer: the rules, role description and output format the agent was told to follow.

Most teams look at the model layer first because it feels like the source of the mystery. In practice, the other two layers explain more of the inconsistencies that a business owner notices, such as two different return rules or two different delivery estimates for the same product.

How much variation is built into the model itself?

A language model writes one small piece of text at a time. At each step it has a spread of plausible next pieces, and it picks one. Where the provider exposes settings such as temperature, they control how adventurous that pick is. A higher setting allows more varied wording. A lower setting makes the most likely choice win more often.

Two cautions apply. First, a low setting reduces variation but does not guarantee identical output. Differences in how requests are processed, small changes on the provider side and the sheer length of an answer can still produce divergence. Second, some models fix these settings or do not expose them, so a plan that depends on one dial is fragile.

A practical position: treat sampling settings as a tuning tool for the right kind of task. For classification, extraction and routing, you want the least variation you can get. For drafting a friendly reply or brainstorming options, some variation is useful. Do not try to fix a policy inconsistency with a setting. If the agent says two different things about a rule, the cause is almost always upstream, in what it was given.

Why does context change the answer more than randomness does?

Context is everything the agent can see at the moment it answers. Anthropic's writing on [context engineering for agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents) makes the point that the quality of an agent's behavior depends heavily on curating that information, not only on the prompt. Several common context problems create variation:

  • Retrieval differences. When an agent searches your documents, small changes in phrasing can bring back different passages. If two documents disagree, the answer depends on which one was returned. The idea is described in AWS's overview of [retrieval-augmented generation](https://aws.amazon.com/what-is/retrieval-augmented-generation/).
  • Conversation history. A question asked after a long exchange is not the same input as the same question asked fresh.
  • Memory. Stored notes about a customer or project may have been added, corrected or expired between runs.
  • Live tool results. Stock levels, calendar availability and ticket status change, so a correct answer changes too.
  • Instruction clutter. Long instruction files with overlapping or contradictory rules force the model to choose, and it may choose differently each time.

There is also a gap-filling effect. When the agent has no approved source for a question, it still produces something plausible, and the plausible answer varies. That is closely related to hallucination, which we cover in how to reduce AI hallucinations in business workflows. Giving the agent a clear source, and a clear permission to say it does not know, removes much of that variation.

Which variation is acceptable, and which is a defect?

Not all variation is a problem. Asking for identical sentences every time is rarely worth the effort and can make replies feel robotic. The useful question is whether two different answers could lead a customer or colleague to act differently.

Use this guide to sort your own workflows.

  • Acceptable variation: sentence structure, word choice, greeting, order of explanation, and tone within your brand voice.
  • Defect, must be stable: figures, dates, policy statements, eligibility decisions, names of products or plans, and anything a customer could rely on as a commitment.
  • Defect, must be stable: which action the agent takes, which tool it calls, which category it assigns, and when it escalates to a person.
  • Review case: advice or recommendations. Allow different phrasing, but require the same underlying reasoning and the same cited source.

Write the result down for each workflow. It becomes the definition of what a consistency test must check, and it keeps the team from chasing harmless differences.

A step-by-step plan for steadier answers

The following sequence works for most business agents. It moves from the cheapest, most effective controls to the more involved ones.

  • Step one: name the stable facts. List the answers that must not vary, such as policies, prices handled elsewhere, hours, eligibility rules. Give each one a single owner.
  • Step two: create one approved source per fact. Remove or archive outdated duplicates. Two documents that disagree guarantee two answers.
  • Step three: point the agent to those sources and require it to use them. Ask it to name the source it used, and to say it cannot confirm when no source applies.
  • Step four: simplify the instructions. Remove overlapping rules, put the most important constraints first and keep each rule testable. Our guide on keeping agent instructions maintainable goes deeper.
  • Step five: constrain the output. For decisions, categories and actions, use a fixed format with allowed values, so the agent chooses from a list instead of composing free text.
  • Step six: lower variation where it adds nothing. For extraction and routing tasks, use the most conservative settings your provider allows, while keeping in mind they do not guarantee sameness.
  • Step seven: build a small fixed test set. Collect real questions, including awkward ones, with the expected stable facts. Run each one several times and compare the stable parts. See how to build a golden test set for the method.
  • Step eight: log what the agent saw. When two answers differ, you need the retrieved passages, memory entries and tool results behind each. The guide to what to log for agent observability explains what is worth keeping.
  • Step nine: route uncertainty to a person. If sources conflict or none applies, the agent should hand off the decision with the evidence rather than guess.

The order matters. Teams often jump to step six or to rewriting the main instruction, when steps one and two would have removed the problem. For the testing approach in general, the OpenAI guide to [evals](https://platform.openai.com/docs/guides/evals) and Anthropic's piece on [evals for AI agents](https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents) are practical references.

An illustrative scenario: two answers about a return window

This is an illustrative scenario, not a real case.

A distributor has a support agent that answers questions about returns. A customer service lead notices that one customer was told the return period starts on the order date, and another was told it starts on delivery. Both customers asked almost the same question.

The lead first assumes the model is unreliable. The logs tell a different story. The knowledge base contains two documents: an older terms page and a newer returns policy. Depending on the phrasing of the question, retrieval brought back one or the other. The model then summarized whichever it received, accurately.

The fix has little to do with the model. The team archives the older page, names one owner for the returns policy, and instructs the agent to cite the policy it used. They add the question to the fixed test set, with the expected start of the return period as a stable fact. They also add a rule that if retrieved sources disagree, the agent hands the question to a person with both passages attached. Afterwards, repeated runs vary in wording but not in the rule.

How do you keep answers consistent over time?

Consistency is not a one-time result. Models are updated, documents change, tools evolve and instructions grow. Any of these can reintroduce variation that you had removed. A model update in particular can shift tone, format and borderline decisions without any change on your side. The approach in AI model update regression checks lets you adopt, adjust or roll back with evidence instead of impressions.

A light routine is enough for most teams: re-run the fixed test set after any change to the model, instructions, knowledge or tools; review the questions where the agent escalated or contradicted itself; and retire sources that nobody owns.

Be Human handles this as part of a managed engagement. The first engagement defines one useful role, the approved sources and tools it needs, the approval boundaries and an observable success criterion. Managed operations can then include monitoring, recurring evaluations, integration maintenance and controlled improvements, so changes to the model or knowledge are checked against the same test questions before they reach your customers. Your team keeps the decisions about what the agent may say and do.

Frequently asked questions

Can I make an AI give exactly the same answer every time? Not reliably, and for most business work you do not need to. You can make the stable parts, such as facts, decisions and actions, consistent by using approved sources, fixed output formats and tests. The wording may still vary, and that is usually harmless.

Is a different answer the same as a wrong answer? No. Two answers can be phrased differently and both be correct. The concern is when the substance changes, for example a different rule, figure or next step. Those cases point to a source, context or instruction problem that you can trace and fix.

Should I set the temperature to the lowest value to get consistent answers? It can help for tasks such as classification or data extraction, but it is not a complete solution. Output can still vary, and some models do not expose the setting. Fix the sources and the output format first, then use conservative settings where variation adds no value.

How often should I re-test an agent for consistency? Re-test after any change to the model, instructions, knowledge base or tools, and on a recurring schedule even when nothing seems to have changed. A short fixed set of real questions is enough to catch most drift. Review the logs whenever a customer or colleague reports two different answers.

Be Human editorial guidance. Examples are illustrative unless explicitly attributed. Sources provide background; implementation choices depend on your workflow.

Less busywork. More room for you.

Bring us the work you wish you had time for.

Try a personalized AI agent free for 7 days on WhatsApp ↗