...
When deploying the agent, make sure to to replace the sample values with dynamic expressions.
Securing Variables
Dynamic Content
Dynamic instruction content, including variables, is provided using Template Literal and/or EJS Notation. 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.
...
Code Block |
---|
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 %> <% } %> <% } %> |
Calling Routines
You can directly invoke Agent Routines from Agent Instructions using the call()
API. This approach enables integration of server data into instructions, allowing database access, program calls, and consumption of Web Services.
Begin by creating the appropriate routine, and defining its input and output parameters. You can mark the routine private to ensure that the large language model doesn’t attempt to call it autonomously. Then, include the routine call in your instructions using EJS syntax. Here is an example:
Code Block |
---|
<%
const { customerNumber, customerName } = await call("get session data", { sessionId });
%>
The current customer number is: <%- customerNumber %>.
The customer name is: <%= customerName %>. |
In this instance, customerNumber
and customerName
are retrieved from server-side data, while sessionId
is an Instruction Variable sourced from the browser. This method effectively marries server-side capabilities with client-side interactions, allowing for a seamless and secure use of your data.