1. Template Guidelines
  2. Prompting

Template Guidelines

Prompting

Explains how to write system prompts and action descriptions for AI agents, including the prompt sandwich structure.

An agent template can have multiple prompt components.

System Type Prompts

These are "instruction-giving" and "goal-giving" prompts that contain key details about such topics as :

  • How to converse
  • What process to follow
  • Rules and guidelines
  • High level goals

General Guidelines

  • System Type Prompts appear at the start of a context window
  • Ideally there should not be multiple system prompts injected at the start of the chat, rather substitute (with string substitution) other prompt elements in to forge a single "system" message into the context
  • Do not specify the exact names of actions (tools) to call, refer to the action that is needed so that if actions get renamed there is no need to change the prompt
  • Only specify explicitly fields required in actions to emphasize some aspect of the process to follow
  • In general the agent will get the actions exposed as tools and the fields as parameters to the tools and won't need explicit prompting

System Prompt Structure

  • Break the prompt up into sections with header level markdown hash tags
  • The system prompt should end with a # Summary section where the key goals and guidelines are highlighted in point form.

Action Description Prompts

  • Make sure action names begin with verbs
  • Ensure that the description contains a short description of WHEN to use, as well as hinting at the OUTPUT of the action
  • Mention if the action will transition the state so that that agent can infer further steps

System Prompt Best Practices

  • Give the agent a persona and communication style
  • Give the agent higher level goals and describe in short what success looks like
  • Do not over prescribe the steps to follow, as the Stubber framework guides this with actions and states
  • Clarity and brevity are valuable, think about how to tailor the prompt to have a high signal to noise ratio, that means the prompt should have high informational value and avoid lots of filler text

The Prompt Sandwich

A good system prompt follows the "prompt sandwich" approach.

  1. Top Bread (Instruction Layer)

    • Clear rules, constraints, or style guidelines for the response
    • A persona and communication style
    • Details and background about the company the agent is representing
    • Reference to the communication channels the agent is exposed to
  2. Filling (Task)

    • The actual requests or problems the agent must handle
    • Details on how to conduct the conversation
    • Details of specific steps to follow (if any)
  3. Bottom Bread (Reinforcement)

    • Reiterates the key expectations, tone, or constraints
    • Instructs the agent to focus only on the task defined and not engage in general discussion
    • Summarizes the main points
    • Ends with a one liner that sets the tone for the conversation, eg. "Engage with the customer and assist where you can."

Runtime Data

  • The agent does not get the stub state or stub.data automatically, it needs to be given to the LLM agent by substitution into the prompts or messages.