microscopic-dress-75199
10/06/2025, 9:28 PMtall-airline-16756
10/06/2025, 9:28 PMtall-airline-16756
10/06/2025, 9:28 PMmicroscopic-dress-75199
10/06/2025, 9:28 PMtall-airline-16756
10/06/2025, 9:29 PMAgentSession configuration, making sure they’re tuned to fit your specific use case.
Also, don’t forget to check the quality of your input audio and confirm proper silence trimming is in place. If you’re still facing issues after trying these steps, please reach out—I’m here to help you troubleshoot further and find the best solution.
Sources: Live Conversations with AI using ChatGPT and WebRTC | Live Conversations with AI using ChatGPT and WebRTC | Cartesia STT | LiveKit Docs | livekit-agents/livekit/agents/voice/audio_recognition.py | Live Conversations with AI using ChatGPT and WebRTCmicroscopic-dress-75199
10/06/2025, 9:30 PMtall-airline-16756
10/06/2025, 9:30 PMcartesia/ink-whisper. To use this model, you can simply specify it along with the language in the stt argument of an AgentSession. For example: stt: 'cartesia/ink-whisper:en'. If you need any help setting this up, feel free to ask!
Sources: Cartesia STT | LiveKit Docs | agents/src/inference/stt.tsmicroscopic-dress-75199
10/06/2025, 9:32 PMtall-airline-16756
10/06/2025, 9:33 PMmicroscopic-dress-75199
10/06/2025, 9:40 PMtall-airline-16756
10/06/2025, 9:40 PMmicroscopic-dress-75199
10/06/2025, 9:44 PMtall-airline-16756
10/06/2025, 9:44 PMAgentTask. You can create a custom task that gently guides you through each input step-by-step. Here's a simple outline to get you started:
• Sequential Collection: We can use methods like _ask_name(), _ask_email(), and so on, to prompt for each piece of information one at a time.
• Validation: At each step, we'll make sure the input is valid—for example, checking the email format with regex and confirming the phone number is numeric and exactly 10 digits.
• State Management: We'll keep track of all the collected data in a dictionary, so nothing gets missed and you know exactly where you are in the process.
• Completion: Once everything looks good and all fields are filled, we'll return the data neatly packaged as a structured result.
If you'd like, I can walk you through a detailed Python implementation for this task. Just let me know, and I'll be here to assist you every step of the way!
Sources: Workflows | LiveKit Docs | complex-agents/nova-sonic/form_agent.py | examples/voice_agents/restaurant_agent.pymicroscopic-dress-75199
10/06/2025, 9:45 PMtall-airline-16756
10/06/2025, 9:45 PMAgentTask that gently guides you through collecting your name, email, phone, company name, and proxy caller status, validating each step along the way:
from dataclasses import dataclass
from typing import Optional
import re
from livekit.agents.voice import AgentTask
from livekit.agents.llm import function_tool
from livekit.agents.voice.events import RunContext
@dataclass
class ContactInfoResult:
name: str
email: str
phone: str
company: str
is_proxy: bool
def proper_capitalize(text: str) -> str:
minor_words = {'of', 'in', 'at', 'and', 'or', 'the', 'a', 'an', 'for', 'with', 'on'}
words = text.split()
return ' '.join(
word.capitalize() if i == 0 or word.lower() not in minor_words else word.lower()
for i, word in enumerate(words)
)
class CollectContactInfoTask(AgentTask[ContactInfoResult]):
def __init__(self):
super().__init__(
instructions="Collect user information step by step: name, email, phone, company, and proxy status."
)
self.collected_data = {}
async def on_enter(self):
await self._ask_name()
async def _ask_name(self):
self.session.generate_reply("Hello! Could you please tell me your full name?")
@function_tool
async def provide_name(self, name: str):
if not name or len(name.strip()) < 2:
self.session.generate_reply("Please provide a valid name.")
return
self.collected_data["name"] = proper_capitalize(name.strip())
await self._ask_email()
async def _ask_email(self):
self.session.generate_reply("Thank you. Now, please provide your email address.")
@function_tool
async def provide_email(self, email: str):
EMAIL_REGEX = r"^[A-Za-z0-9][A-Za-z0-9._%+-]*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z]{2,}$"
if not re.match(EMAIL_REGEX, email):
self.session.generate_reply("That email seems invalid. Please try again.")
return
self.collected_data["email"] = email
await self._ask_phone()
async def _ask_phone(self):
self.session.generate_reply("Now, please tell me your phone number.")
@function_tool
async def provide_phone(self, phone: str):
cleaned = re.sub(r'[\s\-\(\)\.\+\s]', '', phone)
if not cleaned.isdigit() or len(cleaned) < 10:
self.session.generate_reply("Please provide a valid 10-digit phone number.")
return
self.collected_data["phone"] = phone
await self._ask_company()
async def _ask_company(self):
self.session.generate_reply("What company do you represent?")
@function_tool
async def provide_company(self, company: str):
if not company or len(company.strip()) < 2:
self.session.generate_reply("Please provide a valid company name.")
return
self.collected_data["company"] = proper_capitalize(company.strip())
await self._ask_proxy_status()
async def _ask_proxy_status(self):
self.session.generate_reply(
"Are you calling on behalf of someone else? Please say yes or no."
)
@function_tool
async def provide_proxy_status(self, is_proxy: bool):
self.collected_data["is_proxy"] = is_proxy
result = ContactInfoResult(**self.collected_data)
self.complete(result)
Usage: When you're ready to use this task in an agent session, you can do the following:
task = CollectContactInfoTask()
result = await task # This will return a ContactInfoResult once everything is complete
print(result.name, result.email, result.phone, result.company, result.is_proxy)
If you have any questions or would like me to help adjust this for your needs, just let me know—I'm here to help!microscopic-dress-75199
10/06/2025, 10:03 PMtall-airline-16756
10/06/2025, 10:04 PMupdate_name, update_email_address, or update_phone to process and validate any corrections.
• Context Updates: It’s helpful to dynamically adjust the conversation context with update_chat_ctx() so the corrected info is properly reflected.
• Verbal Confirmation: Don’t forget to acknowledge the update to the user using session.generate_reply() or `session.say()`—this really helps them feel heard.
• Validation: Make sure to validate corrections (like checking email format or phone number length) before moving forward.
If you’d like, I’d be more than happy to assist you in integrating these features into your task or guide you through implementing corrections for any specific fields. Just let me know!
Sources: Agents v0.x migration guide - Node.js | LiveKit Docs | Agents v0.x migration guide - Python | LiveKit Docs | External data and RAG | LiveKit Docs | livekit-agents/livekit/agents/voice/agent.py | examples/src/restaurant_agent.tsmicroscopic-dress-75199
10/06/2025, 10:04 PMtall-airline-16756
10/06/2025, 10:05 PMmicroscopic-dress-75199
10/06/2025, 10:07 PM