The 4-Part Prompt Formula — Role, Goal, Format, Limits Explained

The 4-Part Prompt Formula — Role, Goal, Format, Limits Explained

The 4-Part Prompt Formula — The Structure Behind Every Reliable AI Agent

Role + Goal + Format + Limits. Why this structure works, how to apply it to any use case, and the 10 most common ways builders get it wrong.

The single biggest factor in AI agent output quality is not the model you choose — GPT-4o and Claude 3.5 are both excellent. It is not the tool you use — Make.com and n8n both work well. It is the prompt. Specifically, whether your prompt gives the model everything it needs to produce reliable, usable output on the first attempt — or whether it leaves enough ambiguity that the model has to guess, and sometimes guesses wrong.

The four-part formula has emerged from years of production prompt engineering and is now the standard structure for any system prompt that needs to work reliably across diverse inputs.

Part 1: Role — Who Is the Agent?

The role tells the model what perspective to take, what knowledge to draw on and what kind of output is appropriate. A generic role produces generic output. A specific, expert role produces specific, expert-level output.

Compare these two role definitions:

Generic: "You are a helpful assistant."

Specific: "You are an expert B2B sales researcher with 10 years of experience identifying company pain points, competitive positioning and buying triggers for SaaS companies targeting mid-market businesses with 50-500 employees."

The specific role gives the model three things the generic one does not: the domain context (B2B sales research), the expertise level (10 years, expert), and the target context (SaaS, mid-market). Every element of this role changes how the model approaches the task — what information it prioritises, what format feels appropriate, what level of sophistication it aims for in its analysis.

Part 2: Goal — What Must It Achieve?

The goal defines the task completely and includes the context the agent needs to understand what a genuinely useful result looks like. Vague goals produce vague outputs. Specific, complete goals produce specific, usable outputs.

Vague: "Research this company."

Specific: "Research [company_name] and return the following information: a two-sentence company overview (what they do, who they serve), their main product or service in one sentence, their employee count and funding stage, three bullet points of news from the last six months only (dated), and their top three likely pain points that a sales automation tool would solve."

The specific goal tells the agent what to include (and implicitly what to exclude), how much to write for each element, the recency requirement for news, and the framing for pain points. The agent cannot guess wrong about what a good result looks like — it is defined precisely.

AI Agent Bible Trilogy — Complete Bundle

Get all 30 production-tested system prompts across the trilogy

All three volumes in one bundle. Vol. 1 (Beginner) · Vol. 2 (Intermediate) · Vol. 3 (Expert). 148 pages · 30 workflows · 30 system prompts · 180-day structured learning path.

Get the Complete Bundle →

Part 3: Format — How Should It Respond?

Format specification is the most commonly skipped element of the formula — and the one that causes the most downstream problems. If your workflow needs to parse the AI output automatically, extract specific fields and take different actions based on the content, you need the output to be structured consistently. An AI response that sometimes returns a bulleted list and sometimes returns flowing prose is not usable in an automated workflow.

For workflow use: specify JSON with exact field names. For human reading: specify headings, and the exact content each heading should contain. For classification tasks: specify the exact return values — "URGENT", "REPLY", "FYI", "SPAM" — with no additional text, no punctuation, no explanation.

Part 4: Limits — What Should It Avoid?

Limits are where most prompts fail. They define the boundaries of acceptable output and tell the model how to handle edge cases — the inputs that do not fit neatly into the expected patterns. Without limits, the model guesses — and sometimes guesses in ways that break your workflow.

The most important limits to include: what to return when information is unavailable (write [Not found] — never guess or estimate), maximum length for each section, what sources to use and which to avoid, language requirements, and how to handle off-topic inputs.

The limit that prevents the most downstream problems: "If any required information is unavailable, write [Not found] in that field. Never estimate, infer or generate information that cannot be verified." This single instruction eliminates confident hallucination — the most dangerous failure mode in any production AI agent.

The complete path from zero to production AI architect.

Vol. 1 — AI Agents Made Simple: 10 tools, 10 workflows, 10 prompts, 30-day plan. No code required.
Vol. 2 — AI Agents Unleashed: Prompt chaining, RAG, multi-agent systems, n8n, 60-day plan.
Vol. 3 — AI Agents Mastery: ReAct, LangGraph, vector databases, autonomous agents, 90-day plan.

Get the AI Agent Bible Trilogy →

3 instant PDF downloads · 148 pages · 30 workflows · 30 prompts · 180-day learning path