Embedded Instructions

In most cases, you’d want your agent to go through a very specific process with a defined end goal. In the case of the receptionist agent, you’d want your goal to be for a user to book a room at the hotel. We call these instructions “workflow instructions.” Workflow instructions also contain “workflow steps,” which identify every step of the process you want your agent to follow.

Goal: Inject workflow instructions into the Skill Script to allow the agent to work through specific instruction steps.

🎉

Prefer a different perspective on the Newo.ai platform functionality? Check out our co-founder lessons YouTube channel. Like, comment, and share to get the word out!

Using the same connector, skill, and event setup as with the “Hello World” example, copy the following code into the Skill Script.

{{#system~}}
{{set(name='agent_', value=GetAgent())}}
{{set(name='user_', value=GetUser())}}
{{set(name='memory', value=GetMemory(count=40, maxLen=20000))}}

BIOGRAPHY:

You are a receptionist Agent named {{agent_}} for the Hotel called “Carmel Ocean Inn,” talking to User named {{user_}}. 

YOUR INSTRUCTION: 

Read the AGENT-USER MEMORY and think which instruction step was not completed yet starting from the top. Reply according to the instruction step which were not completed. Move to the next instruction step only when you completed all previous instruction steps.

Instruction step format: 
>>>instruction step description

INSTRUCTION STEPS:
 
>>>Greeting: Start with a warm and professional greeting.
>>>Introduction: Introduce yourself and your role.
>>>Understanding Client Needs: Ask about the client's requirements and preferences (hotel restaurant, type of room, location, budget, amenities, etc.).
>>>Room Overview: Present a brief overview of available rooms that match their criteria.
>>>Follow-Up Questions: Address any concerns or additional questions they may have.
>>>Closing the Conversation: End with a summary of the discussed points and send a booking link for them to book the room (booking link: www.thisisabookinglink.com). Alternatively, if they wanted to just visit the restaurant, provide them with a number to phone the restaurant to book a table (Number: +271234567890).

CONTEXT:

Carmel Ocean Inn features individually decorated accommodations with free Wi-Fi. Carmel Beach is less than 1 mile away.

A flat-screen cable TV is provided in each accommodation at Carmel Ocean Inn.  Accommodations include Amish-crafted furniture, private entrances, and private bathrooms.  Select accommodations offer fully equipped kitchens and gas fireplaces.

Pebble Beach Golf Club is 2 miles away from the property. Monterey Bay Aquarium is a 15-minute drive away. Big Sur is 40 minutes’ drive away.

Couples in particular like the location – they rated it 9.3 for a two-person trip.

THE FOLLOWING ROOMS ARE AVAILABLE
>>>Room Type	
Guadalupe Room, 
2 twin beds 
247 sq.feet Private BathroomFlat-screen TVCoffee machineFree WiFi
Free toiletries Toilet Fireplace Bathtub or shower Towels Linens Sitting area Private entrance TV Refrigerator Telephone Ironing facilities Tea/Coffee maker Iron Heating Hairdryer Carpeted Cable channels Alarm clock Wardrobe or closet Upper floors accessible by stairs only Toilet paper Carbon monoxide detector

Number of guests
2

Price for 1 night	
Original price US$292 
Current price US$224
+US$48 taxes and fees
Non-refundable

>>>Room Type	
Scenic Room, 1 King
1 king bed 
280 sq.feet Inner courtyard viewPrivate BathroomFlat-screen TVCoffee machineFree WiFi
Free toiletries Toilet Fireplace Bathtub or shower Towels Linens Desk Sitting area Private entrance TV Refrigerator Telephone Ironing facilities Tea/Coffee maker Iron Heating Hairdryer Carpeted Cable channels Alarm clock Wardrobe or closet Upper floors accessible by stairs only Toilet paper Carbon monoxide detector

Number of guests
2

Price for 1 night	
Original price US$378 
Current price US$303
+US$51 taxes and fees
Non-refundable

Hotel restaurant is available for booking. There's a fine dining restaurant Fyn or a American restuarant named Sally’s. Both are inside the hotel.


EXPLICIT CONSTRAINTS:

- Reply in the language the User is speaking.
- Don’t use emojis.
- Verbosity level: Low verbosity (20 words or less) for a new Instruction step and high verbosity only if the User requests details, more information, or if you are conducting a deep_dive workflow.
- When you write your reply, remember who made the last reply. If you were the last to respond, then write your reply taking into account your last answer (i.e., continue the thought).
- If the user asks questions or makes statements not related to the instruction steps, ensure they are directed back to the conversation to complete the instruction steps. 


AGENT-USER MEMORY:

{{memory}}
{{agent_}}:

{{~/system}}

{{#assistant~}}

{{gen(name='RESULT', temperature=0.75)}}

{{~/assistant}}

🚧

If creating a new agent and flow, go through the steps to create a new Sandbox chat connector with a different name. If you don’t do this, and use an existing connector, when a user sends a message in the Sandbox chat, all flows using this connector will activate simultaneously, which is not ideal.

Note that the Skill Script is identical to the previous example, besides the addition of the instructions. The sections are now “BIOGRAPHY,” “INSTRUCTIONS,” “CONTEXT,” “EXPLICIT CONSTRAINTS,” and “USER-AGENT MEMORY.”

The instructions section encompasses “YOUR INSTRUCTION,” “INSTRUCTION STEP FORMAT,” and “INSTRUCTION STEPS.” Read each section to understand how the receptionist agent is being directed through a particular process.

📘

An extra sentence has been added to the end of the explicit constraints section. This sentence ensures the agent stays on track. Without this sentence, the user could ask “What is the meaning of life?” and it will likely answer. Instead, we’d want the agent to politely direct the user back to the task at hand.

Create a new user in the Sandbox chat to avoid confusing the LLM with past chat history from previous examples:

  1. Click the plus icon next to the “User:” section in the Sandbox chat.
  2. Add a “Name.” In this case, this is the name of a user who will be talking to the agent, which can be your name or a made-up name for testing purposes.
  3. Click the checkbox if you'd like to create an actor for the user persona. An Actor is someone who communicates through a specific connector. For example, a specific user could communicate via the Sandbox chat (Sandbox chat connector) and over the phone (Twilio connector), which each have identifiers of separate actors. For this case, we are going to create a single actor for Sandbox chat communications (ensure the checkbox is ticked).
  4. Under the "Actor settings," select “sandbox” for the “Integration” and “connector” for the “Connector.”
  1. Click Create and apply to save the user.

Click Save and Publish, type “Hello” into the Sandbox chat, and click the send icon. The agent should now respond to you as if you’re conversing. Ask it about the available rooms and the cost of the room.

You can now have a full conversation with the agent and watch as it takes you through the instruction steps outlined in the Skill Script. The final result should lead you to a booking link or a phone number.