Providing Instructions
The instruction text serves as a framework for guiding the Agent in processing user inputs. These instructions are integral to maintaining the model's focus and delivering relevant and appropriate responses. When providing instructions, you may want to follow these guidelines:
Scope: Establish the range of tasks, topics, or types of queries the Agent is equipped to address.
Restrictions: Provide any necessary guidelines or limitations the model must adhere to. This may include content moderation, adherence to privacy laws, and ethical use guidelines.
Response Format: Dictate the structure of responses, including their length, detail level, and style (e.g. professional, informative). This standardizes the user experience.
Contextual Understanding: Provide instructions on how the model should integrate and utilize context from external data and routines you make available.
Regular Updates: Continuously review and revise agent instructions to align with new developments or evolving user requirements.
For example, an HR Assistant Agent may contain instructions about which HR policies to use, which data is available to the Agent, privacy considerations in handling sensitive employee data, compliance with labor laws and regulations, and providing clear, accurate responses to HR policy questions.
Application Variables
Variables allow you to adjust instruction details based on the current application state. For example, if the agent is operating as an assistant within a CRM application, variables can provide context such as the current customer the application user is working with.
Variables will adjust instructions on-the-fly, even when they are changed mid-conversation. For example, the user can open one customer record and ask about the customer’s opportunity list. They can then proceed to open another customer and follow up with a simple “How about this customer?” The agent will then use both the conversation’s thread and the new customer details to provide the opportunity list for the new customer in view.
To add variables, click on the Variables link above the Instructions text area. A separate dialog will appear. Add or remove the desired variables along with sample values for each variable. The sample values are used for testing the agent in the Agent Preview area of the IDE.
Click the “Insert Variable into Instructions” icon to add a specific variable into the instructions text area at the cursor. Variables are not passed along to the agent unless they are used in the instructions.
Dynamic Content
Dynamic instruction content, including variables, is provided using Template Literal Notation and/or EJS Syntax. In addition to using previously defined variable names, dynamic content can include Node.js / JavaScript expressions that output dynamic content, execute code, or implement conditional and repeating content.
Template Literal Notation
Template literal notation uses the dollar sign and curly braces to signify a variable or an expression. For example: ${customerName} or ${customerName.trim()}.
EJS Support
EJS Syntax allows you to both control the instruction output and its flow. Use the <%- someOutput %> syntax to control the instruction output. Use the <% code %> to control the flow. Template literals can be used together with EJS syntax desired.
For example:
The current customer number is: <%- customerNumber %>. The customer name is: ${customerName}. <% if (opportunities.length > 0) { %> The following is a list of customer opportunities: <% for (let opportunity of opportunities) { %> - <%- opportunity.description %> <% } %> <% } %>