APE Prompt Framework: Complete Guide with Examples (2026)

Last updated June 28, 2026 · 2 examples · Works with ChatGPT, Claude, Gemini
Quick Answer

APE is a three-part prompt framework: Action defines what the AI should do, Purpose explains why — the underlying goal — and Expectation specifies the desired output. The Purpose field is what distinguishes APE from RTF: giving the AI your reason produces outputs better aligned with your actual intent.

What Is the APE Prompt Framework?

APE puts Purpose at the center of the prompt. Where RTF and RACE lead with Role, APE leads with what needs to happen and why. This matters because AI models use stated purpose to make better judgment calls when the task is ambiguous or when multiple valid approaches exist.

What Does APE Stand For?

Purpose-first framework — aligns output with your underlying goal.

A
Action
The specific task to perform. What should the AI do?
P
Purpose
The underlying goal or reason. Why does this need to happen? What will the output be used for? This is the most important field in APE.
E
Expectation
The desired output — format, length, tone, constraints.
+R
Rules (optional)
Cross-cutting constraints added by Promptary as an optional fourth field.

When to Use APE

Use APE when the purpose behind a task is not obvious from the action itself, or when you want the AI to make judgment calls aligned with your goal rather than executing literally.

APE Examples

Error message rewrite
Action: Rewrite the following technical error messages in plain English.
Purpose: These appear to non-technical end users of our SaaS product. The goal is to reduce support tickets by helping users understand what went wrong and what to do next.
Expectation: One sentence explaining what happened, one sentence on what to do. Under 25 words total per error. No technical jargon.
Pricing page copy
Action: Write feature bullet points for our Developer plan.
Purpose: The goal is to convert free users to paid. Free users already understand the product — these bullets should make the value of upgrading obvious, not explain what the product is.
Expectation: 5 bullets, max 12 words each. Lead with the benefit, not the feature name. Active voice.

APE vs Other Frameworks

APE vs RTF: RTF skips Purpose entirely; APE makes it the central field. APE vs RACE: RACE adds Role and Context which improve outputs further. APE is best when purpose alone is the key alignment mechanism.

Use this APE template in Promptary — free

Save your first APE prompt in the structured editor and get a permanent REST API endpoint. Personal plan is free forever, no credit card required.

Start free

Frequently Asked Questions

What does APE stand for in prompt engineering?

APE stands for Action, Purpose, and Expectation. The Purpose field — explaining why the task matters — is what distinguishes APE from simpler three-part frameworks like RTF.

What is the difference between APE and RTF?

RTF uses Role, Task, Format. APE uses Action, Purpose, Expectation. The critical difference is Purpose: APE asks you to explain why the task matters, which helps the AI make better judgment calls on ambiguous tasks.