Agentic AI · Beginner level

Beginner level · Module 3: Prompt Engineering for AI Agents · Lesson 1 of 3

Anatomy of an Agent Instruction

Learners build agent instructions from clear parts (role, task, context, rules, output format) and see how each part changes behaviour.

In this lesson you will

  • Write instructions with role, task, rules and format
  • Explain why each part matters

Key concepts

roletaskcontextrulesoutput format

The lesson

Effective agent instructions have clear parts: who the agent is for (role and audience), what it must do (task), what information it may use (context), what it must and must not do (rules), and how to present the result (output format).

Specific rules beat general advice. 'Be accurate' is weak; 'Answer only from the documents provided; if they do not contain the answer, say so and offer the admissions office's contact' is strong.

Keep instructions in a versioned text file, not scattered in code, so they can be reviewed and improved.

Step by step

  1. Take a one-line instruction and rewrite it with the five parts.
  2. Run both versions on five test questions.
  3. Compare the answers.
  4. Save the new instruction as version 1 with a change note.

Practice activity

Write version 1 of the level project assistant's instructions.

Expected result: A complete, specific instruction set with all five parts.

Check your understanding

  1. Name the five parts of an agent instruction.

    Show answer

    Role, task, context, rules and output format.

  2. Why are specific rules better than general advice?

    Show answer

    They tell the agent exactly what to do in a situation and can be tested.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.