Documentation

Prompt Sandwiching

iostack implements a synthetic sandwich mechanism when specifying prompting for stages in your agent.

The sandwich consists of a set of agent-wide prefix and suffix prompts that bracket each stage-specific prompt. When the agent is compiled, each stage is compiled and this sandwich is assembled from the agent-wide prefixes and suffixes and the state’s prompting.

The resulting ‘sandwich’ is stored as the final prompt for each stage.

Prefix and Suffix Prompts

Agent-wide prefix and suffix prompts are configured in the Common Stage Settings section of the Agent.

As the name suggests, these are prompts that are prepended to the beginning or appended to the end of each stage’s prompting.

Prefix and suffix prompts are intended for instructions that apply to the entire agent. These may include:

  • Agent name and role,
  • Personality and tone of voice
  • Any general information about your company or the purpose of the agent
  • How you want them to format responses if that is relevant
  • Any other behaviour that you want to be common across the entire use case or conversation of the agent

Stage-Specific Prompts

As is probably obvious, this is the prompting required to specialize the LLM behaviour for a specific stage.

You can configure stage-specific prompting by clicking on a stage and editing the prompting there.

As mentioned, Agent-wide and stage-specific prompting are assembled together into the prompt ‘sandwich’ during compilation and used when the Agent runs.

On this page