When an AI agent gives a wrong answer, “the model was inaccurate” is usually too vague to be useful.
The failure may have happened because:
- the right information was never retrieved
- irrelevant context distracted the model
- the model chose the wrong tool
- the tool schema was confusing
- a correct tool call returned stale data
- the workflow retried a failed mutation incorrectly
- the answer was right but the final action was wrong
- the evaluator measured prose quality instead of task success
Improving agent accuracy therefore starts by decomposing accuracy into the parts of the system that can fail.
The goal is not to make the model sound more confident. The goal is to make the overall system complete tasks correctly, consistently, and measurably.
Accuracy is not one metric
For a simple classifier, accuracy may literally mean:
correct predictions / total predictions
For an agent, several dimensions matter.
| Dimension | Example question |
|---|---|
| Factual accuracy | Is the answer actually true? |
| Retrieval accuracy | Did the system retrieve the right evidence? |
| Tool accuracy | Did the agent choose the right tool with correct arguments? |
| Workflow accuracy | Did the sequence of actions make sense? |
| State accuracy | Does the agent understand what has already happened? |
| Action accuracy | Did the real-world side effect match the user's intent? |
| Instruction accuracy | Did the agent obey required constraints? |
| Task success | Was the user's goal actually completed? |
If you only score the final text response, you can miss failures in every other layer.
Build an eval dataset before “optimizing prompts”
Without an evaluation set, improvement becomes subjective:
change prompt
try 5 examples
looks better
ship
That does not tell you whether the change fixed one case while breaking ten others.
A good eval dataset contains real task shapes your users care about.
For a support agent:
simple FAQ
ambiguous billing issue
missing account information
unauthorized request
refund request above threshold
contradictory documentation
bad tool response
For a coding agent:
single-file bug
multi-file change
failing tests
unclear requirement
large search task
tool failure
repo with misleading instructions
Anthropic's 2026 agent-evaluation guidance emphasizes the same principle: evals make behavioral changes visible before users discover them in production.
Start with failure cases, not synthetic easy prompts
The highest-value eval cases usually come from:
- production failures
- user complaints
- edge cases found during QA
- regressions from model upgrades
- tool misuse
- retrieval misses
- security incidents
Every meaningful production failure should ask a follow-up question:
> Should this become a permanent regression test?
Over time, this creates an eval suite tailored to the real weaknesses of your system instead of a generic benchmark.
Evaluate the trajectory, not only the final answer
Imagine two agents both return the correct final answer.
Agent A:
2 tool calls
correct permissions
correct evidence
8 seconds
Agent B:
14 tool calls
3 duplicate searches
1 denied write attempt
2 irrelevant sources
55 seconds
A final-answer-only metric treats them as equal.
They are not.
Current Google agent-evaluation tooling explicitly includes metrics for tool-use quality, multi-turn trajectory quality, error recovery, and task success—not just response text.
For real agents, that is the right model.
Separate retrieval failures from generation failures
RAG systems often blame the model for answers it never had enough evidence to answer correctly.
Ask two separate questions.
Retrieval question
Did the correct evidence appear in the candidate set?
Generation question
Given the correct evidence, did the model answer correctly?
If the answer to the first is no, changing the system prompt may do nothing.
You need to improve:
chunking
hybrid retrieval
metadata filters
query rewriting
reranking
index freshness
This separation saves enormous debugging time.
Improve grounding before adding more instructions
When the model needs private or changing facts, give it authoritative evidence.
Bad architecture:
"Answer confidently using your knowledge."
Better architecture:
retrieve current policy
retrieve current customer state
provide citations/evidence
ask model to answer from that evidence
Grounding can come from:
- RAG documents
- databases
- APIs
- tool calls
- code repositories
- verified structured state
The model should reason over truth owned by authoritative systems rather than inventing live facts from memory.
Use live tools for live state
Do not answer:
What is my account balance right now?
from RAG or conversation memory if a live account API exists.
Use the authoritative tool.
A simple rule:
static/domain knowledge → retrieval
live operational state → tool
stable preference → memory
Many “hallucination” problems disappear when the architecture gives the model the correct source of truth.
Context quality matters more than context quantity
Adding more tokens can reduce accuracy.
A large context may contain:
- irrelevant documents
- old tool results
- contradictory history
- unused tool descriptions
- duplicated facts
- stale state
Anthropic's context-engineering guidance recommends the smallest high-signal set of tokens that maximizes success.
For each model call, ask:
> What information is actually required for this decision?
Do not automatically send the entire conversation, entire tool catalog, and entire knowledge base.
Clear instructions still matter
Context engineering does not mean prompts no longer matter.
A good instruction should define:
objective
constraints
what tools are for
what must not be assumed
output contract
when to stop or escalate
Avoid both extremes.
Too vague:
"Help the user as best as possible."
Too brittle:
10,000 lines attempting to encode every possible edge case in prose
Start simple, then add instructions only for failure modes actually observed in evals.
Canonical examples are often better than more rules
Models learn behavior well from clear examples.
Instead of adding fifteen paragraphs describing what a good support response looks like, a few diverse examples may provide a cleaner signal.
Choose examples that represent:
- normal cases
- important edge cases
- refusal/escalation behavior
- structured output expectations
Do not stuff hundreds of examples into every request. Retrieve relevant examples when appropriate.
Structured outputs reduce interface errors
If the next step is deterministic code, do not make that code parse free-form prose.
Instead of:
"This appears to be a billing issue and priority is probably high."
prefer:
{
"category": "billing",
"priority": "high",
"needs_human_review": false
}
Then validate the schema.
Structured outputs do not guarantee the values are correct, but they remove an entire class of parsing ambiguity.
Tool design directly affects agent accuracy
Anthropic's tool-design research found that agent performance changes substantially based on how tools are named, scoped, described, and what they return.
Bad tool surface:
list_everything()
execute_api(method, url, body)
query(sql)
Better tool surface:
search_orders(customer_id, query, cursor)
get_invoice(invoice_id)
create_refund_proposal(invoice_id, amount, reason)
A model makes better choices when the action space is clear.
Remove overlapping tools
Suppose an agent sees:
find_customer
search_customers
lookup_user
get_account
fetch_customer
If a human cannot clearly explain when each one should be used, the model will struggle too.
Tool overlap creates decision ambiguity.
Prefer a smaller set with distinct responsibilities.
Tool descriptions are part of the model's program
The tool description should answer:
What does this tool do?
When should it be used?
When should it not be used?
What do the parameters mean?
What does it return?
Parameter names matter too.
Prefer:
customer_id
over:
user
when the tool specifically expects a stable customer identifier.
Small tool-description changes can produce measurable improvements, which is why they should be tested through evals rather than intuition alone.
Return high-signal tool results
A technically correct tool can still hurt accuracy if it dumps too much irrelevant information into context.
Bad:
read_logs() → 50,000 lines
Better:
search_logs(service, query, time_window, limit)
Use:
- filtering
- pagination
- range selection
- summaries
- compact fields
Anthropic's tooling guidance explicitly recommends context-efficient tool responses because model context is a limited resource.
Add deterministic validators around probabilistic outputs
Whenever code can cheaply verify something, let code verify it.
Examples:
JSON schema validation
SQL parser/checker
unit tests
compiler/type checker
API response schema
business rule validation
permission check
The model proposes; deterministic systems verify.
A coding agent that claims “tests pass” should ideally have actually run the tests.
An agent that proposes a refund amount should have that amount checked against the authoritative invoice and business rules.
Verification is especially important after mutations
For side-effecting tools, success should not rely only on the model's interpretation of a response.
After an important write:
execute mutation
↓
verify postcondition
↓
continue
Example:
create refund
↓
get refund by operation ID
↓
status == confirmed?
This catches ambiguous responses and reduces repeated actions.
Classify failures before retrying
Blind retries can make agents less accurate.
Different failures need different handling.
| Failure | Better behavior |
|---|---|
| Rate limit | backoff/retry |
| Temporary read failure | retry |
| Invalid arguments | give error to model to correct |
| Permission denied | stop |
| Business rule rejected | stop or choose valid path |
| Write timeout | verify outcome before retry |
| Model repeatedly loops | terminate/escalate |
Retries should be part of workflow semantics, not a global “three attempts” wrapper.
Self-critique can help—but only with a real rubric
An evaluator/optimizer loop can improve outputs:
generate
↓
evaluate
↓
feedback
↓
revise
But this instruction is weak:
"Review your answer and make it better."
Use measurable criteria:
Does every material claim have supporting evidence?
Are all required fields present?
Did the solution satisfy the stated constraints?
Did the agent use only allowed tools?
And bound the loop:
max_iterations = 2 or 3
Unbounded reflection can waste tokens without converging.
Multiple model samples are useful only when aggregation makes sense
For some tasks, generating several candidates and selecting/voting can improve reliability.
Examples:
- classification
- extraction
- planning alternatives
- code-solution candidates
But it multiplies cost.
Do not use “ask five models and vote” as a universal fix.
First determine whether the task has a reliable selection criterion.
Model choice should be task-specific
The strongest overall model may not be the best model for every stage.
A workflow can use:
small model → simple classification
strong reasoning model → ambiguous planning
specialized embedding model → retrieval
reranker → relevance
But every extra model adds operational complexity.
Benchmark the exact task instead of assuming bigger is always better.
Temperature is not a magic accuracy knob
Lower randomness can make outputs more repeatable for some tasks, but it cannot fix:
- missing context
- wrong retrieval
- bad tools
- unclear instructions
- invalid business logic
Treat decoding parameters as fine-tuning knobs after the architecture is sound.
Fine-tuning is not the first fix for most agent failures
If the failure is:
wrong current fact
use retrieval/tools.
If the failure is:
agent cannot distinguish two overlapping tools
improve the tool surface.
If the failure is:
business rule missing
enforce it in code.
Fine-tuning is valuable when you have a stable behavior pattern that the model should learn and enough quality training/evaluation data to measure improvement.
Do not use fine-tuning to compensate for a broken system boundary.
Observability turns “wrong answer” into a debuggable failure
Capture the run trajectory:
user request
↓
retrieved context
↓
model call
↓
tool choice
↓
tool result
↓
next model call
↓
final result
Track at least:
- model/version
- prompt/instruction version
- retrieved sources
- tool calls
- argument validation failures
- retries
- latency
- token/cost usage
- final outcome
Without this, teams end up debugging from screenshots of the final answer.
Build a failure taxonomy
Do not keep one bucket called incorrect_answer.
Useful categories include:
retrieval_miss
retrieval_wrong_document
hallucinated_fact
wrong_tool
wrong_tool_arguments
missing_tool_call
unnecessary_tool_call
policy_violation
state_confusion
retry_error
workflow_loop
bad_final_synthesis
Once failures are categorized, improvement becomes targeted.
If 60% of failures are retrieval misses, prompt tuning is the wrong priority.
Use the eval → diagnose → fix → rerun loop
Google's current Agents CLI evaluation guidance describes essentially this process:
write core eval cases
↓
run agent
↓
grade traces
↓
inspect failures
↓
change instructions/tools/logic
↓
rerun
↓
expand edge cases
That is the right development loop for production agents.
Not “prompt until it feels better.”
Different graders fit different tasks
A useful eval system may combine several grader types.
Exact/deterministic graders
Good for:
JSON fields
classification labels
unit tests
API side effects
file changes
Rule-based graders
Good for:
required sections
forbidden actions
schema constraints
Model-based graders
Useful when quality requires nuanced judgment:
helpfulness
reasoning quality
policy adherence
completeness
OpenAI's eval APIs support multiple grader styles, including string checks and model-based scoring/label graders.
Whenever deterministic grading is possible, prefer it over subjective model judging.
Evaluate the exact production configuration
Performance can change when you alter:
model
prompt
context strategy
tool descriptions
tool catalog
retrieval model
reranker
temperature
reasoning effort
memory policy
Your eval should run against the real configuration you intend to ship.
A benchmark of the base model alone is not enough.
Regression testing matters after model upgrades
A newer model may improve general reasoning and still behave differently on your tools or formatting rules.
Before upgrading:
old config → eval suite
new config → same eval suite
compare
Look beyond one overall score.
A change may improve 90% of cases while breaking one critical financial workflow.
Segment evals by risk and use case.
Use production feedback carefully
Production feedback is valuable because it reveals real tasks.
Useful signals include:
explicit thumbs up/down
user corrections
repeated request after bad result
human escalation
workflow cancellation
manual fix after agent action
But feedback is noisy.
One unhappy user does not automatically mean one prompt change.
Cluster failures, identify patterns, then add representative eval cases before changing the system.
A practical improvement hierarchy
When agent quality is poor, fix the lowest broken layer first.
1. Is the task clearly defined?
2. Does the model receive the right context?
3. Is retrieval finding the right evidence?
4. Are tools well designed and scoped?
5. Are permissions/business rules enforced?
6. Are outputs structured where needed?
7. Are important results verified?
8. Are retry/failure semantics correct?
9. Does the model need better instructions/examples?
10. Would a stronger/specialized model help?
11. Is fine-tuning justified?
This order avoids throwing model complexity at problems caused by architecture.
Production checklist
Before claiming an agent is “accurate,” verify:
- Accuracy is broken into factual, retrieval, tool, workflow, and task-success metrics
- Core tasks have a repeatable eval dataset
- Real production failures become regression cases
- Retrieval and generation are evaluated separately
- Live facts come from authoritative tools
- Context is high-signal and bounded
- Instructions are clear without becoming huge rulebooks
- Structured outputs are schema-validated
- Tool responsibilities do not overlap unnecessarily
- Tool descriptions and arguments are unambiguous
- Tool responses are token-efficient
- Deterministic validators check what code can verify
- Important mutations have postcondition verification
- Retry behavior depends on failure class
- Feedback loops have explicit rubrics and iteration caps
- Run trajectories are observable
- Failure categories are tracked
- Model/config upgrades run through regression evals
- End-to-end user goal completion is measured
Final takeaway
AI agent accuracy is not primarily a prompt-writing contest.
It is a systems-engineering discipline.
The most reliable path is:
measure real failures
→ identify which layer failed
→ fix that layer
→ verify with evals
→ ship carefully
→ learn from production
→ add regression coverage
Ground the model in authoritative information. Give it fewer, clearer tools. Keep context relevant. Validate structured boundaries. Verify real-world side effects. Trace the whole trajectory. Evaluate the user outcome, not only the final paragraph.
> The best accuracy technique is not one trick—it is an evaluation-driven architecture where every failure can be located, measured, and improved without guessing.

Discussion (0)