Prompting patterns for agent systems: instruction hierarchy, structured outputs, guardrails, and anti-patterns.

Prompting patterns

Overview

Prompting is an engineering discipline when used in production systems. Good prompts are concise, structured, and aligned with the runtime’s enforcement mechanisms (schemas, policies, and tests).

Key topics

  • Instruction hierarchy: system policies vs user requests vs retrieved context.
  • Structured outputs and schema adherence patterns.
  • Few-shot examples for edge cases and error handling.
  • Refusal and escalation language that is consistent and safe.

Common pitfalls

  • Prompts that try to encode business logic instead of using validation code.
  • Mixing untrusted retrieved text with policies.
  • Overly long prompts that increase cost and reduce accuracy.
  • No versioning or tests for prompts.

Recommended practices

  • Treat prompts as versioned artifacts with change control.
  • Prefer explicit constraints and checklists over long narratives.
  • Use schemas and validators rather than ‘please be correct’.
  • Measure prompt changes via golden-set regression.

This page is intended to be actionable for engineering teams. For platform-specific details, cross-reference /platform/agents, /platform/orchestration, and /platform/knowledge.