From Idea to Agent - Resources

Resource Page Link

This is your home base for the exercise. Head here to work through the manual process yourself, grab your API key, and watch the agent do its thing once you've built it out.

https://pathfinder.automationanywhere.com/challenges/training/MHG/WorkerPortal.html

API Documentation Page Link

Whenever you need the details on the APIs behind this process, this is the page to open. Keep it handy as you build.

View API Documentation (YAML)

1. Getting Next Work Item

Goal:

We need to gather the next work item from the My Work table and make it available to the agent, or let the agent know there is no work left to complete.

Inputs Required:

Change the description for UserAPIKey, pasting in the description below:

This is the API Key to access the APIs for our work queue.

Outputs Required:

Complaint_ID

This is the unique ID number for the complaint.

Associated_Customer

This is the customer number associated with the complaint.

Complaint_Text

This is the text body of the complaint.

Date_of_Complaint

This is the date the complaint was filed.

Tool Selected:

Now, we need to map the variables we have just made, to our JSON Get Node actions so this data can be captured and passed within our agent.

Relevant Endpoint:

https://wmkjvdlsxeohfnsyftag.supabase.co/functions/v1/next-work-item

Example Response Body:


{
  {
    "item": {
      "Complaint ID": "0000458",
      "Associated Customer": "CUST123",
      "Complaint Text": "Product arrived damaged during shipping",
      "Date of Complaint": "2024-10-15",
      "Associated Product ID": "PROD001",
      "Customer Disposition": null,
      "Customer Assessment": null
    }
  }
}

Work Remaining:

Good news — the 'GetNextWorkItem' API Task is already built and most of the way there. All that's left is to add the input and output variables, give each one a description, and update the JSON mapping.

The whole point of this one is to show you just how much it matters to identify and describe your input and output variables clearly. That's how an agent gets the right context to start working with confidence.

2. Complete the Sentiment Analysis AI Skill

Creating your AI Skill

  1. Go into the Prompts folder, select add new AI Skill, and call it sentimentSkill.
  2. Paste in the prompt below for the AI Skill:
    You are a complaint review specialist reviewing the sentiment of a customer complaint.  Examine the complaint text and determine which of the following four types it matches best.
    
    - Happy: Providing positive feedback about their experience.
    - Neutral: Noreal discernable positive or negative tone, simply stating facts or providing information.
    - Frustrated: Exasperated details highlight a pattern of issues.  This goes beyond just stating facts and moves towards a true negative tone and experience.
    - Hostile: Actively threatening.
    
    Return ONLY one of the 4 types with no other information,  markdown, or formatting.
    
    Complaint Text: $Complaint_Text$
    
  3. In the variable that appears, press the pencil icon and then paste in the following complaint:
    So now the Ultra Blender 9000 Series X Elite Pro++ replacement is rattling again. I’ve had three of these, all “new,” all defective. This is beyond coincidence — you owe me a lifetime warranty or at least store credit.
  4. Then press Model Connection at the top left, and select AI-Skill.
  5. Press Save and Close, then head back to the Tools folder and create a new API Task called SentimentAPITask. Give this the following description:
    Assess the sentiment of the customer’s complaint text and classify it into one of the following categories: Happy, Neutral, Frustrated, or Hostile.
  6. Drag in the AI Skill Execute action from the elements on the left, then choose the AI Skill you have just made.
  7. In the Input Values, press the bidirectional arrows, then press Apply.
  8. Now take the variable you just made, make it an input, and paste in the description:
    The body of the email complaint from the customer.
  9. Now make a new variable called ComplaintSentiment, make it an output, and paste in the description:
    The sentiment analysis result of the complaint.
  10. Now in the Save the Output, select the variable ComplaintSentiment.

3. Disposition Complaint

Steps:

  1. Open this API Task, then next to the name press the pencil, and we will add in the description:
    Use an API call to disposition the current complaint.
  2. Then we need to first make the variables that will be passing our data into here. Begin by making the 4 input variables below, along with their descriptions:

    complaintID

    This is the unique ID number for the complaint.

    customerDisposition

    This is the disposition of the complaint.

    customerAssessment

    This is the assessment of the complaint sentiment.

    API_Key

    This is the API Key to access the APIs for our work queue.

Relevant Endpoint:

https://wmkjvdlsxeohfnsyftag.supabase.co/functions/v1/disposition-complaint

Example Request Body:

{
  "complaintID": "0000458",
  "customerDisposition": "Resolved",
  "customerAssessment": "Happy"
}

Work Remaining:

Once your input variables are in place, paste the example above into the custom parameters of the REST Web Services action. Then swap out the static values in the body for the variables you just created, and write a clear explanation of what this tool does so the agent understands its purpose.

This exercise is all about learning how to build a tool that lets an agent take a real action, simply by describing what that action does.

4. Update the Customer Investigations Agent

Objective:

Time to bring it all together. We need to make sure every tool the agent needs is right at its fingertips, and that it understands its assignment down to the letter.

Steps:

  1. Open up the Customer Investigations Agent in the parent folder.
  2. Add a new tool by clicking the + sign and selecting API task. Browse over to the SentimentAPITask API task in the Tools folder. Notice that all the descriptions you wrote earlier are already sitting there waiting for you.
  3. Find the GetNextWorkItem tool in the Tools menu and press Refresh twice. This pulls in the variables you created along with their descriptions, so the agent can actually make sense of them.
  4. Do the exact same thing for the DispositionComplaint API task.
  5. Now click on over to the Prompt tab.
  6. The fields in here already work beautifully as they are, so feel free to hit play and watch the agent march through every available complaint.
  7. To see this part of the tool come alive, click Generate and give it a quick description of its job. Tweak anything you feel like changing, or just drop the original items back in by copying from below.
  8. Role:
    You are a fraud investigator specializing in identifying and analyzing patterns of fraudulent customer complaints.
  9. Goal:
    Your goal is to assess customer complaints to determine their authenticity by analyzing complaint history, sentiment, and associated order data.
  10. Action Plan:
    # Assumptions
    - The customer has a history of complaints and orders available for analysis, otherwise they are "Customer Not Found"
    - Sentiment analysis and order history tools are accessible.
    
    # Process
    1. Retrieve the next available complaint using the 'GetNextWorkItem' tool to gather the complaint ID, text, and associated customer ID.
    2. Use the 'GetCustomerComplaints' tool to retrieve the customer's historical complaints, including product details and dispositions.
    3. Analyze the sentiment of the current complaint using the 'SentimentAPITask' tool to determine emotional tone.
    4. Retrieve the customer's order history using the 'getorderHistory' tool, filtering by customer ID
    5. Use the 'CustomerDispositionBusinessRules' tool to apply business logic and determine the disposition of the complaint based on the customer's complaint and order history.
    6. Update the complaint status using the 'DispositionComplaint' tool, including the sentiment label and disposition decision.
    7. Document your work using the 'WorkDocumentation' tool by sending in the relevant items and allowing it to make them a comma separated string.
    
    # Notes
    - Repeat this process until there is no more work to complete.  Once all work is completed successfully, you are finished.
    - When complete, output the completed work list object to the output variable CompletedWork.
    - Be diligent to map exact values throughout the process to avoid mistakes.
                  
  11. Click Run, pop in your API Key from the worker portal, and watch it all work.