Defining the Goal
A precisely defined goal is the foundation of every reliable agent. Vague goals produce vague agents.
6 min•By Priygop Team•Updated 2026
Goal Definition Template
Goal Definition Template
# Agent goal definition template
def define_agent_goal(
objective: str,
success_criteria: list,
input_format: dict,
output_format: dict,
constraints: list,
escalation_triggers: list,
) -> dict:
"""
Define a complete, unambiguous agent goal.
Every agent project should start with this definition.
"""
return {
"objective": objective,
"success_criteria": success_criteria,
"input_format": input_format,
"output_format": output_format,
"constraints": constraints,
"escalation_triggers": escalation_triggers,
}
# Example: Customer Support Refund Agent
refund_agent_goal = define_agent_goal(
objective=(
"Process customer refund requests for e-commerce orders. "
"Determine eligibility, issue eligible refunds, reject ineligible ones, "
"and notify the customer by email."
),
success_criteria=[
"Correctly determines eligibility for 95% of standard refund requests",
"Issues refunds within 2 minutes for eligible requests under $100",
"Escalates to human for requests over $100 or outside the return window",
"Sends a clear confirmation or rejection email for every request",
"Never issues a duplicate refund for the same order",
],
input_format={
"order_id": "string — format: ORD-XXXXXX",
"reason": "string — customer's stated reason for return",
"user_id": "string — authenticated user ID",
},
output_format={
"outcome": "success | rejected | escalated",
"refund_id": "string | null",
"message": "string — explanation sent to customer",
},
constraints=[
"Never issue refunds for orders older than 30 days without manager approval",
"Never issue refunds over $100 without manager approval",
"Always send a confirmation email — never leave the customer without a response",
"Never access orders belonging to other users",
],
escalation_triggers=[
"Order total exceeds $100",
"Order is older than 30 days",
"Customer has more than 3 refund requests in 30 days",
"Tool failure after 3 retries",
]
)
print("Goal defined:")
print(f" Objective: {refund_agent_goal['objective'][:60]}...")
print(f" Success criteria: {len(refund_agent_goal['success_criteria'])}")
print(f" Constraints: {len(refund_agent_goal['constraints'])}")
print(f" Escalation triggers: {len(refund_agent_goal['escalation_triggers'])}")