Incorrect Decisions
Incorrect decisions occur when the agent's language model chooses the wrong action — wrong tool, wrong sequence, or misunderstanding of the goal. These are the hardest failures to prevent.
6 min•By Priygop Team•Updated 2026
Reducing Decision Errors
- Clear system prompts: the agent should know exactly what it can and cannot do
- Clear tool descriptions: ambiguous descriptions lead to wrong tool selection
- Step-by-step reasoning: instruct the agent to reason before deciding (Chain-of-Thought)
- Output format constraints: require the agent to output decisions in a fixed JSON format to reduce hallucination
- Decision validation: before executing a tool call, validate that the decision makes logical sense given the current state
- Human review on first run: manually review the first execution of any new workflow to catch decision errors early
Decision Validation
Decision Validation
# Validate agent decisions before executing them
def validate_agent_decision(decision: dict, state: dict) -> dict:
"""
Check that the agent's chosen action makes sense given the current state.
Returns validation result.
"""
action = decision.get("action")
args = decision.get("args", {})
errors = []
# Check the action exists
allowed_actions = {"web_search", "get_order", "issue_refund", "send_email", "FINISH"}
if action not in allowed_actions:
errors.append(f"Unknown action: '{action}'")
# Check the agent is not repeating an action unnecessarily
recent_actions = [h["action"] for h in state.get("history", [])[-3:]]
if recent_actions.count(action) >= 2 and action != "FINISH":
errors.append(f"Action '{action}' repeated 3 times — possible loop")
# Check that FINISH is only called when the goal is complete
if action == "FINISH":
if not state.get("data", {}).get("goal_achieved"):
errors.append("FINISH called but goal_achieved is not set in state")
# Check required args are present
required_args = {"web_search": ["query"], "get_order": ["order_id"],
"issue_refund": ["order_id", "amount"]}
for required in required_args.get(action, []):
if required not in args or not args[required]:
errors.append(f"Missing required arg: '{required}' for action '{action}'")
if errors:
return {"valid": False, "errors": errors}
return {"valid": True}
state = {"history": [{"action": "web_search"}, {"action": "web_search"}], "data": {}}
decision = {"action": "web_search", "args": {"query": "Python frameworks"}}
result = validate_agent_decision(decision, state)
print("Valid:", result["valid"])
if not result["valid"]:
print("Errors:", result["errors"])Key Takeaways
- Incorrect decisions occur when the agent's language model chooses the wrong action — wrong tool, wrong sequence, or misunderstanding of the goal.
- Clear system prompts: the agent should know exactly what it can and cannot do
- Clear tool descriptions: ambiguous descriptions lead to wrong tool selection
- Step-by-step reasoning: instruct the agent to reason before deciding (Chain-of-Thought)