Agent practice
How to Give an AI Agent a Task You Can Verify

A task is not ready for an AI agent when it merely sounds clear. It is ready when another person can inspect the inputs, permissions, result, checks, and stopping point without relying on trust.
The safest way to delegate work to an AI agent is to write a small operating contract before the agent starts. That contract should say what the agent may use, what it may change, what “done” means, how the result will be checked, and what it must do when the task cannot be completed.
This article gives you a reusable brief for that contract. It applies to tasks such as editing a document, changing code, preparing a report, cleaning a data file, or investigating an error. The examples are illustrative. They are not claims about a particular tool, repository, customer, or production system.
Why ordinary instructions are hard to verify
A request such as “update the onboarding page and make sure it works” contains an intention, but not a reliable test. An agent may reasonably ask:
- Which page is in scope?
- Which files or data may be read?
- May existing content be rewritten?
- What does “works” mean: renders, passes tests, or matches a screenshot?
- What should happen if the required information is missing?
- Should the agent stop after preparing a patch, or publish the change?
These gaps create three different kinds of uncertainty:
- Output uncertainty: the requested result is not described precisely enough to compare with the result produced.
- Permission uncertainty: the agent can access or modify more than the task requires.
- Stopping uncertainty: the agent does not know when to stop, so it may continue exploring, expanding scope, or taking an unapproved action.
A verifiable task brief reduces all three. It turns a conversational request into an observable procedure.
The basic model: scope, evidence, and stop
Use three questions to design the brief:
| Question | What to specify | What a reviewer can inspect |
|---|---|---|
| What is the agent working with? | Inputs, files, records, environment, and assumptions | The exact starting material and its boundaries |
| What may the agent do? | Allowed actions, forbidden actions, and approval gates | The difference between permitted and unpermitted changes |
| How do we know it is done? | Acceptance checks, evidence, and stopping conditions | Commands, screenshots, diffs, logs, or other artifacts |
In this article, an AI agent means a system that can interpret a task and take one or more actions through available tools. The exact tools vary. The discipline of specifying scope and evidence does not.
A concrete case: changing one page without publishing it
Suppose you want an agent to update a help page. The desired outcome is modest:
Update the troubleshooting section of
help.htmlso it explains three recovery steps, keeps the existing links, and prepares the change for review. Do not publish it.
This is better than “improve the help page,” but it is still incomplete. A reviewer needs to know:
- the source file and the permitted neighboring files;
- the exact content requirements;
- the links that must remain unchanged;
- the checks that must pass;
- the artifact to hand back;
- the action that is explicitly out of scope.
A verifiable version might look like this:
Task
Update only the troubleshooting section in help.html.
Inputs
- Read help.html.
- Read style.css only if needed to understand existing classes.
- Use the three recovery steps supplied below.
- Do not use customer data, credentials, or unpublished content.
Required result
- The troubleshooting section contains exactly three numbered recovery steps.
- Each step has one action and one expected result.
- Existing links outside the troubleshooting section remain unchanged.
- The edited file remains valid HTML.
Allowed actions
- Read the listed files.
- Edit help.html.
- Run the local HTML validation command below.
- Produce a diff and a short verification report.
Forbidden actions
- Do not edit any other file.
- Do not publish, deploy, commit, or send messages.
- Do not invent product behavior. If a recovery step is ambiguous, stop and ask.
Acceptance checks
1. Inspect the diff: only the troubleshooting section changed.
2. Count the numbered steps: exactly three.
3. Run: html-validate help.html
4. Confirm each existing link outside the edited section is unchanged.
5. Report any check that could not be run.
Stopping conditions
- Stop when the checks above are complete.
- Stop and ask if the required steps are missing or contradictory.
- Stop before any publish, deploy, commit, or external communication.
Handoff
Return:
- the changed file or patch;
- the validation command and result;
- a summary of changed lines;
- unresolved questions;
- a statement that no publish or deployment was performed.
The important improvement is not the wording style. It is the separation between instructions and evidence. The agent is told what to change and how a person can verify that the change stayed inside the boundary.
The reusable task-brief template
Copy this template into your own work request. Remove sections that genuinely do not apply, but do not omit a section merely because the task feels small.
Task name
[Short name that identifies the work]
Objective
[One sentence describing the desired outcome]
Context
[Why this task matters. Include only facts the agent needs.]
Inputs
- Files, URLs, records, or text the agent may read:
- [input 1]
- [input 2]
- Source of truth:
- [document, specification, test, or person]
- Assumptions:
- [assumption]
- Missing information that requires a question:
- [condition]
Scope
In scope:
- [specific file, section, record, or operation]
- [specific behavior or output]
Out of scope:
- [related item that must not be changed]
- [publication, deployment, deletion, or communication]
Permissions
Allowed:
- Read: [locations or sources]
- Write: [locations or files]
- Execute: [commands or tools]
- Communicate: [none, or named channel]
Requires approval before:
- [destructive action]
- [external communication]
- [commit, merge, publish, or deploy]
- [access to a new source]
Forbidden:
- [secret, personal, customer, or unrelated data]
- [unlisted files or systems]
- [invented facts or unreviewed assumptions]
Required output
- [file, patch, report, table, or other artifact]
- [required fields or format]
- [summary of changes]
- [list of unresolved questions]
Acceptance checks
- [observable check 1]
- [observable check 2]
- [command, query, or manual inspection]
- [expected result for each check]
Evidence to provide
- [diff, log, screenshot, test output, checksum, or link]
- [environment or version information, if relevant]
- [checks not run and why]
Stopping conditions
- Stop when: [completion condition]
- Stop and ask when: [ambiguity or missing input]
- Stop before: [approval-gated action]
- Stop after: [maximum iteration, time, or attempt limit]
Handoff procedure
1. Return [artifact].
2. Summarize [changes and decisions].
3. List [checks and results].
4. List [limitations and unresolved questions].
5. State explicitly which external actions were not performed.
6. Wait for approval before [next action].
How to write inputs that can be checked
Inputs should identify what the agent may rely on and what it must ignore. “Use the project files” is usually too broad. Prefer a named path, a named folder, a supplied excerpt, or a clearly bounded query.
For a file task, write:
Read:
- docs/brief.md
- src/signup/form.ts
- tests/signup-form.test.ts
Do not read:
- .env files
- production exports
- customer records
- unrelated directories
If a required fact is not in these inputs, ask before proceeding.
For a research or analysis task, identify the allowed evidence and the date boundary:
Use only the attached incident notes and the supplied log extract.
Do not infer customer identity from identifiers.
Mark every conclusion as:
- directly observed,
- calculated from supplied data, or
- a hypothesis requiring confirmation.
This makes the agent's reasoning easier to audit. It also prevents a common failure mode: silently filling an information gap with a plausible but unsupported detail.
How to make permissions proportional
Permissions should follow the smallest useful scope. Separate read, write, execute, and communicate permissions because they have different risks.
| Permission | Example of a narrow grant | Question to ask |
|---|---|---|
| Read | Read two named files | What information is necessary? |
| Write | Edit one named file | What is the smallest changeable surface? |
| Execute | Run one test command | Could this command alter data or external state? |
| Communicate | Draft a message but do not send it | Does a person need to approve the wording or recipient? |
A useful pattern is “prepare, then pause.” Let the agent generate a patch, email draft, migration plan, or deployment command, but require a human approval before the action that creates an external effect.
For example:
Prepare the database migration and run a dry check.
Do not apply the migration.
Return the proposed command, affected tables, expected row count,
rollback approach, and dry-check output.
Wait for explicit approval before applying anything.
Do not use a permission statement as a substitute for tool-level access control. The brief records the intended boundary; the environment should enforce the boundary where possible. If the agent can access more than the brief permits, treat that as a limitation and record it in the handoff.
How to write acceptance checks
An acceptance check should produce an observation that another person can repeat. “Make it clean” is a preference. “The validator exits with code zero and the diff contains only help.html” is a check.
Good checks usually belong to one of four categories:
- Content: required sections, fields, values, or records exist.
- Boundary: only the allowed files, rows, or sections changed.
- Behavior: a test, command, or manual interaction produces the expected result.
- Evidence: the agent returns an artifact that supports the claim.
Turn vague requirements into checks:
| Vague requirement | Verifiable version |
|---|---|
| Keep the design consistent. | Use the existing button class; inspect the rendered page at the two supplied viewport sizes. |
| Do not break anything. | Run the named test command and report its exit status; inspect the diff for unrelated changes. |
| Clean the data. | Normalize the three specified fields, preserve row count, and report the number of changed rows. |
| Make it production-ready. | Complete the listed checks and stop before release or deployment approval. |
Every check needs an expected result. If the expected result cannot be stated, the requirement is not yet testable.
Commands and configuration that help
Commands are useful when they are explicit, safe, and tied to a check. Name what the command does and whether it can change external state.
# Read-only inspection
git diff -- help.html
# Example validation command
html-validate help.html
# Example test command
npm test -- --runInBand
# Example boundary check
git status --short
These commands are examples only. Use commands supported by the project you are working on, and verify their meaning before including them in a brief. A command that looks like a test may still create files, contact a service, or modify a database.
For an agent that supports structured configuration, the same brief can be represented as data:
{
"task": "Update one help page",
"inputs": [
"help.html",
"style.css"
],
"write_scope": [
"help.html#troubleshooting"
],
"forbidden": [
"publish",
"deploy",
"commit",
"customer_data",
"credentials"
],
"checks": [
{
"name": "html_validation",
"command": "html-validate help.html",
"expected": "exit code 0"
},
{
"name": "scope",
"method": "inspect_diff",
"expected": "only troubleshooting section changed"
}
],
"stop_when": [
"all checks are reported",
"required input is missing",
"approval-gated action is next"
],
"handoff": [
"patch",
"check_results",
"unresolved_questions",
"unperformed_actions"
]
}
The exact format is not important. The fields are important because they make omissions visible.
Stopping conditions are part of the task
An agent needs a stopping rule even when the work is successful. Otherwise, “helpful” behavior can become scope expansion: refactoring adjacent code, researching unrelated material, polishing optional details, or attempting a release.
Use at least three stopping rules:
- Success stop: all required outputs exist and all required checks are reported.
- Question stop: a missing input, contradiction, or ambiguous instruction blocks a safe decision.
- Authority stop: the next action needs approval or affects an external system.
You can also add a bounded effort rule:
Try up to two reasonable fixes for the failing check.
If the check still fails, stop and report:
- the failure;
- the attempts made;
- the evidence collected;
- the smallest next decision needed from a person.
This is more useful than telling the agent to “keep trying.” A bounded attempt count makes the stopping point observable and protects time, budgets, and systems.
The handoff: how to make the result reviewable
The handoff should let a reviewer answer four questions quickly:
- What changed?
- What evidence supports the result?
- What remains uncertain?
- What did the agent not do?
Ask for a handoff in a fixed order:
Handoff format
Result
[One-sentence outcome]
Changed
- [file or artifact]
- [important change]
Checks
- [check]: PASS / FAIL / NOT RUN
- Command or method: [exact command or inspection]
- Evidence: [short output, diff, or reference]
Limitations
- [known limitation]
- [check not possible and why]
Unresolved questions
- [question, or “none”]
Not performed
- [publish/deploy/commit/message/etc.]
Next approval needed
[The exact action that may happen only after approval]
Require “NOT RUN” when a check was unavailable. This is better than allowing silence to look like success. A report should distinguish “the check passed” from “the check was not attempted.”
Failure cases and how to write for them
Missing input
Failure: The agent proceeds using a guess because a required specification or file is missing.
Brief language:
If the source of truth is not available, stop.
Do not reconstruct requirements from memory or guess from similar files.
State exactly which input is missing.
Contradictory requirements
Failure: “Preserve the current behavior” conflicts with “replace the current behavior,” and the agent chooses one silently.
Brief language:
If two instructions conflict, do not choose silently.
Quote the conflicting requirements in the handoff and ask which one has priority.
Unexpected access
Failure: The agent can see credentials, personal data, or unrelated project areas while working.
Brief language:
Do not open, copy, summarize, or include secrets or personal data.
If the task requires information from a restricted source, stop and request
a redacted input or an approved access path.
Check cannot run
Failure: A tool is unavailable, so the agent implies the result was verified anyway.
Brief language:
If a required check cannot run, mark it NOT RUN.
Give the reason, the attempted command, and a manual alternative if one exists.
Do not label the task verified.
Scope drift
Failure: The agent improves adjacent files because they look related.
Brief language:
Do not modify adjacent files for consistency unless they are listed in scope.
If an adjacent change appears necessary, stop and propose it separately.
External side effect
Failure: The agent sends, publishes, deploys, deletes, or applies a change after preparing it.
Brief language:
Preparation is complete when the artifact and checks are returned.
Do not perform the external action. Wait for explicit approval.
A repeatable workflow from request to handoff
Use this sequence whenever the task matters enough to review:
- Define the result. Describe the artifact or state you want, not just the general intention.
- Name the inputs. List the exact files, records, documents, or supplied facts the agent may use.
- Set the boundary. Identify what is in scope, out of scope, readable, writable, executable, and communicable.
- Write checks. For each requirement, state how a person or command will observe success.
- Add stop rules. Cover success, missing information, ambiguity, approval gates, and bounded attempts.
- Specify the handoff. Require the result, evidence, limitations, unresolved questions, and unperformed actions.
- Review the brief before execution. Ask whether another person could tell what the agent was allowed to do without asking you to interpret it.
- Review the handoff after execution. Check the artifact and evidence independently where the risk justifies it.
Limitations of a verifiable brief
A good brief improves observability. It does not guarantee correctness.
Acceptance checks can be incomplete, a test can miss a defect, a source of truth can be wrong, and a reviewer can misunderstand the evidence. Tool permissions can also be broader than the instructions. For higher-risk work, combine the brief with technical controls such as isolated environments, least-privilege accounts, approval gates, backups, audit logs, and independent review.
There is also a cost to precision. Writing the checks takes time, and some tasks cannot be fully specified in advance. In those cases, define the first bounded investigation, the evidence it must produce, and the decision point where the task will be clarified.
Final checklist
Before giving an agent a task, confirm:
- The desired result is concrete.
- The allowed inputs are named.
- Secrets and personal data are excluded unless explicitly required and authorized.
- The write scope is narrower than the whole project where possible.
- External actions require explicit approval.
- Every important requirement has an observable acceptance check.
- Unavailable checks must be reported as not run.
- The agent has a stop rule for ambiguity and missing inputs.
- The handoff requires evidence, limitations, and unperformed actions.
The central habit is simple: specify the work so that someone else can tell what happened without trusting the agent's summary alone. A clear objective starts the task. A bounded input set, explicit permissions, reproducible checks, and a disciplined handoff make the result verifiable.
Continue with the Agent Lab Journal guides or look up terms in the glossary.