1. Template Techniques
  2. Finite Progress Options

Template Techniques

Finite Progress Options

Explains how finite select-field options and state transitions keep AI-assisted workflows deterministic.

Using the Stubber Framework allows you to get deterministic business rules adherance. One way to achieve this is to have an action with a select field that presents a finite set of options for the AI agent to choose from to progress.
The stub then transitions to different states based on the option being selected. In each of those states an "enter" state task can be added to inject new prompt instructions to continue the process.

Detailed Example Structure

  • A conversational agent offers a customer two categories of support billing or technical
  • An action called start_ support contains a select field called support_type that has an array of 2 objects with the label and value keys both being set to billing and technical in each object
  • The select keys are set to snake_case options
  • This select field gets presented as an enum to the LLM
  • The action contains a to_state defined for each option, conditioned on the value of the support_type field
  • When the AI agent runs the action the state transitions
  • In each state "billing-support-in-progress" and "technical-support-in-progress" there is a "on-enter" state task defined
  • The "on-enter" state task is a gpt_chat_task that injects a new system prompt with detailed instructions for the respective support type