a
Hello
t
Thanks for reaching out, Aditya. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi there! How can I help you today? I'm here to make sure you get the support you need.
a
2025-10-05 195607,280 - INFO google_genai.models - AFC remote call 1 is done. {"room": "agent-1-1759674248864"} E0000 00001759674367.870316 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. E0000 00001759674378.487183 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. E0000 00001759674389.080851 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. E0000 00001759674399.747541 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. E0000 00001759674410.527160 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. E0000 00001759674421.174841 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. E0000 00001759674431.806000 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. E0000 00001759674442.511433 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. E0000 00001759674453.138900 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. E0000 00001759674464.129401 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. E0000 00001759674474.781608 41192 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. 2025-10-05 195755,423 - ERROR livekit.agents - Error in _stt_task {"room": "agent-1-1759672726671"} Traceback (most recent call last): File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\google\api_core\grpc_helpers_async.py", line 106, in _wrapped_aiter async for response in self._call: # pragma: no branch File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\grpc\aio_call.py", line 368, in _fetch_stream_responses await self._raise_for_status() File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\grpc\aio_call.py", line 274, in _raise_for_status raise _create_rpc_error( grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with: status = StatusCode.UNAVAILABLE details = "The service is currently unavailable." debug_error_string = "UNKNOWN:Error received from peer ipv6:%5B240468004009815:200a%5D:443 {grpc_status:14, grpc_message:"The service is currently unavailable."}"
The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\KRISHNA\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 222, in aexit await self.gen.athrow(typ, value, traceback) File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\livekit\agents\utils\connection_pool.py", line 80, in connection yield conn File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\livekit\plugins\google\stt.py", line 534, in _run task.result() File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\livekit\plugins\google\stt.py", line 434, in process_stream async for resp in stream: File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\google\api_core\grpc_helpers_async.py", line 109, in _wrapped_aiter raise exceptions.from_grpc_error(rpc_error) from rpc_error google.api_core.exceptions.ServiceUnavailable: 503 The service is currently unavailable. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\livekit\agents\stt\stt.py", line 253, in _main_task return await self._run() ^^^^^^^^^^^^^^^^^ File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\livekit\plugins\google\stt.py", line 555, in _run raise APIStatusError( livekit.agents._exceptions.APIStatusError: The service is currently unavailable. [] (status_code=503, request_id=None, body=None, retryable=True) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\livekit\agents\utils\log.py", line 16, in async_fn_logs return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\livekit\agents\voice\audio_recognition.py", line 512, in _stt_task async for ev in node: File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\livekit\agents\voice\agent.py", line 380, in stt_node async for event in stream: File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\livekit\agents\stt\stt.py", line 372, in anext raise exc # noqa: B904 ^^^^^^^^^ File "C:\Bhushan\ai livekit projects\frontend\agent-starter-python\.venv\Lib\site-packages\livekit\agents\stt\stt.py", line 260, in _main_task raise APIConnectionError( livekit.agents._exceptions.APIConnectionError: failed to recognize speech after 3 attempts (body=None, retryable=True) 2025-10-05 195912,084 - DEBUG livekit.plugins.google - stream timed out, restarting. {"room": "agent-1-1759674248864"} E0000 00001759674552.088968 18672 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. 2025-10-05 195917,987 - INFO livekit.agents - closing agent session due to participant disconnect (disable via
RoomInputOptions.close_on_disconnect=False
) {"room": "agent-1-1759674248864", "participant": "User-1759674248781", "reason": "CLIENT_INITIATED"} 2025-10-05 195917,988 - DEBUG livekit.agents - input stream detached {"room": "agent-1-1759674248864", "participant": "User-1759674248781", "source": "SOURCE_UNKNOWN", "accepted_sources": ["SOURCE_MICROPHONE"]} 2025-10-05 195917,994 - DEBUG livekit.agents - stream closed {"room": "agent-1-1759674248864", "participant": "User-1759674248781", "source": "SOURCE_MICROPHONE"} 2025-10-05 195920,150 - DEBUG livekit.agents - session closed {"room": "agent-1-1759674248864", "reason": "participant_disconnected", "error": null} 2025-10-05 195921,140 - INFO livekit.agents - received job request {"job_id": "AJ_YHohGa4So7TH", "dispatch_id": "", "room_name": "agent-1-1759674559408", "agent_name": "", "resuming": false} 2025-10-05 195921,430 - INFO livekit.agents - initializing job runner {"tid": 16244} 2025-10-05 195921,751 - DEBUG asyncio - Using proactor: IocpProactor 2025-10-05 195921,753 - INFO livekit.agents - job runner initialized {"tid": 16244, "elapsed_time": 0.32} 2025-10-05 195924,516 - INFO agent - Connected to room: agent-1-1759674559408 2025-10-05 195924,648 - DEBUG livekit.agents - input stream attached {"room": "agent-1-1759674559408", "participant": null, "source": "SOURCE_UNKNOWN", "accepted_sources": ["SOURCE_MICROPHONE"]} E0000 00001759674564.661056 16244 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. 2025-10-05 195924,667 - INFO google_genai.models - AFC is enabled with max remote calls: 10. {"room": "agent-1-1759674559408"} 2025-10-05 195924,674 - DEBUG livekit.agents - using audio io:
RoomIO
->
AgentSession
->
TranscriptSynchronizer
->
RoomIO
{"room": "agent-1-1759674559408"} 2025-10-05 195924,675 - DEBUG livekit.agents - using transcript io:
AgentSession
->
TranscriptSynchronizer
->
RoomIO
{"room": "agent-1-1759674559408"} 2025-10-05 195924,676 - INFO agent - Agent session started and ready {"room": "agent-1-1759674559408"} 2025-10-05 195925,018 - DEBUG livekit.agents - start reading stream {"room": "agent-1-1759674559408", "participant": "User-1759674559364", "source": "SOURCE_MICROPHONE"} 2025-10-05 195925,271 - INFO google_genai.models - AFC remote call 1 is done. {"room": "agent-1-1759674559408"} E0000 00001759674565.289717 16244 alts_credentials.cc:93] ALTS creds ignored. Not running on GCP and untrusted ALTS is not enabled. 2025-10-05 195934,547 - DEBUG livekit.agents - resumed false interrupted speech {"room": "agent-1-1759674559408", "timeout": 2.0} 2025-10-05 195934,783 - DEBUG livekit.agents - received user transcript {"room": "agent-1-1759674559408", "user_transcript": "Itna chat Nahin Hai chat timing", "language": "en-IN"} 2025-10-05 195934,958 - DEBUG livekit.plugins.turn_detector - eou prediction {"room": "agent-1-1759674559408", "eou_probability": 0.3543683588504791, "input": "<|im_start|>user\nitna chat nahin hai chat timing", "duration": 0.166} 2025-10-05 195934,978 - INFO google_genai.models - AFC is enabled with max remote calls: 10. {"room": "agent-1-1759674559408"} 2025-10-05 195935,561 - INFO google_genai.models - AFC remote call 1 is done. {"room": "agent-1-1759674559408"} 2025-10-05 195937,806 - DEBUG livekit.agents - resumed false interrupted speech {"room": "agent-1-1759674559408", "timeout": 2.0} 2025-10-05 195942,517 - WARNING livekit - livekit:rtc engine453livekit:rtc_engine - received session close: "signal client closed: \"stream closed\"" UnknownReason Resume 2025-10-05 195942,545 - DEBUG livekit.agents - shutting down job task {"room": "agent-1-1759674248864", "reason": "room disconnected", "user_initiated": false} 2025-10-05 195942,550 - DEBUG livekit.agents - http_session(): closing the httpclient ctx {"room": "agent-1-1759674248864"} 2025-10-05 195942,551 - DEBUG livekit.agents - job exiting {"reason": "room disconnected", "tid": 18672, "job_id": "AJ_K6hkub5zXauJ"} 2025-10-05 195942,554 - DEBUG livekit.agents - http_session(): creating a new httpclient ctx {"room": "agent-1-1759674248864"} 2025-10-05 195949,927 - DEBUG livekit.agents - received user transcript {"room": "agent-1-1759674559408", "user_transcript": " Yas can u Tel MI D Sam up Tu digits fore and five.", "language": "en-IN"} 2025-10-05 195949,934 - INFO google_genai.models - AFC is enabled with max remote calls: 10. {"room": "agent-1-1759674559408"} 2025-10-05 195950,300 - DEBUG livekit.plugins.turn_detector - eou prediction {"room": "agent-1-1759674559408", "eou_probability": 0.2561372220516205, "input": "<|im_start|>assistant\nhello<|im_end|>\n<|im_start|>user\nitna chat nahin hai chat timing<|im_end|>\n<|im_start|>assistant\ni am here to help you anytime you need me<|im_end|>\n<|im_start|>user\nyas can u tel mi d sam up tu digits fore and five", "duration": 0.349} 2025-10-05 195950,302 - DEBUG livekit.agents - using preemptive generation {"room": "agent-1-1759674559408", "preemptive_lead_time": 0.3735690116882324} 2025-10-05 195950,534 - INFO google_genai.models - AFC remote call 1 is done. {"room": "agent-1-1759674559408"} 2025-10-05 200005,835 - INFO google_genai.models - AFC is enabled with max remote calls: 10. {"room": "agent-1-1759674559408"} 2025-10-05 200006,569 - INFO google_genai.models - AFC remote call 1 is done. {"room": "agent-1-1759674559408"} voice chat is working properly but text chat is not working So my voice web is working fine but my chat feature is not working ..getting the above error.. do i need to enable anything in coee
t
Thanks for reaching out! To better assist you, could you please let me know if the text chat feature was working before, or is this something new you're setting up? Also, are there any particular settings or customizations you've applied to the chat feature in your project? I'm here to help you through this!
a
First time
t
Let's walk through how to enable and configure text chat in LiveKit for the first time. I’m here to help make this as smooth as possible for you! 1. Enable Text Input in Agent Configuration: First, make sure you have
text_enabled=True
set in
RoomInputOptions
when you start your agent session. Here’s a simple example to get you started:
Copy code
await session.start(
    agent=MyAgent(),
    room=ctx.room,
    room_input_options=RoomInputOptions(text_enabled=True, audio_enabled=False),
)
1. Send Text Messages from Frontend: To send messages, use the
sendText
method targeting the
lk.chat
topic. Here’s how it looks in JavaScript:
Copy code
room.localParticipant.sendText(message, { topic: 'lk.chat' });
1. Receive Agent Responses: You’ll want to set up a custom receiver to listen for agent responses on the
lk.transcription
topic. 2. Optional Manual Input: If you prefer, you can also use the
generate_reply
method of
AgentSession
to input text directly. 3. Frontend Chat UI: For an easier chat interface, try using the
setupChat
function from
@livekit/components-core
or the
Chat
component from
@livekit/components-react
. If you’d like to see everything put together, check out the text_only.py example. And please don’t hesitate to reach out if you have any questions or need a hand—I’m here to help! Sources: frontend/pages/custom/index.tsx | README.md | Text and transcriptions | LiveKit Docs | examples/other/text_only.py | packages/core/src/components/chat.ts
a
Can we keep both text and audio enabled concurrntly ?
t
Absolutely, you can have both text and audio enabled at the same time in LiveKit! Here’s a simple way to set it up: 1. Agent Session Configuration: Within
RoomInputOptions
and
RoomOutputOptions
, just make sure you set both
text_enabled=True
and
audio_enabled=True
. These are actually set to
True
by default, so they’re usually ready to go unless you’ve turned them off. 2. Speech Output: When you use the
session.say()
method, it will handle both text and audio for you. The audio plays out loud, and the text shows up in the transcript and chat context. 3. Frontend Support: The user interface supports a
text_and_audio
mode, so you get both audio and text output working together smoothly. If you have any questions or want a hand with setting this up, just let me know—I’m here to help! Sources: livekit-agents/livekit/agents/voice/agent_activity.py | Agent speech and audio | LiveKit Docs | web/src/data/modalities.ts | Text and transcriptions | LiveKit Docs
a
So tell me what us the best way to handle both audio and text.. so basically in the front end we have shown chat interface and a button for voice where on click they cab check the voice to voice and in chat interface they can handle tect to text.. so can you give me demo code agent.py and also what changes to be made in front end ?
t
To help you smoothly handle both audio and text in LiveKit with a chat interface and a voice button, here’s a step-by-step guide: 1. Backend Configuration (agent.py) Here’s a friendly example of an agent set up to manage both audio and text:
Copy code
from livekit.agents import MultimodalAgent, JobContext, AutoSubscribe
from livekit.plugins import openai

async def entrypoint(ctx: JobContext):
    await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
    participant = await ctx.wait_for_participant()

    model = openai.realtime.RealtimeModel(
        instructions="You are a helpful assistant. Respond via voice or text.",
        modalities=["audio", "text"],
        voice="alloy",
    )

    agent = MultimodalAgent(model=model)
    agent.start(ctx.room, participant)

if __name__ == "__main__":
    from livekit.agents.cli import run_app
    run_app(entrypoint)
2. Frontend Implementation You can use LiveKit’s React components to build a chat interface with a voice button. Here’s an example to get you started: Sources: complex-agents/role-playing/role_playing_frontend/components/livekit/agent-... | agent.py | OpenAI and LiveKit partner to turn Advanced Voice into an API | OpenAI and LiveKit partner to turn Advanced Voice into an API | livekit-agents/livekit/agents/voice/agent_activity.py