how to make livekite AI agent only has text reply ...
# ask-ai
g
how to make livekite AI agent only has text reply (transcripton channel or some channel) and no voice reply. give me python code example
t
Thanks for reaching out, Daniel. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Here is an example of a LiveKit AI agent that only replies with text (no voice):
Copy code
import logging
from dotenv import load_dotenv

from livekit.agents import (
    Agent,
    AgentSession,
    JobContext,
    RoomInputOptions,
    RoomOutputOptions,
    WorkerOptions,
    cli,
)
from livekit.plugins import openai

logger = logging.getLogger("text-only")
logger.setLevel(<http://logging.INFO|logging.INFO>)

load_dotenv()

class MyAgent(Agent):
    def __init__(self) -> None:
        super().__init__(
            instructions="You are a helpful assistant.",
            llm=openai.LLM(model="gpt-4o-mini"),
        )

async def entrypoint(ctx: JobContext):
    await ctx.connect()
    
    session = AgentSession()
    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),
    )

if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
This example demonstrates a text-only agent that: • Accepts text input through TextStream on the
lk.chat
topic • Sends text output through TextStream to the
lk.transcription
topic • Disables audio input and output by setting
audio_enabled=False
in both input and output options Sources: Tree View: | dse-workbench