🎯 每个人工智能开发人员面临的问题
你构建了一个 AI 代理。它在测试中效果很好。然后真正的用户开始与它交谈,然后……
- ❌ 它会忽略您精心制作的系统提示
- ❌ 它在关键时刻产生幻觉反应
- ❌ 它无法一致地处理边缘情况
- ❌ 每次对话都感觉像掷骰子
听起来很熟悉?你并不孤单。这是开发人员构建生产 AI 代理的 #1 痛点。
⚡ 解决方案:停止对抗提示,传授原则
Parlant 翻转了 AI 代理开发的脚本。Parlant 不希望您的 LLM 会遵循指示,而是确保这一点。
# Traditional approach: Cross your fingers 🤞
system_prompt = "You are a helpful assistant. Please follow these 47 rules..."
# Parlant approach: Ensured compliance ✅
await agent.create_guideline(
condition="Customer asks about refunds",
action="Check order status first to see if eligible",
tools=[check_order_status],
)
- ✅ 博客:Parlant 如何确保代理合规性
- 🆚 博客:Parlant 与 DSPy
Parlant 为您提供构建面向客户的代理所需的所有结构,这些代理的行为完全符合您的业务需求:
-
旅程: 定义清晰的客户旅程以及您的代理在每个步骤中应如何响应。
-
行为指南: 轻松制作代理行为;Parlant 将根据上下文匹配相关元素。
-
工具使用: 将外部 API、数据获取器或后端服务附加到特定交互事件。
-
领域适应:教您的代理特定领域的术语并制定个性化响应。
-
预设回复:使用回复模板来消除幻觉并保证风格的一致性。
-
可解释性:了解匹配和遵循每个指南的原因和时间。
🚀 让您的代理在 60 秒内运行
pip install parlant
import parlant.sdk as p
@p.tool
async def get_weather(context: p.ToolContext, city: str) -> p.ToolResult:
# Your weather API logic here
return p.ToolResult(f"Sunny, 72°F in {city}")
@p.tool
async def get_datetime(context: p.ToolContext) -> p.ToolResult:
from datetime import datetime
return p.ToolResult(datetime.now())
async def main():
async with p.Server() as server:
agent = await server.create_agent(
name="WeatherBot",
description="Helpful weather assistant"
)
# Have the agent's context be updated on every response (though
# update interval is customizable) using a context variable.
await agent.create_variable(name="current-datetime", tool=get_datetime)
# Control and guide agent behavior with natural language
await agent.create_guideline(
condition="User asks about weather",
action="Get current weather and provide a friendly response with suggestions",
tools=[get_weather]
)
# Add other (reliably enforced) behavioral modeling elements
# ...
# 🎉 Test playground ready at http://localhost:8800
# Integrate the official React widget into your app,
# or follow the tutorial to build your own frontend!
if __name__ == "__main__":
import asyncio
asyncio.run(main())
就是这样!您的代理正在运行,并确保遵循规则的行为。
🎬 查看实际效果

🔥 为什么开发人员转向 Parlant
🏗️ 传统人工智能框架
|
⚡ 帕兰特
|
|
|
🎯 非常适合您的用例
| 金融服务 | 医疗 | 电子商务 | 法律科技 |
|---|---|---|---|
| 合规优先的设计 | HIPAA 就绪代理 | 大规模客户服务 | 精准的法律指导 |
| 内置风险管理 | 患者数据保护 | 订单处理自动化 | 文件审查协助 |
🛠️ 企业级功能
- 🧭 对话式旅程 – 引导客户逐步实现目标
- 🎯 动态准则匹配 – 上下文感知规则应用
- 🔧 可靠的工具集成 – API、数据库、外部服务
- 📊 对话分析 – 深入了解代理行为
- 🔄 迭代细化 – 持续改进代理响应
- 🛡️ 内置护栏 – 防止幻觉和偏离主题的反应
- 📱 React Widget – 适用于任何 Web 应用程序的插入式聊天 UI
- 🔍 完全可解释性 – 了解您的代理做出的每一个决定
🎯 每个人工智能开发人员面临的问题
你构建了一个 AI 代理。它在测试中效果很好。然后真正的用户开始与它交谈,然后……
- ❌ 它会忽略您精心制作的系统提示
- ❌ 它在关键时刻产生幻觉反应
- ❌ 它无法一致地处理边缘情况
- ❌ 每次对话都感觉像掷骰子
听起来很熟悉?你并不孤单。这是开发人员构建生产 AI 代理的 #1 痛点。
⚡ 解决方案:停止对抗提示,传授原则
Parlant 翻转了 AI 代理开发的脚本。Parlant 不希望您的 LLM 会遵循指示,而是确保这一点。
# Traditional approach: Cross your fingers 🤞 system_prompt = "You are a helpful assistant. Please follow these 47 rules..." # Parlant approach: Ensured compliance ✅ await agent.create_guideline( condition="Customer asks about refunds", action="Check order status first to see if eligible", tools=[check_order_status], )
- ✅ 博客:Parlant 如何确保代理合规性
- 🆚 博客:Parlant 与 DSPy
Parlant 为您提供构建面向客户的代理所需的所有结构,这些代理的行为完全符合您的业务需求:
-
旅程: 定义清晰的客户旅程以及您的代理在每个步骤中应如何响应。
-
行为指南: 轻松制作代理行为;Parlant 将根据上下文匹配相关元素。
-
工具使用: 将外部 API、数据获取器或后端服务附加到特定交互事件。
-
领域适应:教您的代理特定领域的术语并制定个性化响应。
-
预设回复:使用回复模板来消除幻觉并保证风格的一致性。
-
可解释性:了解匹配和遵循每个指南的原因和时间。
🚀 让您的代理在 60 秒内运行
pip install parlant
import parlant.sdk as p @p.tool async def get_weather(context: p.ToolContext, city: str) -> p.ToolResult: # Your weather API logic here return p.ToolResult(f"Sunny, 72°F in {city}") @p.tool async def get_datetime(context: p.ToolContext) -> p.ToolResult: from datetime import datetime return p.ToolResult(datetime.now()) async def main(): async with p.Server() as server: agent = await server.create_agent( name="WeatherBot", description="Helpful weather assistant" ) # Have the agent's context be updated on every response (though # update interval is customizable) using a context variable. await agent.create_variable(name="current-datetime", tool=get_datetime) # Control and guide agent behavior with natural language await agent.create_guideline( condition="User asks about weather", action="Get current weather and provide a friendly response with suggestions", tools=[get_weather] ) # Add other (reliably enforced) behavioral modeling elements # ... # 🎉 Test playground ready at http://localhost:8800 # Integrate the official React widget into your app, # or follow the tutorial to build your own frontend! if __name__ == "__main__": import asyncio asyncio.run(main())
就是这样!您的代理正在运行,并确保遵循规则的行为。
🎬 查看实际效果

🔥 为什么开发人员转向 Parlant
🏗️ 传统人工智能框架
⚡ 帕兰特
- 编写复杂的系统提示
- 希望法学硕士跟随他们
- 调试不可预测的行为
- 通过提示工程进行扩展
- 交叉手指以确保可靠性
- 用自然语言定义规则
- 确保遵守规则
- 可预测、一致的行为
- 通过添加指南进行缩放
- 从第一天起就投入生产
🎯 非常适合您的用例
金融服务 医疗 电子商务 法律科技 合规优先的设计 HIPAA 就绪代理 大规模客户服务 精准的法律指导 内置风险管理 患者数据保护 订单处理自动化 文件审查协助 🛠️ 企业级功能
- 🧭 对话式旅程 – 引导客户逐步实现目标
- 🎯 动态准则匹配 – 上下文感知规则应用
- 🔧 可靠的工具集成 – API、数据库、外部服务
- 📊 对话分析 – 深入了解代理行为
- 🔄 迭代细化 – 持续改进代理响应
- 🛡️ 内置护栏 – 防止幻觉和偏离主题的反应
- 📱 React Widget – 适用于任何 Web 应用程序的插入式聊天 UI
- 🔍 完全可解释性 – 了解您的代理做出的每一个决定


没有回复内容