Skip to main content

Parlant

The parlant-alice package registers Alice as the moderation service in a Parlant server. Customer messages are evaluated before the agent sees them, agent replies before the customer does. Blocked customer messages arrive as "censored" so a guideline can respond politely.

Status: Generally available · Evaluates: Prompts, Responses · Vendor: Emcie

Customer messages and generated agent messages.

Note: This example uses the v1 WonderFenceClient interface of the WonderFence SDK.

Setup​

pip install parlant-alice

Configuration: ALICE_API_KEY, ALICE_APP_NAME, ALICE_BLOCKED_MESSAGE

Example​

import asyncio
import parlant.sdk as p
from parlant.contrib.alice import Alice

async def main():
async with p.Server(configure_container=Alice(api_key="<API_KEY>",app_name="test").configure_container) as server:
agent = await server.create_agent(
name="Otto Carmen",
description="You work at a computer parts store",
)
print(agent.id)

blocked = await agent.create_guideline(
condition="the customer's last message is censored",
action="respond with a polite refusal to answer the question, mention that the message was censored based on guardrails analysis",
)

asyncio.run(main())

Good to know​

Clients must create customer events with moderation="auto", otherwise prompt analysis does not run. Blocked agent replies are replaced by ALICE_BLOCKED_MESSAGE.