Quickstart #3: Build a Plugin That Follows a Process
Quickstart #3: Build a Plugin That Follows a Process
Build a purchase-request submission plugin with multiple slots, activities, and a decision policy.
Quickstart #3: Build a Plugin That Follows a Process
Build a purchase-request submission plugin with multiple slots, activities, and a decision policy.
This Quickstart guide walks you through building a plugin that helps users submit purchase requests. The plugin follows a multi-step process: collect details, classify the request, and either submit it or send the user down a different path. You’ll learn how to:
You’ll build a purchase request submission plugin. It asks the user for details about the purchase request they want to submit, compares the details against historical purchase requests, and either submits it if it can be classified as “OpEx” or rejects it if it’s classified as “CapEx”.
Here is an example of the end-user experience we hope to enable:

To build this, here’s one way to decompose the work into a Conversational Process, consisting of a few Activities (both Action-based and Content-based), a Decision Policy, and a few Slots to power the data needed in this process:

In this guide, you’ll work your way through these main phases:
Let’s get started!
If you’ve already completed the Purple Suite Setup and have your connector configured, skip to Phase 1A.
Follow the Purple Suite Setup guide to:
<fullname>_<descriptive_name>
lucasrollo_Submit_PTO_ActionLet’s first set up an HTTP Action that will retrieve historical purchase requests. This Action doesn’t require any dynamic inputs, and will just query an external system for a list of purchase requests.
Set the following title and description for your Action (be sure to replace “firstname” and “lastname” with your corresponding information).
Enter the details of your API:
Click on the “Import” icon to the right of the “TEST” button.

Paste the following cURL command:
Click “Import” (your Action should now be auto-populated with details).
Navigate to the “Connector” tab, and select your existing Moveworks Purple Connector (set up in Phase 0).

This Action will fetch the critical history of past purchase requests (that later you’ll compare a user’s new request against). Next up: setting up an action to actually submit new purchase requests.
<fullname>_<descriptive_name>
lucasrollo_Submit_PTO_ActionThe next (and final) Action to set up will add a new purchase request object (and will actually update the purchase record database in your instance!). This Action will require three dynamic inputs: item_name, quantity, and justification.
Set the following title and description for your Action (be sure to replace “firstname” and “lastname” with your corresponding information).
Enter the details of your API:
Click on the import button to the right of the “TEST” button.

Paste the following cURL command:
Click “Import” (your Action should now be auto-populated with details).
Navigate to the “Connector” tab, and select your existing Moveworks Purple Connector (set up in Phase 0).

Define 3 formal input arguments to represent the “item name”, and “quantity”, and “business justification” inputs that this Action requires:
Click on the “Input Args” button near the top right corner.
Click “Create New” in the “Input Arguments” pop up.
Fill out the following details for your item_name argument:
Hit “Save”.
Click “Create New” again in the “Input Arguments” pop up.
Fill out the following details for your quantity argument:
Hit “Save”.
Click “Create New” again in the “Input Arguments” pop up.
Fill out the following details for your justification argument:
Hit “Save” and hit the “X” icon to close this “Input Arguments” pop up.
Time to construct your Conversational Process.
<fullname>_<descriptive_name>
lucasrollo_Submit_PTO_ActionHere’s a reminder of the bird’s eye view for this Submit Procurement Purchase Request Conversational Process:

Let’s build it!
Navigate to a new Conversational Process (navigate to the library and click “Create”).

Set the following title and description for your Conversational Process (be sure to replace “firstname” and “lastname” with your corresponding information).
Add the FOUR Slots that this process will need: item_name, quantity, business_justification, and is_purchase_for_organization_acknowledgement. 📖 Learn more about Slots.
Click on the “Slots” button near the top right corner of the editor.

Click “Create New” in the “Slots” pop up.
Fill out the following details for your first item_name Slot:
Hit “Save” (scroll to the bottom of the popup).
Click “Create New” again in the “Slots” pop up to build your second Slot.
Fill out the following details for your business_justification Slot:
Hit “Save” (scroll to the bottom of the popup).
Click “Create New” again in the “Slots” pop up to build your third Slot.
Fill out the following details for your quantity Slot:
Hit “Save” (scroll to the bottom of the popup).
Click “Create New” again in the “Slots” pop up to build your fourth and final Slot.
Fill out the following details for your is_purchase_for_organization_acknowledgement Slot:
Hit “Save” (scroll to the bottom of the popup) and hit the “X” icon to close this “Slots” pop up.
Build the first Action Activity that fetch a list of historical purchase requests that the process will later compare against. 📖 Learn more about Activities.
Click on the ”+ Add a block to your process” button in the main section of the editor.
Click on “Action Activity”.

Fill out the following details for your Action Activity, which simply hooks up the Action you created to this Action Activity:
Build the second Action Activity, which will utilize a Built-in Action that can generate an output according to a natural language prompt. 📖 Learn more about the Built-in Generate Text Action.
Click on the ”+” icon below the previous Activity in the main section of the Conversational Process Editor.
Click on “Action Activity”.
Fill out the following details for your Action Activity, which mostly involves constructing a templated prompt to the Action, and mapping the predicted purchase request classification out of the model’s response:
Build your first Decision Policy, which will execute after the already configured 2 Activity blocks. This policy will allow the Process to branch its execution depending on the pr_classification returned by the generate text Action Activity. 📖 Learn more about Decision Policies.
Click on the ”+” square icon below the second generate text Activity in the main section of the Conversational Process Editor.
Click on “Decision Policy”. (No need to input anything in the panel that appears on the right).

Increment the number of Cases by clicking on the ”+” button to the right of the words “1 case”.

Click on the first Case entry under the Decision Policy and enter the below DSL rule in the panel that appears on the right:

Click on the second Case entry under the Decision Policy and enter the below DSL rule in the panel that appears on the right:

Create the Action Activity that will execute under the first Decision Policy Case (pr_classification is opex).
Click on the ”+” icon below the first Case entry under the Decision Policy.

Select “Action Activity”.
Fill out the following details for your Action Activity, which will connect your slots to the input(s) of the HTTP Action (and mapping the result of the Action back to the Conversational Process).
is_purchase_for_organization_acknowledgement is not technically needed to invoke the submit purchase request action, marking it as a required Slot for this Activity ensures that the AI Assistant fills the Slot before executing this Activity.Create the Content Activity that will execute under the second Decision Policy Case (pr_classification is capex).
Click on the ”+” icon below the second Case entry under the Decision Policy.
Select “Content Activity” this time.

Keep the “Content Type” set to “Text”.
Paste the following text content (which will share text instructions with the user on how to submit purchase requests that fall under CapEx).
Create the Content Activity that will execute under the default branch (when pr_classification somehow is neither opex nor capex).
Way to stick through all the steps! We’re ready for the last phase: now you’ll launch a Plugin — this packages the Conversational Process into a tool that your AI Agent can use directly.
<fullname>_<descriptive_name>
lucasrollo_Submit_PTO_ActionIt’s finally time to add your Conversational Process to a Plugin, where you can control the Triggering scenarios of your Plugin and specify which end users are allowed to use your Plugin.
Set the following title and description for your Plugin (be sure to replace “firstname” and “lastname” with your corresponding information).
Define a Conversational Trigger. 📖 Learn more about Natural Language Triggers.
Click on “No triggers configured”.
In the panel that appears on the right, either:
Approve (click “Trigger”) 5 of the auto-generated suggested positive examples, or
Add the following recommended utterances:
Choose your Conversational Process (the one you built in Phase 2).
firstname_lastname_support_procurement_purchases_process)Use one of your triggering examples (e.g. “submit purchase request”) to access the Plugin in conversation. Try refreshing your submitted purchase requests tab in your Purple Suite session to see the updates take effect in real time!
The plugin you just built contains a plethora of Agent Studio concepts, from different Activity types to Decision Policies. There’s a lot it had to take care of:
Congratulations on building this powerful plugin — it’s now ready to help support users with their procurement purchase needs!
Next step: Test your plugin. See our Testing & Error Handling guide for how to test, debug, and handle errors in production.