i want to use livekit agent only text to text wi...
# ask-ai
p
i want to use livekit agent only text to text without voices exchanges
t
Thanks for reaching out, Yassine. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to help you with using LiveKit for text-only communication without voice. You can easily set this up by disabling audio and enabling text communication in your application. Here’s a simple way to get started: • If you're working with AI agents, just set
audio_enabled=False
in both
RoomInputOptions
and
RoomOutputOptions
. Then, use the
TextStream
to send and receive text messages smoothly. • For client-side apps, LiveKit SDKs make it easy to send and stream text messages in real-time. For example, in JavaScript, you can use
localParticipant.sendText
or
localParticipant.streamText
to handle text communication effortlessly. If you'd like, I can share some detailed code examples or walk you through any part of this. Just let me know—I’m here to help! Sources: README.md | examples/basic_text_stream/README.md | Text and transcriptions | LiveKit Docs | examples/voice_agents/realtime_load_chat_history.py | Sending text | LiveKit Docs
p
there is example of agent in python that use only text to text with the llm directly ? so no need for stt or tts
t
Sure! Here’s a simple example of a Python agent that communicates using only text-to-text with an LLM, without needing speech-to-text (STT) or text-to-speech (TTS):
Copy code
async def entrypoint(ctx: JobContext):
    session = AgentSession(
        llm=openai.LLM(model="gpt-4o-mini"),
        # No TTS or STT needed here
    )
    await session.start(
        agent=MyAgent(),
        room=ctx.room,
        room_input_options=RoomInputOptions(text_enabled=True, audio_enabled=False),
        room_output_options=RoomOutputOptions(transcription_enabled=True, audio_enabled=False),
    )
Here’s what’s happening in this setup: •
text_enabled=True
makes sure text input is turned on. •
audio_enabled=False
turns off audio input and output. • The LLM directly processes your text input and responds with text. If you have any questions or want me to walk you through more examples, just let me know—I’m here to help!