Key facts
- Use for
- Turning an agent spec into runnable instructions.
- Do first
- Decide whether the system should be an agent.
- Must include
- Tools, guardrails, stop rules, and escalation.
- Do not include
- Broad permission or hidden product decisions.
The prompt is the last contract, not the first
The system prompt should not be where the team invents the product. It should encode decisions that already exist in the PRD and technical spec: what the agent may do, what it may inspect, what it may change, when it must stop, and how a human reviews risky cases.
A weak prompt says "be careful and helpful." A strong agent prompt names the exact tool boundary and the exact failure behavior. The model can still make mistakes, so the application must enforce the same rules in code.
Copyable system prompt template
You are [AGENT_NAME].
Mission:
[ONE SENTENCE GOAL]
Operator:
[WHO USES OR REVIEWS THE AGENT]
Allowed tools:
- [TOOL_NAME]: [WHAT IT DOES] [READ-ONLY / INTERNAL WRITE / EXTERNAL SIDE EFFECT]
- [TOOL_NAME]: [WHAT IT DOES] [READ-ONLY / INTERNAL WRITE / EXTERNAL SIDE EFFECT]
Operating rules:
- Use only the allowed tools.
- Validate required inputs before calling a tool.
- Prefer the smallest safe action.
- Cite approved sources or tool outputs when making claims.
- Never perform forbidden actions: [LIST].
Stop conditions:
- Success criteria are met.
- Required input is missing.
- Tool errors repeat.
- Cost, step, or time budget is reached.
- A risk flag requires human review.
Escalate when:
- [RISK FLAG]
- [LOW CONFIDENCE RULE]
- [POLICY OR COMPLIANCE RULE]
Final response:
- Status
- Actions taken
- Evidence or citations
- Unresolved uncertainty
- Human review needed, if any Tool rules belong in the prompt and in code
The prompt should tell the model how to think about tools, but code must still validate every tool call. Name the argument schema, permission level, timeout, retry behavior, and audit log for each tool. If a tool writes to a customer, account, filesystem, payment rail, or deployment target, put it behind explicit approval first.
This is why the agent spec generator starts with tools and guardrails instead of prose style. The prompt is only one layer in a larger contract.
Turn prompt rules into evals
Every prompt rule should become an evaluation fixture or assertion. If the prompt says to escalate billing cases, include a billing case. If it says to cite approved docs, assert citation presence and source allowlist. If it says to stop after six tool calls, test the stop reason.
Do not evaluate only final writing quality. Agent prompts govern route choice, tool arguments, state updates, and stop conditions. The trace is part of the output.
Sources used
- Agents SDK OpenAI Developer Docs. Accessed 2026-07-06.
Defines agents as applications that plan, call tools, collaborate, and keep state.
- Function Calling OpenAI Developer Docs. Accessed 2026-07-06.
Official guide to exposing application functions and external systems to models through tools.
- Tool Use with Claude Anthropic Platform Docs. Accessed 2026-07-06.
Explains how Claude selects tool calls and how applications execute client-side tools.
- Guardrails OpenAI Agents SDK. Accessed 2026-07-06.
Explains input, output, and tool guardrail boundaries in OpenAI Agents SDK workflows.