emcie-co / parlant
- понедельник, 20 января 2025 г. в 00:00:02
The behavior guidance framework for customer-facing LLM agents
Website — Introduction — Installation — Tutorial — About
IMPORTANT NOTE: Parlant is in active development by a team of (currently) 12 contributors (developers, researchers, and QA) from leading instutions, such as Microsoft, Check Point, and Dynamic Yield. We're looking for more contributors to help get customer-facing agents under control! Please consider joining our Discord server and participating in our development.
Parlant is a framework that transforms how AI agents make decisions in customer-facing scenarios.
With Parlant, you can not only spin up and serve an LLM agent in minutes—with a full-fledged & responsive conversation management API—but, more importantly, you can continuously guide and improve its decision making and general behavior, easily and reliably.
Unlike traditional approaches that rely on prompt engineering or conversational flow charts, Parlant introduces a dynamic control system that ensures agents follow your specific business rules, in the form of behavioral guidelines that you provide, by matching and activating the appropriate combination of guidelines for every specific context.
graph TD
API(Parlant REST API) -->|React to Session Trigger| Engine[AI Response Engine]
Engine -->|Load Domain Terminology| GlossaryStore
Engine -->|Match Guidelines| GuidelineProposer
Engine -->|Infer & Call Tools| ToolCaller
Engine -->|Tailor Guided Message| MessageGenerator
When an agent needs to respond to a customer, Parlant's engine evaluates the situation, checks relevant guidelines, gathers necessary information through your tools, and continuously re-evaluates its approach based on your guidelines as new information emerges. When it's time to generate a message, Parlant implements self-critique mechanisms to ensure that the agent's responses precisely align with your intended behavior as given by the contextually-matched guidelines.
📚 More technical docs on the architecture and API are available under docs/.
Parlant comes pre-built with responsive session (conversation) management, a detection mechanism for incoherence and contradictions in guidelines, content-filtering, jailbreak protection, an integrated sandbox UI for behavioral testing, native API clients in Python and TypeScript, and other goodies.
$ pip install parlant
$ parlant-server
$ # Open the sandbox UI at http://localhost:8800 and play
Parlant is the right tool for the job if you're building an LLM-based chat agent, and:
In a word: Guidance. 🧭🚦🤝
Parlant's engine revolves around solving one key problem: How can we reliably guide customer-facing agents to behave in alignment with our needs and intentions.
Hence Parlant's fundamentally different approach to agent building: Managed Guidelines:
$ parlant guideline create \
--agent-id MY_AGENT_ID \
--condition "the customer wants to return an item" \
--action "get the order number and item name and then help them return it"
By giving structure to behavioral guidelines, and granularizing guidelines (i.e. making each behavioral guideline a first-class entity in the engine), Parlant's engine is able to offer unprecedented control, quality, and efficiency in building LLM-based agents:
Revenued, a business capital provider, uses Parlant for their Sales Copilot. They leverage Parlant's structured CLI to modify the agent's behavior quickly and easily based on feedback from company stakeholders.
To start learning and building with Parlant, visit our documentation portal.
Need help? Ask us anything on Discord. We're happy to answer questions and help you get up and running!
Adding a guideline for an agent—for example, to ask a counter-question to get more info when a customer asks a question:
parlant guideline create \
--agent-id CUSTOMER_SUCCESS_AGENT_ID \
--condition "a free-tier customer is asking how to use our product" \
--action "first seek to understand what they're trying to achieve"
In Parlant, Customer-Agent interaction happens asynchronously, to enable more natural customer interactions, rather than forcing a strict and unnatural request-reply mode.
Here's a basic example of a simple client (using the TypeScript client SDK):
import { ParlantClient } from 'parlant-client';
const client = ParlantClient({ environment: SERVER_ADDRESS });
session_id = "...";
// Post customer message
const customerEvent = await client.sessions.createEvent(session_id, {
kind: "message",
source: "customer",
message: "How do you use this product?",
});
// Wait for and get the agent's reply
const [agentEvent] = (await client.sessions.listEvents(session_id, {
kinds: "message",
source: "ai_agent",
minOffset: customerEvent.offset,
waitForData: 60 // Wait up to 60 seconds for an answer
}));
// Print the agent's reply
const { agentMessage } = agentEvent.data as { message: string };
console.log(agentMessage);
// Inspect the details of the message generation process
const { trace } = await client.sessions.inspectEvent(
session_id,
agentEvent.id
);
We use the Linux-standard Developer Certificate of Origin (DCO.md), so that, by contributing, you confirm that you have the rights to submit your contribution under the Apache 2.0 license (i.e., the code you're contributing is truly yours to share with the project).
Please consult CONTRIBUTING.md for more details.
Can't wait to get involved? Join us on Discord and let's discuss how you can help shape Parlant. We're excited to work with contributors directly while we set up our formal processes!
Otherwise, feel free to start a discussion or open an issue here on GitHub—freestyle 😎.