Global instructions
Global instructions define your agent’s core personality, behavior, and universal guidelines that apply throughout the conversation. These instructions are pinned and always active, regardless of the current state.Example global instructions
State instructions
State instructions guide your agent’s behavior within specific conversation states. Each state represents a distinct phase or purpose in the conversation.State instructions structure
For each state, consider including these sections for clarity:Main steps
Main steps
Instructions outlining the primary flow of conversation within the state.Example:
Alternative steps
Alternative steps
Instructions for handling exceptions, unexpected responses, or alternative paths.Example:
Guidelines
Guidelines
State-specific notes or guidelines for handling the conversation.Example:

Key elements to include
Variables
Specify which variables can be accessed within the state.
For more information on how to use variables, see.
Transition conditions
Define conditions for transitioning to other states.
Tools
Specify which tools the agent can use and how to use them in this state.
Formatting tips
Use bullet points within state instructions to aid in planning and ensure all necessary information is collected sequentially.
Use indentation (tabs) for sub-instructions to show hierarchy and make instructions easier to read. You can use sub-bullet points for deeper levels.
Writing effective instructions
Be specific and clear
Be specific and clear
Write instructions that are unambiguous and actionable. Use clear language and avoid vague directions.Good example:Poor example:
Include error handling
Include error handling
Anticipate and provide instructions for handling common issues or edge cases.
Structure hierarchically
Structure hierarchically
Use indentation and bullet points to show relationships between instructions.