PM-301e · Module 3

Agentic Prompt Hardening

5 min read

Agentic prompts have more failure surfaces than single-turn prompts. Every step is a failure point; every tool call is a failure point; every handoff is a failure point. Hardening addresses the systematic failure modes: agent loops, infinite retries, silent failures, and missing stopping conditions.

  1. Explicit Stopping Conditions Define when the agent stops: "Stop when all subtasks in the decomposition have produced their specified outputs, or when any subtask fails and cannot be recovered. Do not invent additional steps beyond the approved plan." Without explicit stopping conditions, agents continue indefinitely, inventing new tasks after completing the assigned ones.
  2. Success Criteria Define what constitutes task completion: "The task is complete when: [specific verifiable conditions]. Do not declare completion before verifying each criterion." Success criteria prevent premature completion (declaring done before the work is finished) and over-completion (adding unrequested work).
  3. Escape Hatches Define conditions that trigger human escalation: "Escalate to the operator (output [REQUIRES_HUMAN] followed by explanation) if: the task requires permissions not available in the current tool set, the task contradicts the original instructions, or 3 consecutive steps have failed." Escape hatches prevent agents from attempting the impossible indefinitely.
  4. Loop Detection Some agents get into action loops — they take the same action repeatedly without making progress. Detect by tracking action history: "If the last 3 actions are identical, stop and output [STUCK] with the action that is repeating and the reason for the repetition." Explicit loop detection converts infinite loops into diagnosable failures.
## STOPPING CONDITIONS

COMPLETE when:
□ All subtasks in the approved plan have produced their specified outputs
□ All output has been delivered to the specified destination
□ You have confirmed completion of each success criterion listed below

SUCCESS CRITERIA:
[list specific, verifiable criteria here]

STOP AND ESCALATE (output [REQUIRES_HUMAN]) when:
- Any required tool is unavailable or returns permission denied
- The task as specified is internally contradictory
- 3 consecutive steps have failed with different error types
- Required information is not available through any available tool
- The task would require actions outside the approved plan

STOP AND REPORT STUCK (output [STUCK]) when:
- The same action has been attempted 3 times without progress
- The agent has been in a reflection loop for more than 3 iterations without taking action

DO NOT:
- Invent steps not in the approved plan
- Continue past a failed prerequisite step
- Declare completion before verifying all success criteria
- Attempt more than 2 retries on any single tool call