Guidelines
Guidelines
Guidelines are the most powerful customization feature within Parlant. So although they are quite simple in principle, there is a lot to say about them.
What Are Guidelines
Guidelines allow us to shape an agent's behavior in three key scenarios:
- When out-of-the-box responses don't meet our expectations
- When we simply want to ensure consistent behavior across all interactions
- When we need the agent to employ tools (which, in Parlant, require guidance)
As an example, suppose an AI Travel Agent's vanilla response to a customer asking to book a room may be, "Sure, I can help you book a room. When will you be staying?"
If we wanted the agent to first ask how many guests would be staying, we can add a guideline to that effect. If we wanted the agent's response to be more enthusiastic, we could add a guideline for that too. Parlant will ensure our guidelines are consistently applied at the right situations.
The Structure of Guidelines
In Parlant, each guideline is composed of two parts: the condition and the action.
The action part describes what the guideline should accomplish. For example, "Offer a discount." The condition is the part the specifies when the action should take place. For example, "It is a holiday". In this example, the guideline would be:
- Condition: It is a holiday
- Action: Offer a discount on the order
Once the action is accomplished in a session, Parlant will deactivate the guideline—unless it has reason to believe the action should re-apply (e.g., if the customer starts another order).
When speaking informally about guidelines, we often describe them in when/then form: When <CONDITION>, Then <ACTION>, or in this case, When it is a holiday, Then offer a discount.
How Parlant Uses Guidelines
LLMs are a magnificent creation, built on the principle of statistical attention in text; yet, their attention span is painfully finite. When it comes to following instructions, they need help.
Behind the scenes, Parlant ensures that agent responses are aligned with expectations by dynamically managing the LLM's context to only include the relevant guidelines at each point.
Before each response, Parlant only loads the guidelines that are relevant to the conversation's current state. This dynamic management keeps the LLM's "cognitive load" minimal, maximizing its attention and, consequently, the alignment of each response with expected behavior.
Another important ability that Parlant employs to ensure alignment is supervising the agent's outputs before they reach the customer, to ensure to the utmost degree that guidelines were correctly adhered to. To achieve this, NLP researchers working on Parlant have devised an innovative prompting technique called Attentive Reasoning Queries (ARQs). You're welcome to explore the research paper on arxiv.org, Attentive Reasoning Queries: A Systematic Method for Optimizing Instruction-Following in Large Language Models
Managing Guidelines
Parlant is built to make guideline management as simple as possible.
Often, guidelines are added when business experts request behavioral changes in the agent. In such cases, developers can use Parlant to make those changes, iterating quickly and reliably, at the pace of the business experts they're working with.
Here's a practical example. When Sales requests: "The agent should first ask about the customer's needs and pain points before discussing our solution," implementing this feedback takes just a minute by adding the following guideline:
- Condition: The customer has yet to specify their current pain points
- Action: Seek to understand their pain points before talking about our solution
Once added, Parlant takes care of the rest, automatically ensuring this new guideline is followed consistently across all relevant conversations, without degrading alignment to other guidelines.
Here's an example of how to add a guideline to a specific agent:
parlant guideline create --tag agent:AGENT_ID --condition CONDITION --action ACTION
You can also tag guidelines to form guideline groups. Only agents who are themselves tagged with the same tag would apply those guidelines.
parlant guideline create \
--tag product-help \
--condition "The customer has yet to specify their current pain points" \
--action "Seek to understand their pain points before talking about our solution"
parlant agent tag --id AGENT_ID --tag product-help
Formulating Guidelines
Formulating Guidelines
Think of an LLM as a highly knowledgeable stranger who's just walked into your business. They might have years of general experience, but they don't know your specific context, preferences, or way of doing things. Yet, this stranger is eager to help and will always try to—even when uncertain.
This is where guidelines come in. They're your way of channeling this endless enthusiasm and broad knowledge into focused, appropriate responses.
But specifying effective guidelines is a bit of an art—just like it is with people.
The Art of Guidance
Consider a customer service scenario. As a very naive example, we might be tempted to have:
DON'T
- Condition: Customer is unhappy
- Action: Make them feel better
While well-intentioned, this is an example of a guideline that is just too vague. The LLM might interpret this in countless ways, from offering discounts it can't actually provide to making jokes that might be inappropriate for your brand. Instead, consider:
DO
- Condition: Customer expresses dissatisfaction with our service
- Action: Acknowledge their frustration specifically, express sincere empathy, and ask for details about their experience so we can address it properly.
Notice how this guideline is both specific and bounded.
DON'TDO
- Condition: Customer asks about products
- Action: Recommend something they might like
- Condition: Customer asks for product recommendations without specifying preferences
- Action: Ask about their specific needs, previous experience with similar products, and any particular features they're looking for before making recommendations
Finding the Right Balance
In principle, we're looking for guidelines that are "just right"—neither over nor under specified. Consider these iterations for a technical support agent:
DON'T Too vague:
- Condition: Customer has a technical problem
- Action: Help them fix it
DON'T Too rigid:
- Condition: Customer reports an error message
- Action: First ask for their operating system version, then their browser version, then their last system update date
DO Just right:
- Condition: Customer reports difficulty accessing our platform
- Action: Express understanding of their situation, ask for key details about their setup (OS and browser), and check if they've tried some concrete troubleshooting steps
Remember, LLMs will usually take your guidance quite literally. If you tell your agent to "always suggest premium features," it might do so even when talking to a customer who's complaining about pricing. Always try to consider the broader context and potential edge cases when formulating your guidelines. It'll pay off in less changes and trouleshooting down the line.
If in doubt, prefer to err on the side of vagueness. The goal of Conversation Modeling isn't to script out every possible interaction but to provide clear, contextual guidance that shapes the LLM's natural generalization abilities into reliable, appropriate responses for your specific use case.