Module 02 · Lesson 2.1
Define the Agent's Objective, Scope and Success Criteria
On this page
- What you will learn
- Why every AI agent needs a clear objective
- How to write an agent objective in one sentence
- Set the scope: what the agent may and may not do
- Write success criteria you can test
- Check an agent reply with a few lines of Python
- Put it together: a one-page objective card
- Conclusion and your next step
- Common errors and fixes
- Validation checklist
- Hands-on exercise
- Knowledge check
- Frequently asked questions
- References
Imagine you hire a new helper for a small bike shop and say only: "Help the customers." On day one they give a discount nobody approved, promise a delivery date the shop cannot keep, and spend an hour chatting about mountain bikes. They did what you asked. You just never said what you wanted.
An AI agent has the same problem, only faster. This lesson shows you how to give an agent three things before anyone writes instructions or code: an objective (its goal), a scope (what it may and may not do) and success criteria (simple checks that show whether it did the job). Most of the lesson needs no coding. One short Python example at the end shows how a computer can run some of the checks for you.
What you will learn
- Write an agent objective in one clear sentence.
- List what an agent may do, what it must refuse and when it must hand over to a person.
- Turn vague goals such as "be helpful" into checks you can judge from one conversation.
- Run a short Python script that tests a reply against your checks.
Before you start
- Module 1, especially What Is an AI Agent? and Choosing the Right Use Case.
- No coding experience is needed for most of this lesson.
- Optional: Python 3.10 or later, if you want to run the example yourself.
Why every AI agent needs a clear objective
An AI agent is a program that uses an AI model to decide its own next step. It can also use tools, which are small helper functions such as "look up an order". Because the agent chooses its own steps, it needs to know exactly where it is going and where it must not go.
Think of a taxi. If you only say "drive", the driver could go anywhere. If you say "take me to the train station before 9 am, and avoid the motorway", the driver knows the goal, the limits and how you will judge the trip. Writing down an agent's job works the same way.
- Objective
- The one thing the agent is for. Example: help customers check the status of their own orders.
- Scope
- The edges of the job: what the agent may do, what it must say no to, and when it must pass the customer to a person.
- Success criteria
- Yes-or-no checks that tell you whether one run went well. Example: "the reply includes the order number".
- Specification
- A short written document that holds the objective, scope, success criteria and, later, the instructions. People often shorten it to "spec".
- Business need
Customers keep asking "where is my order?"
- Objective
One sentence: who, what, result
- Scope
Allowed, not allowed, handover
- Success criteria
Yes-or-no checks
- Tests
Run the checks on sample conversations
Each step makes the next one easier. Tests come last because they check everything above them.
How to write an agent objective in one sentence
A good objective is short enough to say out loud. It names who the agent helps, what it helps with and what it hands back.
A simple formula for agent objectives
Help [who] to [do what] by [giving what result].Here is the formula filled in for Quillfeather Cycles, the made-up online bike shop we use throughout this program:
Help Quillfeather Cycles customers check the status of their own orders
by giving them the current status and the expected delivery date.Weak and strong objectives compared
| Weak objective | What is wrong | Stronger version |
|---|---|---|
| Handle customer service. | Too big. Refunds, complaints and sales are all customer service. | Help customers check the status of their own orders. |
| Be helpful and friendly. | That is a style, not a goal. There is nothing to finish. | Answer order status questions with the current status and delivery date. |
| Use AI to reduce support tickets. | That is a business result. One conversation cannot achieve it. | Answer "where is my order?" without needing a member of staff. |
Set the scope: what the agent may and may not do
Scope is the agent's job description. A shop assistant can check stock and answer questions, but cannot change prices or open the safe. Writing the limits down protects your customers and your business.
In scope: the agent may
- Look up one order when the customer gives the order number.
- Explain what a status word means. For example, "dispatched" means the parcel has left the warehouse.
- Ask for the order number if the customer forgot it.
Out of scope: the agent must not
- Give refunds or discounts.
- Change an address or cancel an order.
- Share details of another customer's order.
- Guess a delivery date when the system has none.
Handover: when a person takes over
A handover (also called a handoff) is the moment the agent stops and passes the conversation to a person. Decide the reasons in advance, for example:
- The customer asks for something out of scope, such as a refund.
- The customer is upset, or mentions a safety problem such as a broken brake.
- The agent cannot find the order after two tries.
Write success criteria you can test
A success criterion is a yes-or-no check. Ask one question about each one: could someone decide pass or fail by reading a single conversation? If not, rewrite it.
| Vague | Testable on one conversation |
|---|---|
| The agent is helpful. | The reply answers the question the customer actually asked. |
| The answer is accurate. | The status and date in the reply match the order record. |
| The agent is safe. | The reply offers no refund, no discount and no date that is not in the record. |
| Replies are short. | The reply is under 300 characters. |
| Customers are happy. | Not testable on one conversation. Track it over weeks as a business measure instead. |
Two kinds of checks
- Checks a computer can do: length, required words, an order number in the right format. Automate these.
- Checks a person must do: tone, and whether the answer makes sense. Use a short review list.
Start with three to six criteria. With too few you miss problems. With too many, nobody checks them.
Check an agent reply with a few lines of Python
You can turn the computer-checkable criteria into a tiny test. No AI model is needed for this. The script below checks two sample replies, one good and one bad.
def check_reply(reply, order_id):
checks = {
"mentions the order number": order_id in reply,
"is under 300 characters": len(reply) < 300,
"makes no guarantee": "guarantee" not in reply.lower(),
}
for name, passed in checks.items():
print("PASS" if passed else "FAIL", "-", name)
check_reply("Order QF-1042 has been dispatched. It should arrive by 18 November.", "QF-1042")
print("---")
check_reply("Don't worry, I guarantee your bike arrives tomorrow!", "QF-1042")Runs offline with any Python 3 version. Save it and run python check_reply.py.
What each part does
def check_reply(reply, order_id):creates a function, a named recipe you can reuse. You give it a reply and an order number.checks = {...}is a dictionary, a list of pairs. Each pair is a check's name and its result,TrueorFalse.order_id in replyisTruewhen the order number appears anywhere in the reply.len(reply) < 300counts the characters in the reply.reply.lower()turns the reply into small letters, so "Guarantee" and "guarantee" are both caught.- The
forloop visits each check and prints PASS or FAIL.
PASS - mentions the order number
PASS - is under 300 characters
PASS - makes no guarantee
---
FAIL - mentions the order number
PASS - is under 300 characters
FAIL - makes no guaranteeThe second reply fails two checks. It never mentions the order, and it makes a promise the shop cannot keep. That is exactly the kind of answer you want to catch before a customer sees it.
Put it together: a one-page objective card
Collect everything on one page. This objective card is the first part of the agent specification you will finish in this module's final exercise.
Agent: Quillfeather order-status helper
Objective: Help Quillfeather Cycles customers check the status of their
own orders by giving the current status and delivery date.
In scope: Look up one order by its number. Explain status words.
Ask for a missing order number.
Out of scope: Refunds, discounts, address changes, cancellations,
other customers' orders, guessing dates.
Hand over: Out-of-scope request; upset customer or safety issue;
order not found after two tries.
Success criteria (one conversation):
1. The reply answers the customer's actual question.
2. Status and date match the order record.
3. The order number appears in the reply.
4. The reply is under 300 characters.
5. No refunds, discounts or promises beyond the record.Conclusion and your next step
A clear objective tells the agent where to go. The scope shows where the walls are. Success criteria tell you whether it got there. Write all three before you write instructions or code, and every later step becomes easier to build and to test.
Your next step: write an objective card for an agent you would like to build, using the template above. Then continue to System Instructions, Role, Constraints and Output Contracts, where you turn the card into the instructions the agent actually reads.
Want more background first? Read How to Build an AI Agent: A Beginner's Guide, or look up any unfamiliar word in the Glossary of AI Engineering and Agent Terms.
Common errors and how to fix them
The agent tries to do everything a customer asks.
Why it happens: The objective is too broad, such as "handle customer service".
Fix: Narrow the objective to one job and list everything else as out of scope.
Nobody can agree whether a test conversation passed.
Why it happens: The success criteria are feelings, such as "helpful" or "good".
Fix: Rewrite each criterion as a yes-or-no question you can answer from one conversation.
The agent refuses things it should do.
Why it happens: The out-of-scope list is vague, for example "nothing risky".
Fix: Name specific actions in both lists. Clear lists help the agent in both directions.
Upset customers get stuck talking to the agent.
Why it happens: No handover reasons were written down.
Fix: List when a person takes over, and make sure a real person is there to answer.
Validation checklist
Tick each item once you have confirmed it.
Hands-on exercise
Write an objective card for a library helper
A town library wants an agent that helps members renew borrowed books online. Write an objective card with an objective, scope, handover reasons and four success criteria.
You will need
- Members can renew a book at most two times.
- A book that another member has reserved cannot be renewed.
- Only staff can remove late fees.
- The library system has one tool that lists a member's loans and one tool that renews a single book.
Acceptance criteria
Your work is done when every one of these is true.
Hints (3)
- Start with the most common request: "Can I keep this book longer?"
- Ask yourself which action only a person may take. That is a handover.
- "Members are satisfied" cannot be checked on one conversation.
Show a model answer
A strong answer reads like this. Objective: help library members renew their borrowed books by renewing eligible books and telling them the new due date. In scope: list the member's loans, renew a book that has been renewed fewer than two times and is not reserved, and explain why a renewal was refused. Out of scope: removing late fees, a third renewal, and anything on another member's account. Handover: the member asks about fees, disagrees with a refusal, or the system returns an error twice. Success criteria: (1) the reply gives the new due date for each renewed book, (2) no book is renewed more than twice, (3) a reserved book is never renewed, (4) the reply is under 300 characters. Criteria 2 and 3 can be checked by code against the loan record, which makes them the safest place to start testing.
Knowledge check
Choose an answer, then check it. Nothing is recorded — this is for you.
Show the answer and explanation
Answer: B. It names who is helped, the task and the result. The first option is a business goal that no single conversation can finish. The third describes style, which belongs in the instructions rather than the objective.
Show the answer and explanation
Answer: B. You can read one reply and see whether the number is there. Customer happiness is real and worth tracking, which makes the first option tempting, but it needs many conversations over time.
Show the answer and explanation
Answer: B. Refunds move money, so a person decides. A clear handover is kinder than ignoring the question and safer than letting the agent judge honesty.
Frequently asked questions
What is the difference between an objective and a success criterion?
The objective is the goal: what the agent is for. A success criterion is a check that shows one run reached the goal. Think of cooking. The objective is "make dinner for four people". The success criteria are "four plates are served", "the food is hot" and "no one gets an ingredient they are allergic to".
Do I need to know how to code to write an agent specification?
No. The objective, scope and most success criteria are plain sentences. Product owners, support leads and business analysts often write them. Code only comes in when you want a computer to run some of the checks automatically.
How many success criteria should an AI agent have?
Start with three to six. Cover the main job, accuracy, safety and length. Add more only when testing shows a real problem that your current list would not catch.
Can I change the objective after the agent is built?
Yes, and you probably will. Treat the specification like a recipe you keep improving. Each time you change it, run your checks again, because a new goal can break answers that used to pass.
- Written by
- PromptFable Editorial
- Last updated 18 Nov 2026
- Review
- Reviewed by Waseem Nadir, Technical Reviewer
- Last reviewed 27 Nov 2026
References
Primary sources for the technical details in this lesson. Vendor platforms change — check the official page if anything here looks different from what you see.
- Prompt engineering overview(opens in a new tab)
Anthropic · Official documentation · Recommends defining success criteria and a way to test them before writing prompts.
- Building effective agents(opens in a new tab)
Anthropic · Official documentation · When a simple workflow is enough and when an agent is worth its extra cost.
- LLM06: Excessive Agency(opens in a new tab)
OWASP Foundation · Official documentation · Why an agent should get only the tools and permissions its job needs.
- Python tutorial: defining functions(opens in a new tab)
Python Software Foundation · Official documentation · Background for the `def` and `for` lines in the example.
- Python tutorial: dictionaries(opens in a new tab)
Python Software Foundation · Official documentation
PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.