How can you create the faithful AI agents using parlounts?

Partant for a framework for helping the developers of the AIGents are ready for production – ready for Ai Ai Ai Ai Agents responsible for honest and honest. The regular challenge when sending large agents into (llm) that they often do well in testing but fail when they are in contact with real users. They may neglect the careful appearance of the program, produce incorrect or improper answers in critical times, fought charges in the edge, or produced behaviors with one conversation to another.
Partant faces these challenges by changing the focus from Defect Engineering in policy development. Instead of leaning on Promptswork only, it provides ways to explain the clear rules and integration of tools, to ensure that the agent can access and process the real land data safely and possible.
In this lesson, we will create an insurance agent that can restore open claims, and provide details of the new applications, and provide how we can combine certain domain tools, supporting and trusted customers. Look Full codes here.
To add and import depends on
import asyncio
from datetime import datetime
import parlant.sdk as p
Defining Tools
The following Code Code introduces three tools that are taken to intercede for the insurance assistant may require.
- This page Get_open_claims The tool represents an asynchronous work that receives the list of open insurance claims, which allows the agent to provide users to date with pending or approved claims.
- This page file_claimim The tool welcomes the details of the claim as installation and imitates the process of completing a new insurance claim, returns the user confirmation message.
Finally, Get_polire_Details The instrument provides important policy information, such as the policy number and the Coverage Restrictions, which enables the agent to respond accurately to the insurance-related questions. Look Full codes here.
@p.tool
async def get_open_claims(context: p.ToolContext) -> p.ToolResult:
return p.ToolResult(data=["Claim #123 - Pending", "Claim #456 - Approved"])
@p.tool
async def file_claim(context: p.ToolContext, claim_details: str) -> p.ToolResult:
return p.ToolResult(data=f"New claim filed: {claim_details}")
@p.tool
async def get_policy_details(context: p.ToolContext) -> p.ToolResult:
return p.ToolResult(data={
"policy_number": "POL-7788",
"coverage": "Covers accidental damage and theft up to $50,000"
})
Defining a list and trip
At this stage, it describes a list of names and trips that the agent treats domain and discussions. List of words containing important business terms, such as customer service number and hours of work, which allows the agent to display accuracy when needed.
The journey describes steps of steps on specific steps. In this example, one journey is the customer by completing a new insurance claim, and another focuses on restore information. Look Full codes here.
async def add_domain_glossary(agent: p.Agent):
await agent.create_term(
name="Customer Service Number",
description="You can reach us at +1-555-INSURE",
)
await agent.create_term(
name="Operating Hours",
description="We are available Mon-Fri, 9AM-6PM",
)
async def create_claim_journey(agent: p.Agent) -> p.Journey:
journey = await agent.create_journey(
title="File an Insurance Claim",
description="Helps customers report and submit a new claim.",
conditions=["The customer wants to file a claim"],
)
s0 = await journey.initial_state.transition_to(chat_state="Ask for accident details")
s1 = await s0.target.transition_to(tool_state=file_claim, condition="Customer provides details")
s2 = await s1.target.transition_to(chat_state="Confirm claim was submitted")
await s2.target.transition_to(state=p.END_JOURNEY)
return journey
async def create_policy_journey(agent: p.Agent) -> p.Journey:
journey = await agent.create_journey(
title="Explain Policy Coverage",
description="Retrieves and explains customer's insurance coverage.",
conditions=["The customer asks about their policy"],
)
s0 = await journey.initial_state.transition_to(tool_state=get_policy_details)
await s0.target.transition_to(
chat_state="Explain the policy coverage clearly",
condition="Policy info is available",
)
await agent.create_guideline(
condition="Customer presses for legal interpretation of coverage",
action="Politely explain that legal advice cannot be provided",
)
return journey
The main runner ties together all the things described in previous cells and introducing a agent. It starts a parali server, creating a support agent, and loaded its list, its journey, and the world guidelines. It also applies criminal cases such as an increasing customer for executing an agency to choose between the appropriate trip. Finally, if the text is killed, the server is active and prints a confirmation message. You can open your browser and navigate to To access the UI parrant and start contact with an insurance agent in real time. Look Full codes here.
async def main():
async with p.Server() as server:
agent = await server.create_agent(
name="Insurance Support Agent",
description="Friendly and professional; helps with claims and policy queries.",
)
await add_domain_glossary(agent)
claim_journey = await create_claim_journey(agent)
policy_journey = await create_policy_journey(agent)
# Disambiguation: if intent is unclear
status_obs = await agent.create_observation(
"Customer mentions an issue but doesn't specify if it's a claim or policy"
)
await status_obs.disambiguate([claim_journey, policy_journey])
# Global guideline
await agent.create_guideline(
condition="Customer asks about unrelated topics",
action="Kindly redirect them to insurance-related support only",
)
print("✅ Insurance Agent is ready! Open the Parlant UI to chat.")
if __name__ == "__main__":
import asyncio
asyncio.run(main())

Look Full codes here. Feel free to look our GITHUB page for tutorials, codes and letters of writing. Also, feel free to follow it Sane and don't forget to join ours 100K + ml subreddit Then sign up for Our newspaper.
Cooperation of MarkechPost.com Content Contents, please speak to us

I am the student of the community engineering (2022) from Jamia Millia Islamia, New Delhi, and I am very interested in data science, especially neural networks and their application at various locations.
🔥[Recommended Read] NVIDIA AI Open-Spaces Vipe (Video Video Engine): A Powerful and Powerful Tool to Enter the 3D Reference for 3D for Spatial Ai