Before any technical integration with GenerativeAgent, you must first define the tasks and the functions that the GenerativeAgent will perform to help your organization.

Tasks

Tasks encompass instructions and Functions.

Tasks are the actions that GenerativeAgent will perform.

Functions

Functions are the set of APIs needed to perform a task with its instructions.

Instructions

Instructions define the business logic and acceptance criteria of a task.

The goal of all instructions is to deliver the desired outcome using the minimum number expressions.

Best Practices

Clearly defining tasks is key in configuring GenerativeAgent, as the GenerativeAgent acts on the tasks you as it to perform and solve customer issues across your apps.

When writing or defining Tasks, have the following methods in mind:

Format Instructions

Use clear instructions for the Task.

Be consistent in the way you use marks, like Headers or bullet/numbered lists. Use markdown for the task definition.

  • Use Headers to organize sections within the instructions
  • Use lists for clarity
# Headers
- Task section
- Bullet 2
-- Secondary Section
--- Tertiary Section
--- Tertiary Section 2
Here are instructions on how to use the apicalls to solve problems:
# Section
1blah blah blah
# Section
2blah blah blah

Provide Resolution Steps

Enumerate the steps that GenerativeAgent needs to resolve a task.

This provides a logical flow of actions that the GenerativeAgent can use to be more efficient.

Just as a human agent needs to check, read, resolve, and send information to a customer, GenerativeAgent needs these steps to be more detalied.

# Steps to take to check order status
1. Verify Purchase Eligibility
- Check the purchase date to ensure it is within the 30-day refund policy.
- Verify that the item is eligible for a refund
2. Gather Necessary Information
- Ask the customer for their order ID.
3. Check Order Status
- Call the `order_status` function to retrieve the current status of the order.
- Confirm that the order is eligible for a refund.

Define Functions to Call

Functions are the set of APIs needed alongside their instructions.

GenerativeAgent invokes Functions to perform the necessary actions for a task.

Task instructions must outline how and when does GenerativeAgent invokes a Function.

Here is an example of how to call out functions in the task instruction:

Within the “FlightStatus” task, functions might include:

  • trip_details_extract_with_pnr: Retrieves flight details using the customer’s PNR and last name.
  • trip_details_pnr_emails: Handles email addresses associated with the PNR.
  • send_itinerary_email_as_string: Sends the trip receipt or itinerary to the customer via email.

Here is how the task instruction would be outlined to use the function:

"The function `trip_details_extract_with_pnr` is used within the 'FlightStatus' task to retrieve the current schedule of a customer's flight using their confirmation code and last name."

API Return Handling

Provide instructions for handle the returns of API Calls after performing a Function.

Use the syntax (data["APICallName"]) to let GenerativeAgent know that that precise piece of writing is the data return from an API Call.

Here is an example of API Return Handling:

When called, if there is a past due amount, you MUST tell them their exact soft disconnect date (data["softDisconnectDate"]), and let them know that after that day, their service will be shut off, but still be easy to turn back on.

State Policies and Scenarios

Clearly define company policies and outline what GenerativeAgent must do in various scenarios.

Stating Policies ensure consistency and compliance with your Organization’s standards.

Remember than a good part of the Policies can be taken from your Knowledge Base.

# Refund eligibility
- Customers can request a refund within 30 days of purchase.
- Refunds will be processed to the original payment method.
- Items must be returned in their original condition.
# Conversational Style
- Always refer to the customer as "customer."
- Do not address the customer by their name or title.

Ensure Knowledge Base Resourcing

Ensure that GenerativeAgent is making use of your Knowledge Base either by API or by the Knowledge Base Tooling in the Generative Agent UI.

Provide the Knowledge Base Resources within the task, so GenerativeAgent references them when active. Remember that you can try out GenerativeAgent’s behaviour by using the Previewer.

Outline limitations

Be clear about the limitations of each task.

Provide instructions on what to do in scenarios when customers ask for things that go beyond the limits of a task. This helps GenerativeAgent to manage customer expectations, provide alternative solutions, and switch to tasks that are in line with the customer’s needs.

# Limitations
- Cannot process refunds for items purchased more than 30 days ago.
- Redirect customers to the website for refunds involving gift cards.
- No knowledge of specific reasons for payment failures.

Use Conditional Templates

Use conditional templating to make parts of the task instructions conditional on reference variables determined from API responses.

This ensures that only the contextually relevant task instructions are available at the right time in the conversation.

{% if data["refundStatus"] == "approved" %}
- Inform the customer that their refund has been approved and will be processed shortly.
{% elif data["refundStatus"] == "pending" %}
- Let the customer know that their refund request is pending and provide an estimated time for resolution.
{% endif %}

Head to the Conditional Templates page to learn more about it:

Conditional Templates

Create Subtasks

Some tasks might be bigger and more complex than others.

GenerativeAgent is more efficient with cohesive and direct taks. A good practice for complex tasks is to divide them into subtasks.

For example, to give a refund to a client, GenerativeAgent might need to:

  • Confirm the customer’s status
  • Confirm the policies allow for the refund
  • Confirm the refund
For a customer seeking a refund, consider splitting the task into:
OrderStatus: To check the status of the order and communicate the results to the customer.
IssueRefund: To gather the information necessary to process the refund and actually process the refund.

Call Task Switch

As all tasks are outlined, sometimes GenerativeAgent needs to switch from one task to another.

Be explicit about the tasks to switch to, given a context.

# Damage Claims
- For claims regarding damaged products, use use the 'DamageClaims' task
# Exchange Requests
- For exchange inquiries, use the 'ExchangeProducts' task
# No pets rule
- (#rule_1) no dogs in the house
- (#rule_2) no cats outside
- (#rule_3) if either #rule_1 or #rule_2 are broken escalate to agent.

Outline Human Support

State the scenarios where GenerativeAgent needs to escalate the issue to a human agent.

This ensures GenerativeAgent’s role in your organization is well contained.

# Escalate to a Human Agent
- Refunds involving high-value items.
- Refunds where payment method issues are detected.

You can also state scenarios for HILA:

# Call HILA and wait on approval
- Refunds of purchases older than 30 days
- Cancelation of high-value purchases