careful-activity-6891
11/12/2025, 12:52 PMtall-airline-16756
11/12/2025, 12:52 PMtall-airline-16756
11/12/2025, 12:53 PMhang_up or call_transfer, but don’t worry—these features are definitely supported through LiveKit's APIs:
• Hang Up: You can use the delete_room API to gracefully end the call for everyone involved.
• Call Transfer: The transfer_sip_participant API lets you transfer the caller to another number or SIP endpoint smoothly.
These APIs give you the flexibility to implement these features exactly how you need. If you'd like, I’m more than happy to share more details or examples to help you get started—just let me know!
Sources: Call forwarding | LiveKit docs | LiveKit Docs | Agents telephony integration | LiveKit docs | agent.py | Agent speech and audio | LiveKit docscareful-activity-6891
11/12/2025, 12:55 PMtall-airline-16756
11/12/2025, 12:56 PMhang_up and call_transfer during your pre-lead qualification outreach, you can seamlessly integrate LiveKit's APIs into your workflow:
• Hang Up: You can use the delete_room API to gracefully end the call for all participants. This comes in handy when the lead interaction is finished or if you need to wrap things up.
• Call Transfer: The transfer_sip_participant API allows you to transfer the lead to another number or SIP endpoint, like a human agent or a specific department, making the process smooth and efficient.
These APIs can be triggered automatically based on how the lead responds or other conditions you set. If you'd like, I’m here to provide implementation examples or help you set up this workflow step-by-step. Just let me know!
Sources: Agents telephony integration | LiveKit docs | agent.py | Company directory phone assistant | LiveKit Docs | sip-refer/README.mdoc | Agent-assisted warm transfer | LiveKit docscareful-activity-6891
11/12/2025, 2:19 PMSalesAgent. During conversations, the logs only show user transcripts — for example:
2025-11-12 11:41:25,353 - DEBUG livekit.agents - received user transcript {"user_transcript": "..."}
I want to also capture and log the bot (agent) responses in the same console/log file, so I can see both sides of the conversation.
How can I modify my LiveKit agent setup to log both user and bot messages in real time?tall-airline-16756
11/12/2025, 2:23 PMSalesAgent, here’s a friendly approach you can try out:
• Use the conversation_item_added Event: This handy event captures all conversation messages as they happen. Here’s an example to get you started:
@session.on("conversation_item_added")
def conversation_item_added(item):
participant_type = "User" if item.item.role == "user" else "Bot"
print(f"[{item.item.created_at}] {participant_type}: {item.item.text}")
• Log to External Services: You can also forward these logs to services like Datadog or CloudWatch for easier monitoring in one place.
• Ensure Complete Capture: Don’t forget to use RoomInputOptions.close_on_disconnect to make sure all logs are saved when a disconnection happens.
If you’d like, I’m here to walk you through any part of this or provide more details—just let me know!
Sources: docs/index.yaml | Logs, metrics, and telemetry | LiveKit docs | Log collection | LiveKit docs | Knowledge Base Content | livekit/livekit_composite | DeepWiki | How to capture real-time agent transcriptions during conversationscareful-activity-6891
11/12/2025, 2:29 PMRoomIO -> AgentSession -> TranscriptSynchronizer -> RoomIO
2025-11-12 142849,771 - DEBUG livekit.agents - using transcript io: AgentSession -> TranscriptSynchronizer -> RoomIO
2025-11-12 142849,780 - ERROR livekit - failed to emit event conversation_item_added
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/livekit/rtc/event_emitter.py", line 58, in emit
callback(*callback_args)
File "/tmp/ipython-input-1916331812.py", line 19, in on_conversation_item
text = item.item.text
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pydantic/main.py", line 991, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'ChatMessage' object has no attribute 'text'
2025-11-12 142859,192 - INFO livekit.agents - shutting down worker {"id": "unregistered"}
2025-11-12 142859,195 - DEBUG livekit.agents - shutting down job task {"reason": "", "user_initiated": false}
2025-11-12 142859,197 - DEBUG livekit.agents - job exiting {"reason": "", "tid": 68986, "job_id": "simulated-job-0887620f7cfa"}
2025-11-12 142859,245 - ERROR livekit - failed to emit event conversation_item_added
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/livekit/rtc/event_emitter.py", line 58, in emit
callback(*callback_args)
File "/tmp/ipython-input-1916331812.py", line 19, in on_conversation_item
text = item.item.text
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pydantic/main.py", line 991, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'ChatMessage' object has no attribute 'text'
2025-11-12 142859,249 - DEBUG livekit.agents - input stream detached {"participant": "user", "source": "SOURCE_UNKNOWN", "accepted_sources": ["SOURCE_MICROPHONE"]}
2025-11-12 142901,255 - DEBUG livekit.agents - session closed {"reason": "job_shutdown", "error": null}
2025-11-12 142901,257 - DEBUG livekit.agents - http_session(): closing the httpclient ctx
import logging
import asyncio
from livekit.agents import JobContext, WorkerOptions, AgentSession, jupyter
from your_agent_file import SalesAgent # adjust to your file
logger = logging.getLogger("livekit.agents")
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s - %(levelname)s - %(message)s",
)
async def entrypoint(ctx: JobContext):
await ctx.connect()
agent = SalesAgent()
session = AgentSession()
# Log both user and bot messages
def on_conversation_item(message):
role = getattr(message, "role", "unknown").upper()
text = getattr(message, "content", None) or getattr(message, "text", None)
if text:
logger.debug(f"{role}: {text}")
session.on("conversation_item_added", on_conversation_item)
# Start the session and keep it alive
await session.start(room=ctx.room, agent=agent)
while True:
await asyncio.sleep(1)tall-airline-16756
11/12/2025, 2:30 PMChatMessage object doesn’t have a text attribute. Instead, you’ll want to use the text_content property to get the message text.
Here’s an updated version of your on_conversation_item function that should do the trick:
def on_conversation_item(item):
role = getattr(item, "role", "unknown").upper()
text = getattr(item, "text_content", None) # Use text_content instead of text
if text:
logger.debug(f"{role}: {text}")
This change should help you log both user and bot messages properly. If you have any more questions or need a hand with anything else, just let me know—I’m here to help!
Sources: basics/label_messages.py | livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/util...careful-activity-6891
11/13/2025, 11:14 AMtall-airline-16756
11/13/2025, 11:15 AMuv add "livekit-agents[cartesia]~=1.2"
1. Next, import the TTS plugin correctly like this:
from livekit.plugins import cartesia
tts = cartesia.TTS(
model="sonic-3",
voice="f786b574-daa5-4673-aa0c-cbe3e8534c02",
)
1. Finally, don’t forget to set your Cartesia API key in the environment variable CARTESIA_API_KEY.
If you run into any more questions or need a hand with any of these steps, just let me know—I’m happy to help!
Sources: Cartesia TTS plugin guide | LiveKit Docs | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/__init__.pycareful-activity-6891
11/13/2025, 11:51 AMtall-airline-16756
11/13/2025, 11:51 AMlk.transcription text stream topic.
If you'd like to capture these bot responses, you’ll want to set up a custom receiver that listens to the lk.transcription text stream. You can also keep an eye on agent session events like conversation_item_added to stay updated on the conversation flow.
If you’d like, I’m here to help you with implementing the text stream receiver or anything else you might need—just let me know!
Sources: How to Set Up Speech-to-Text Input with Text-Only Output in LiveKit Agents | Agents v0.x migration guide - Python | LiveKit docs | Agents v0.x migration guide - Node.js | LiveKit Docs | Events and error handling | LiveKit docs | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti...careful-activity-6891
11/14/2025, 1:49 PMq / nq variables and the full conversation (bot + user + transcript)
Given this, which frontend framework should I use?tall-airline-16756
11/14/2025, 1:49 PM@livekit/components-react), making integration smooth.
• It offers API routes for backend tasks, like generating tokens, which can simplify your workflow.
• There are official LiveKit templates and examples, such as the "Next.js Voice Agent Starter," that are built using Next.js to help you get started quickly.
You can easily scaffold a production-ready frontend using the LiveKit CLI with this command:
lk app create --template voice-assistant-frontend
If you’d like, I’m here to help guide you through the setup or answer any questions you have along the way!
Sources: Client SDKs | livekit/livekit_composite | DeepWiki | README.md | Web and mobile frontends | LiveKit docs | complex-agents/nova-sonic/README.mdcareful-activity-6891
11/14/2025, 1:56 PMname
◦ phone
◦ timezone (optional)
• Upload/Enter Script Content
• Agents Transfer Numbers (multiple)
• Campaign Time Window:
◦ Start Time
◦ End Time
◦ Days Allowed (Mon–Sun toggles)
⚡ Optional simple UI controls:
• Voice Agent: choose voice (DG/Kokoro)
• Max attempts per number
✔️ B) Campaign Control Panel
User should be able to:
• Start Campaign
• Pause Campaign
• Resume Campaign
• Stop Campaign
• View the current calling number
• See next numbers queued
• See live status:
◦ "Ringing"
◦ "Talking"
◦ "Qualified – transferring"
◦ "Not Qualified – ending"
◦ "No Answer"
◦ "Busy – Rescheduling"
✔️ C) Results Dashboard (very minimal)
A simple report table:
Caller NameNumberResultNotesCall TimeJohn Doe+1234QualifiedTransferred2025-11-14Smith+7890Not QualifiedFailed age criteria………………careful-activity-6891
11/14/2025, 1:57 PMcall_id
• qualification_status
• transfer_number
• notes
✔️ D) Transfer Logic
When agent → “qualified”
FastAPI should:
• Pick the correct transfer number (round robin or priority order)
• Pass it to agent via function tool:
◦ transfer_call(number)
✔️ E) Scheduler (Optional in MVP but recommended)
Allows user to set:
• Run campaign from 10am to 6pm
• Avoid calling at night
This can be done with:
• APScheduler
• Or cron-like triggers in FastAPItall-airline-16756
11/14/2025, 1:57 PMoutbound-caller-python template to initiate calls and manage room creation. You can set it up easily by running this command:
lk app create --template outbound-caller-python my-outreach-agent
1. Implement Campaign Setup: Customize the template to load your contact lists (like CSV files) and schedule batch calls. Adding dynamic prompts will help personalize each outreach.
2. Build a Control Panel: Consider using the agent-starter-react template to create a dashboard where you can set up campaigns, monitor them live, and make manual adjustments whenever needed.
3. Design Agent Workflows: Plan out your outreach flow in phases—greeting, delivering messages, collecting responses, and transferring calls—to keep things smooth and effective.
4. Log Results: Make sure to capture important events like conversation_item_added, and save transcripts, call outcomes, and related data in a database for easy review.
5. Deploy at Scale: When you’re ready to go big, use Docker to containerize your agent and deploy it on platforms like AWS or Render. Setting up autoscaling will help manage large campaigns effortlessly.
If you’d like, I’m here to help with any specific part—whether it’s campaign scheduling, CRM integration, or anything else. Just let me know!
Sources: External data and RAG | LiveKit Docs | README.md | TEMPLATE.md | Workflows | LiveKit docs | Logs, metrics, and telemetry | LiveKit Docscareful-activity-6891
11/14/2025, 2:00 PMname
◦ phone
◦ timezone (optional)
• Upload/Enter Script Content
• Agents Transfer Numbers (multiple)
• Campaign Time Window:
◦ Start Time
◦ End Time
◦ Days Allowed (Mon–Sun toggles)
⚡ Optional simple UI controls:
• Voice Agent: choose voice (DG/Kokoro)
• Max attempts per number
✔️ B) Campaign Control Panel
User should be able to:
• Start Campaign
• Pause Campaign
• Resume Campaign
• Stop Campaign
• View the current calling number
• See next numbers queued
• See live status:
◦ "Ringing"
◦ "Talking"
◦ "Qualified – transferring"
◦ "Not Qualified – ending"
◦ "No Answer"
◦ "Busy – Rescheduling"
✔️ C) Results Dashboard (very minimal)
A simple report table:
Caller NameNumberResultNotesCall TimeJohn Doe+1234QualifiedTransferred2025-11-14Smith+7890Not QualifiedFailed age criteria………………
Filters:
• Filter by Campaign
• Filter by Result
◦ Qualified
◦ Not Qualified
◦ Busy / Reschedule
◦ No Answer
◦ In Progress
👉 This is enough for MVP.
✅ 3) Minimal BACKEND requirements (FastAPI)
Your MVP backend should include:
✔️ A) Contact Upload API
• Save all contacts to DB with campaign_id
✔️ B) Campaign Engine
A single FastAPI background worker:
• Picks next number
• Tells LiveKit agent to dial
• Waits for agent result callback
• Updates DB accordingly
• Moves to next number
✔️ C) Qualification Results Callback
LiveKit / Agent → FastAPI webhook:
• call_id
• qualification_status
• transfer_number
• notes
✔️ D) Transfer Logic
When agent → “qualified”
FastAPI should:
• Pick the correct transfer number (round robin or priority order)
• Pass it to agent via function tool:
◦ transfer_call(number)
✔️ E) Scheduler (Optional in MVP but recommended)
Allows user to set:
• Run campaign from 10am to 6pm
• Avoid calling at night
This can be done with:
• APScheduler
• Or cron-like triggers in FastAPItall-airline-16756
11/14/2025, 2:01 PMoutbound-caller-python template to manage calls, hangups, and transfers. You can extend it to include your qualification logic and connect it with FastAPI for smooth backend communication.
◦ Consider implementing transfer_call as a handy function tool to handle qualified leads and dynamically pass transfer numbers.
1. Streamlit UI:
◦ Create a simple interface where users can upload scripts that are then converted into agent instructions on the fly. Streamlit’s file upload and form components make this super straightforward.
1. API + DB:
◦ Build a FastAPI backend with endpoints for uploading contacts, managing campaigns, and handling result callbacks. A relational database like PostgreSQL will be great for storing campaign records, phone numbers, and qualification results.
1. Minimal UI Features:
◦ For setting up campaigns, include fields like campaign name, contact uploads (CSV), script content, transfer numbers, and time windows.
◦ In the control panel, give users the ability to start, pause, resume, and stop campaigns, plus view live call statuses.
◦ For the results dashboard, add filters by campaign and result, and display a simple report table for easy insights.
1. Backend Recommendations:
◦ Use FastAPI’s background tasks to run a campaign engine that picks numbers, dials via LiveKit, and updates the database based on agent callbacks.
◦ Set up a webhook to receive qualification results from LiveKit and keep your campaign status up to date.
◦ Implement transfer logic with a round-robin or priority-based approach to select transfer numbers smoothly.
◦ Optionally, use APScheduler or cron-like triggers to schedule campaigns within specific time windows.
If you’d like, I’d be happy to provide detailed implementation examples for any part you’re interested in, like the FastAPI backend or LiveKit agent integration. Just let me know!careful-activity-6891
11/14/2025, 2:05 PMtall-airline-16756
11/14/2025, 2:07 PMimport subprocess
import sys
if st.button("Start LiveKit Bot"):
process = subprocess.Popen([sys.executable, "agent.py", "start"])
st.write("Bot started with PID:", process.pid)
if st.button("Stop LiveKit Bot"):
process.terminate()
st.write("Bot stopped")
1. Thread-Based Approach: You can also run the bot in a separate thread with its own asyncio event loop. This lets you integrate more closely with Streamlit, but it does mean you’ll need to manage the event loop carefully.
Both of these methods will let your bot run independently from Streamlit’s synchronous execution, giving you more flexibility. If you’d like, I’m happy to walk you through more detailed examples for either approach—just let me know!
Sources: README.md | livekit-agents/livekit/agents/cli/_run.py | App templates | LiveKit docscareful-activity-6891
11/14/2025, 2:13 PMtall-airline-16756
11/14/2025, 2:14 PMimport streamlit as st
import asyncio
import threading
from livekit.agents import JobContext, WorkerOptions, AgentSession
class BotRunner:
def __init__(self):
self.thread = None
self.loop = None
def start_bot(self):
if self.thread and self.thread.is_alive():
st.warning("Bot is already running!")
return
self.thread = threading.Thread(target=self._run_bot)
self.thread.daemon = True
self.thread.start()
st.success("Bot started successfully!")
def _run_bot(self):
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
async def entrypoint(ctx: JobContext):
await ctx.connect()
session = AgentSession()
await session.start(room=ctx.room, agent=DynamicSalesAgent())
opts = WorkerOptions(entrypoint_fnc=entrypoint)
self.loop.run_until_complete(opts.run())
# Streamlit UI
st.title("LiveKit Bot Controller")
if "bot_runner" not in st.session_state:
st.session_state.bot_runner = BotRunner()
if st.button("Start Bot"):
st.session_state.bot_runner.start_bot()
This way, your bot fits right into Streamlit and handles the asyncio event loop smoothly in its own thread. If you have any questions or want me to walk you through any part, just let me know—I’m here to help!careful-activity-6891
11/15/2025, 8:38 AMtall-airline-16756
11/15/2025, 8:39 AMpip install streamlit livekit-agents asyncio
1. Set Up the Bot Logic:
Next, let's create a Python class that will manage your bot. This class will take care of starting the bot in its own thread with an asyncio event loop, keeping things running smoothly:
import asyncio
import threading
from livekit.agents import JobContext, WorkerOptions, AgentSession
class BotRunner:
def __init__(self):
self.thread = None
self.loop = None
def start_bot(self):
if self.thread and self.thread.is_alive():
return "Bot is already running!"
self.thread = threading.Thread(target=self._run_bot)
self.thread.daemon = True
self.thread.start()
return "Bot started successfully!"
def _run_bot(self):
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
async def entrypoint(ctx: JobContext):
await ctx.connect()
session = AgentSession()
await session.start(room=ctx.room, agent=DynamicSalesAgent())
opts = WorkerOptions(entrypoint_fnc=entrypoint)
self.loop.run_until_complete(opts.run())
1. Integrate with Streamlit:
Now, let's build a simple Streamlit interface so you can easily start and stop your bot with just a click:
import streamlit as st
st.title("LiveKit Bot Controller")
if "bot_runner" not in st.session_state:
st.session_state.bot_runner = BotRunner()
if st.button("Start Bot"):
message = st.session_state.bot_runner.start_bot()
st.write(message)
1. Run the Streamlit App:
Save your code to a file, maybe name it app.py, and then run it with this command:
streamlit run app.py
1. Test the Bot:
Finally, just click the "Start Bot" button in your Streamlit app, and your LiveKit bot will launch right from there!
This setup is designed to keep your bot running smoothly and asynchronously, so it won’t interrupt your Streamlit app’s interface. If you have any questions or want me to walk you through any part, just let me know—I’m happy to help!careful-activity-6891
11/15/2025, 9:18 AMtall-airline-16756
11/15/2025, 9:19 AMlocalhost:7880 isn’t reachable right now. No worries, I’m here to help you get this sorted out! Here’s a friendly step-by-step guide:
1. Make Sure the LiveKit Server is Up and Running:
You can start the server locally by running this command:
livekit-server --dev
If you’re using Docker, try this:
docker run -p 7880:7880 -p 7881:7881 livekit/livekit-server --dev
1. Double Check the WebSocket URL:
Make sure the URL looks like ws://localhost:7880 for a regular WebSocket, or wss://localhost:7880 if you’re using a secure connection.
2. Look Into Docker Networking:
If Docker is involved, sometimes localhost needs to be swapped out for host.docker.internal on Mac or Windows, or 172.17.0.1 on Linux.
3. Try Testing the Connection:
You can use the LiveKit CLI to see if the connection works like this:
lk room join --url ws://localhost:7880 --api-key devkey --api-secret secret my_first_room
1. Give the Connection Another Shot:
Make sure your agent is set up to retry connecting enough times, like so:
from livekit.agents import WorkerOptions
opts = WorkerOptions(ws_url="ws://localhost:7880", max_retry=30)
If you hit any bumps or want me to walk you through any of these steps, just let me know—I’m here to help!
Sources: Diagnosing Connection Errors with Connection Test Utility | livekit-plugins/livekit-plugins-rtzr/livekit/plugins/rtzr/stt.py | Ports and firewall | LiveKit docs | Samples~/Basic/Assets/RoomManager.cs | Self-hosting the Ingress Service | LiveKit docscareful-activity-6891
11/15/2025, 9:29 AMtall-airline-16756
11/15/2025, 9:29 AMServerDisconnectedError happens when the WebSocket connection to the LiveKit server unexpectedly ends. Don’t worry, I’m here to help you through it! Here are some steps you can follow to get things back on track:
1. Make Sure the LiveKit Server is Running:
First, check that the server is up and reachable at localhost:7880. If it’s not running, you can start it with this command:
livekit-server --dev
1. Use Retry Logic:
Sometimes connections hiccup, so it’s helpful to try reconnecting with exponential backoff. Here’s a simple way to do that:
retry_delay = min(retry_count * 2, 10)
await asyncio.sleep(retry_delay)
1. Set Heartbeat Intervals:
To keep the connection healthy and spot any issues early, set up a heartbeat like this:
ws = await session.ws_connect(url, heartbeat=30.0)
1. Handle WebSocket Errors Gracefully:
Wrapping your connection code in try-except blocks helps manage errors such as WSMsgType.ERROR or timeouts smoothly:
try:
msg = await asyncio.wait_for(ws.receive(), timeout=5)
except asyncio.TimeoutError:
# Handle timeout
1. Clean Up Connections Properly:
When you’re done with a room, always call Room.disconnect() to prevent abrupt disconnections.
If you’d like, I’m here to help you implement any of these steps or answer any questions you have. Just let me know!
Sources: Connecting to LiveKit | LiveKit docs | livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/stt_v2.pycareful-activity-6891
11/15/2025, 10:08 AMtall-airline-16756
11/15/2025, 10:09 AMLIVEKIT_CONFIG = {
'url': 'wss://your-livekit-url',
'api_key': 'your-api-key',
'api_secret': 'your-api-secret'
}
1. Generate Tokens Dynamically:
Next, use the LiveKit Python SDK to create tokens for room access. Here’s a handy function for that:
from livekit import api
def generate_token(room_name, participant_identity):
token = api.AccessToken(
LIVEKIT_CONFIG['api_key'],
LIVEKIT_CONFIG['api_secret']
).with_identity(participant_identity) \
.with_grants(api.VideoGrants(room_join=True, room=room_name))
return token.to_jwt()
1. Integrate with Streamlit:
Now, let’s create a Streamlit form that takes user inputs to generate scripts dynamically:
import streamlit as st
st.title("LiveKit Bot Configuration")
room_name = st.text_input("Room Name")
participant_identity = st.text_input("Participant Identity")
if st.button("Generate Token"):
token = generate_token(room_name, participant_identity)
st.write("Generated Token:", token)
1. Run the Bot:
Finally, you can use Python’s subprocess module to start the bot based on the inputs from Streamlit like this:
import subprocess
if st.button("Start Bot"):
process = subprocess.Popen([
'python', 'your_agent_script.py', 'start'
])
st.write("Bot started with PID:", process.pid)
If you have any questions or need help with any specific part, just let me know—I’m here to help!
Sources: Voice AI quickstart | LiveKit docs | Deploying to custom environments | LiveKit Docs | Generating tokens | LiveKit docs | complex-agents/shopify-voice-shopper/shopify-voice-frontend/.env.example | client/app/(chat)/page.tsxcareful-activity-6891
11/15/2025, 10:12 AMtall-airline-16756
11/15/2025, 10:12 AMcareful-activity-6891
11/15/2025, 10:16 AMtall-airline-16756
11/15/2025, 10:17 AMwith_ttl() method in the LiveKit Python SDK expects a datetime.timedelta object, rather than keyword arguments like hours. No worries though! Here's a simple way to fix this:
import datetime
from livekit.api import AccessToken, VideoGrants
def generate_token(room_name, participant_identity, participant_name="User"):
try:
token = (
AccessToken(api_key=LIVEKIT_CONFIG['api_key'], api_secret=LIVEKIT_CONFIG['api_secret'])
.with_identity(participant_identity)
.with_name(participant_name)
.with_grants(VideoGrants(room_join=True, room=room_name))
.with_ttl(datetime.timedelta(hours=2)) # Set TTL to 2 hours
.to_jwt()
)
return token
except Exception as e:
st.error(f"❌ Token generation failed: {e}")
return None
This way, the TTL will be set properly. If you have any more questions or need a hand with anything else, just let me know—I'm here to help!
Sources: livekit-api/livekit/api/access_token.py | livekit-agents/livekit/agents/inference/_utils.py | packages/livekit-server-sdk/src/ServiceBase.ts | src/main/kotlin/io/livekit/server/ServiceClientBase.ktcareful-activity-6891
11/15/2025, 10:20 AMtall-airline-16756
11/15/2025, 10:21 AMcareful-activity-6891
11/15/2025, 10:22 AMtall-airline-16756
11/15/2025, 10:22 AMdocker logs [container_id]
1. Bot Logs:
When you run the bot script, the logs will show up in the terminal where the script is running. Just make sure logging is enabled in your bot script like this:
import logging
logging.basicConfig(level=logging.DEBUG)
1. Streamlit Logs:
If you're running the bot through Streamlit, take a look at the terminal where you started the Streamlit app. The bot’s logs should appear there if everything is set up correctly.
2. LiveKit Cloud Logs:
For those using LiveKit Cloud, you might find logs in the LiveKit Cloud dashboard, usually under the monitoring or analytics section.
Please don’t hesitate to reach out if you’d like a hand accessing or understanding these logs—I’m happy to guide you through it!careful-activity-6891
11/15/2025, 10:27 AMtall-airline-16756
11/15/2025, 10:28 AMcareful-activity-6891
11/15/2025, 10:40 AMtall-airline-16756
11/15/2025, 10:40 AMcareful-activity-6891
11/15/2025, 12:51 PMcareful-activity-6891
11/17/2025, 11:17 AMUnboundLocalError Traceback (most recent call last)
/tmp/ipython-input-1999222343.py in <cell line: 0>()
62
63 print("✅ Starting LiveKit bot...")
---> 64 jupyter.run_app(
65 WorkerOptions(entrypoint_fnc=entrypoint),
66 jupyter_url="https://jupyter-api-livekit.vercel.app/api/join-token"
/usr/local/lib/python3.12/dist-packages/livekit/agents/jupyter.py in run_app(server, jupyter_url)
129
130 args = proto.CliArgs(
--> 131 log_level="DEBUG", devmode=True, url=ws_url, api_key=api_key, api_secret=api_secret
132 )
133 cli._run_worker(server, args, jupyter=True)
UnboundLocalError: cannot access local variable 'api_key' where it is not associated with a valuecareful-activity-6891
12/31/2025, 1:10 PM