Template Guidelines
Template Best Practices
Lists best practices and checks to apply when tidying up, auditing or reviewing a template.
Use these checks when you tidy up a template after a round of work, or when you review or audit one.
General
- Action names and state names follow the naming standards (see States and Actions).
- There are relatively few states, and they give the process high-level structure.
Prompting
- The chat doesn't have successive system role messages injected. If a dynamic message is needed, use string substitution to build a single system message instead.
- Long prompts with many different instructions, not all of which are needed in every conversation, are broken up using the Agent Guidelines technique.
Actions
- AI-enabled actions return only the key information in
ai_inject_return_data. - AI-enabled actions don't return data that was passed into the action in the first place.
- Action descriptions say briefly when to use the action and hint at what it returns.
- Where a value must come from a finite set, the action uses the
selectfield type. - Field types suit the data being collected.
Standard actions
- A production agent has the
calendarandcalculatorlibrary actions, which give it awareness of the current time and a general calculator.
Agentic flows
- If an agent is started on the
_createaction, it is ordered after any tasks that prepare data for the agent or for actions the agent might call.
Notification platforms
- If the agent runs on webchat, actions send webchat status messages (a task sending a
_stubber_webchat_status_messagecontrol event). - On WhatsApp flows, larger actions show a typing indicator so the user knows the agent is busy.
- On webchat, the agent is instructed to use markdown, but not headings.
Evals
- The template has eval scenarios covering the common cases: the main happy paths, the most frequent user requests, and key edge cases such as missing information, out-of-scope questions and handoff or escalation.
- Each important AI-enabled action or behavior the agent is relied on for is exercised by at least one scenario.
- Scenarios are added or updated whenever the agent's behavior, prompts or actions change significantly, and run before publishing.
Annotations
- The flow has a README annotation explaining the flow's key functions and why it exists.
- The flow has heading annotations marking the main areas where actions are.
Enterprise features
Enterprise applications also need:
- input, output and penultimate system message rules (see the Safeguards technique)
- cost control
Flowpilot can run these checks for you: ask it to review your template against best practices and suggest improvements.