Agent Script Pattern: Avoid Conflicting Instructions with Instruction Overrides

Override system-level instructions (or "agent-level" instructions in the UI) within specific subagents to change the agent's behavior and persona dynamically.

By default, all subagents inherit the agent-level system.instructions. When you add a system block to a specific subagent, those instructions override the system ones for that subagent only.

If your agent-level system instructions contradict subagent-level reasoning instructions, your agent can hang or behave unexpectedly. System overrides solve this by explicitly replacing system instructions when needed.

Also, system overrides let a single agent adopt different personalities, tones, or behaviors in different contexts—useful when you need the agent to act differently in specific subagents while maintaining consistent behavior elsewhere.

Pattern Example: An event planner agent normally avoids suggesting alcohol, but for an adult-only party subagent, override the system instructions to allow cocktail recommendations.

Agent Script follows this hierarchy when determining which system instructions to use:

  1. Topic-level system instructions (highest priority) - If a subagent has a system block, the agent uses those instructions
  2. Agent-level system instructions (fallback) - If a subagent has no system block, the agent uses the global instructions

When agent-level system instructions contradict subagent-level reasoning instructions, the agent must resolve the conflict, which can cause unexpected behavior.

Problem: An event planning agent has global instructions "Never suggest alcoholic beverages at a children's party" but a subagent for a children's party with adults wants to suggest champagne in its reasoning instructions.

Solution: Use a system override to explicitly replace the system instructions for that specific subagent.

Create different personas for different contexts.

Use overrides when:

  • Resolving instruction conflicts. When agent-level system instructions contradict what a specific subagent needs to do. Conflicting instructions can cause unexpected behavior in agents.
  • Different subagents need different tones. A casual FAQ subagent vs. a formal compliance subagent. Technical experts vs. non-technical users. Casual tone vs. professional and apologetic tone. A billing specialist vs. a technical support specialist.