Customer Personalization
Customer Personalization
It can sometimes be helpful if your agent understands who it's talking to.
Consider having multiple returning customers or VIP members—say, people on the premium or business plans. You may want your agent to handle them differently.
Let's look at how we can give your agent this awareness, so you can tailor its interaction style and ways of handling different types of customers.
Create a Customer
Let's start by creating a new customer. We'll use the CLI mostly for this tutorial, but remember that you can ultimately do everything with Parlant's API (and client SDKs in Python and TypeScript) too.
parlant customer create --name "Beef Wellington"
This returns the customer's ID. Let's save it for later commands.
CUSTOMER_ID=<replace with the customer's ID>
Now let's tell Chip to greet our customers by name.
parlant guideline create \
--condition "a customer greets you" \
--action "welcome them back, mentioning their name" \
--tag retail

Lastly, let's tell Chip to refer customers to our support line if they're running into any issues.
parlant guideline create \
--condition "a customer is having an issue" \
--action "refer them to our support line at 1-800-SUPPORT" \
--tag retail
Note: Save this guideline's ID, we'll use it soon.
SUPPORT_GID=<replace with guideline ID>
Create a Context Variable
Context Variables can give your agent additional information about the customer it's talking to.
Here we'll create a variable called subscription_plan
, which would be set differently for each customer.
parlant variable create --name subscription_plan --tag retail
Assign your variable's ID to a shell variable—we'll use it shortly:
VARIABLE_ID=<replace with the variable's ID>
Now for the next step.
While we can set the variable differently for individual customers, in this case we'll use tags to divide customers into groups, customizing the agent's behavior based on different types of customers.
Create a new tag:
parlant tag create --name business
Now tag your customer:
parlant customer tag --id $CUSTOMER_ID --tag business
Great! Now we can set a value for the context variable, which would apply to all customers tagged with business
.
parlant variable set --id $VARIABLE_ID --key tag:business --value "Business Plan"
Now, Beef has been successfully marked as a Business Plan customer!
Special Behavior for Business Customers
Now that Chip knows it's talking to a premium customer on the Business Plan, we can give it special guidance on how to talk to such customers.
parlant guideline create \
--condition "a business-plan customer is having an issue" \
--action "assure them you will escalate it internally and get back to them" \
--tag retail
Let's save this new guideline's ID for a minute:
BUSINESS_SUPPORT_GID=<replace with guideline ID>
To avoid any confusion, we'll need to ensure that this VIP treatment overrides the default behavior of referring the customer to our support line as we did before. To do this, let's install a priority relationship between our two support-related guidelines.
parlant relationship create --kind priority --source $BUSINESS_SUPPORT_GID --target $SUPPORT_GID
Now start a new session with Beef as the customer and tell Chip about some issue you're having. You should be getting VIP service!
