Writing instructions an AI agent can actually follow
How to write agent instructions that work: start from your own procedures, make each step an action, cover awkward cases, add examples, then test each change.
Updated 2026-11-30. "(source N)" refers to the numbered list at the end.
The part you control
Every agent has a model, some tools and a set of instructions. You rent the first two. The third is yours, and it is usually where a small business gains or loses the most. OpenAI's guide for agent builders says vague wording leads to more mistakes, and that the effect is bigger for agents than for a plain chat assistant, because an agent acts on what it reads (source 1).
You do not need to be technical to write good ones. You need to know your own job well enough to explain it to someone new.
The new-hire test
Anthropic suggests imagining a sharp new employee on their first morning. They are capable, but they know nothing about your customers, your rules or your habits. The clearer your explanation, the better the output (source 2).
Anthropic also offers a quick check. Hand your draft to someone with no background in the task and have them work through it. Wherever that person would need to stop and ask questions, the model will struggle too (source 2).
Start from documents you already have
You rarely need to write from scratch. OpenAI recommends reusing your current standard procedures, customer-service scripts or written policies as step-by-step routines. In customer service, a routine can roughly match one article in your help centre (source 1).
OpenAI even shares a sample request for this: ask a capable model to rewrite a help-centre document as a numbered list of directions for an agent, with no room for ambiguity (source 1). Treat the result as a first draft, then read it yourself and fix anything that does not match how you really work.
Make every step an action
Dense policy text is hard to follow. OpenAI says smaller, clearer steps cut down on misreadings, and that each step should end in one concrete thing the agent does or produces. Examples include asking the customer for an order number or looking up an account. It adds that fixing the exact wording of a customer-facing message leaves even less to chance (source 1).
Anthropic agrees on format: when sequence or thoroughness matters, put the steps in a numbered or bulleted list (source 2).
- Vague: "Handle refund requests politely."
- Better: "Ask for the order number. Look up the order. If it was delivered within the refund window in our policy, draft a refund reply for a person to approve. If not, draft a polite decline that quotes the policy."
Cover the awkward cases
Real customers give half the information, change their mind or ask something unexpected. OpenAI advises writing for these cases up front, with a fallback step when a needed detail is missing (source 1).
It also names two moments when an agent should pass the job to a person: when it keeps failing at the same step, and when the action is sensitive or cannot be undone, such as large refunds or payments (source 1). Our article on keeping a human in the loop covers where to place them.
- Missing detail: say what to ask for, and how many times to ask before giving up.
- Unsure: tell it to say so and hand over, rather than guess.
- Irreversible or costly: tell it to stop and ask a person every time.
Give reasons, and show examples
A bare rule is weaker than a rule with a reason. Anthropic's own illustration is a ban on ellipses in replies. The model follows it better when told that the replies will be spoken by a voice tool, because it can then apply the idea to similar cases (source 2).
Examples work even better than explanation for tone, length and layout. Anthropic recommends three to five that match your real use and differ from one another (source 2). Google likewise says examples show the model what a good answer looks like, but warns that too many can make it copy them too closely, and that every example should use the same layout (source 4).
Give it a clear structure
A long block of text is hard for people and models alike. OpenAI describes a typical layout with four parts, usually in this order: who the assistant is and how it should sound, the rules, a few examples, and any background material it needs (source 3).
Do not assume the model already knows your facts. Google advises putting the needed background into the prompt rather than hoping the model has it (source 4). If you paste in long reference documents, Anthropic suggests placing them at the top and your actual question at the end, which improved answers by up to 30% in its tests on complex, multi-document input (source 2).
Tools need instructions too
An agent also reads a short description of each tool it can use. Anthropic's advice is the same as for your own instructions: describe each tool as you would to a new colleague, spell out anything you take for granted, and use clear names, such as a customer ID instead of just a user (source 6).
Anthropic's team says that on one of its own agent projects it spent more time refining tools than refining the main prompt (source 5). If you connect tools through MCP, the descriptions come from the server's author, so read them before you rely on them.
Change one thing, then test again
Instructions rarely work on the first try. Google suggests rewording a prompt or recasting the task in a similar form when the model ignores you (source 4). Anthropic's broader advice is to begin with simple prompts and add complexity only when simple ones fall short (source 5).
Treat each edit as an experiment. Keep a dated copy of every version, change one thing at a time, and rerun your test cases. OpenAI warns that different snapshots of the same model family can respond differently, so it recommends pinning production use to a specific snapshot and keeping tests that measure how your prompts behave (source 3). Our pilot article shows how to build a test set.
Sources
Written by Agents Lookup in our own words. Facts come from these pages:
- 1. OpenAI: A practical guide to building agents: cdn.openai.com/business-guides-and-resources/a-practical-guide-to-building-agents.pdf
- 2. Anthropic: Prompting best practices: platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices
- 3. OpenAI: Prompt engineering: developers.openai.com/api/docs/guides/prompt-engineering
- 4. Google AI Studio: Prompt design strategies: aistudio.google.com/docs/prompting-strategies
- 5. Anthropic: Building effective agents: www.anthropic.com/research/building-effective-agents
- 6. Anthropic: Writing effective tools for agents: www.anthropic.com/research/writing-tools-for-agents