How to Write AI Agent Instructions That Actually Work

Treat an AI agent instruction set like an operational brief: define one job, write atomic steps, handle exceptions and make the output easy to check.

12 October 2026 · Analytico AI

The reliable way to write AI agent instructions is to treat them as an operational brief, not a personality prompt. Name one job, give the agent the exact workflow, specify the sources and tools it may use, explain what to do when information is missing, and show what a good result looks like.

An agent can infer some context, but important business decisions should not depend on inference. Microsoft recommends structuring instructions around purpose, guidelines, skills, steps, limitations, examples and feedback; OpenAI similarly recommends clear, specific prompts and iterative refinement. Read Microsoft's guide to effective agent instructions and OpenAI's prompting guidance for the source principles.

Abstract digital blueprint connecting purpose, workflow and output in an AI agent instruction set
A good instruction set connects the agent's purpose, workflow and checkable output.

An AI agent instruction set should read like a precise brief for a capable new teammate: what to do, how to do it and when to stop.

Quick answer

Strong AI agent instructions have six parts: a single purpose, a bounded workflow, named knowledge and tools, explicit exception paths, a stable output format and a small test set that you improve over time.

01 - Define the job

Start with one job and a measurable finish line

Begin with the work the agent is responsible for, not the personality you want it to project. Write one sentence that names the user, the task, the information it may use and the result it must produce. If the sentence contains several unrelated jobs, split the scope before writing more instructions.

A useful brief answers three questions: what starts the work, what inputs are required and what proves that the task is done? This complements our AI agent use case readiness checklist, which helps teams choose a workflow that is repeated, reviewable and worth improving.

Abstract digital workflow showing goal, input and output as the three parts of an AI agent job
Before adding clever behaviour, define the job, the required input and the condition that makes the output complete.
  • Who is the agent helping, and which workflow does it own?
  • What information must be present before the task can start?
  • What output can a person verify quickly?
  • What is outside the agent's job and should be redirected?
02 - Write the workflow

Turn the job into atomic steps and transitions

An agent instruction becomes easier to follow when each step has one goal, one action and one transition. “Review the request and update the record” is two actions; separate them so the agent knows what to do first, what data to use and when it may move on.

Use ordered steps only when order matters. Use bullets for parallel rules. Name the actual tool or source at the step where it is needed, and specify what the agent should do if the required input is missing. The OpenAI guide to building agents makes the same practical point: smaller steps, clear actions and edge cases reduce ambiguity.

Abstract digital diagram showing an AI agent workflow broken into trigger, gather, act and check steps
Atomic steps keep the agent from blending several actions into one ambiguous instruction.
Vague

Review the request, find the answer, update the system and notify the team.

Atomic

First classify the request. Then search the named source. Only after the result is verified, prepare the update for review.

03 - Separate the layers

Keep rules, knowledge and tools distinct

Instructions should tell the agent how to behave and how to use its capabilities. Knowledge sources should provide facts, policies and records. Tools should retrieve information or perform approved actions. Keeping these layers distinct makes the system easier to update and reduces the chance that a document is mistaken for an instruction.

Microsoft explicitly warns that knowledge source content is not the same as trusted maker-authored instruction content. For company data design, see our guide to preparing company knowledge for an AI agent; it covers source ownership, permissions and freshness without turning every document into a behaviour rule.

Abstract digital diagram separating AI agent rules, knowledge and tools before they reach one agent
Separate behaviour rules from business knowledge and tool actions so each layer has a clear owner.
Key principle

Tell the agent where to find a fact and how to use it; do not bury changing business facts inside permanent behaviour instructions.

04 - Handle the edges

Write the exception path before the happy path feels finished

Real work rarely arrives complete and perfectly formatted. Tell the agent what to do when an input is missing, a request is ambiguous, a tool fails, a source disagrees or the user asks for something outside scope. “Be helpful” is not an exception path; a focused question, a safe stop or a human handoff is.

Keep the handoff specific: name the trigger, the information to preserve and the person or queue that takes over. This turns guardrails into an operational workflow, which is the focus of our guide to AI agent judgment and guardrails.

Abstract digital workflow branching into ready, ask and escalate paths for AI agent edge cases
A reliable agent needs a visible path for normal work, clarification and human escalation.
  • What should happen when a required field is missing?
  • When should the agent ask one focused question?
  • Which failures require a safe stop or human handoff?
  • What context must be passed to the person who takes over?
05 - Shape the result

Specify the output format and show good examples

If the result matters, describe its format. State the tone, level of detail, field order, allowed values and what the agent should say when it cannot verify something. A stable output is easier to review, compare, hand off and connect to the next step in a digital workflow.

Examples make the intended quality concrete. Use a small set of normal and edge-case examples rather than a giant library of nearly identical prompts. Then add a final self-check, run the instructions on representative work and refine one change at a time. Our guide to measuring AI agent performance before scaling shows how to turn those examples into a practical evaluation habit.

Abstract digital diagram showing a request transformed into a structured AI agent output with checkable fields
A defined output format gives people a consistent result to verify instead of a paragraph that changes shape every time.
Remember

Examples are not decoration; they show the agent what good, incomplete and out-of-scope work should look like.

06 - FAQ

Frequently asked questions

What are AI agent instructions?

AI agent instructions are the operating directions that tell an agent its purpose, workflow, available sources or tools, boundaries, exception handling and expected output.

How long should AI agent instructions be?

They should be as short as possible while still covering the job, required steps, transitions, edge cases and output format. Structure and completeness matter more than a target word count.

Should agent instructions include company knowledge?

Instructions should explain how the agent should use company knowledge. Keep factual policies, records and source material in the appropriate knowledge source instead of mixing them into a long instruction block.

How do you test AI agent instructions?

Run the instructions against representative normal cases, incomplete inputs, out-of-scope requests and known failure cases. Record the result, change one part at a time and retest the same set.

07 - Guided build

Write better instructions by building a real agent

Instruction writing gets clearer when you can see the workflow run. The Applied AI Agents workshop is a hands-on next step for working professionals who want to turn a real process into a bounded agent, connect it to useful tools and learn by testing the result.

You do not need to start with a perfect prompt. Bring one real workflow, write the first brief, test it on representative cases and let the failures tell you which instruction is missing.

Build an Agent That Knows What to Do

Bring a real workflow, write clear instructions and build a working AI agent with practical human review and useful next steps.