Skip to content

console text mode never displays agent-initiated messages (e.g. the on_enter greeting) #6577

Description

@ben-xiao-io

Description

In console text mode (console --text, or Ctrl+T), any assistant turn produced outside a typed exchange is never displayed. The most visible case: an agent that speaks first via session.generate_reply() in Agent.on_enter() — the documented greet-on-start pattern — shows nothing until the user types something. The greeting is generated (LLM metrics fire, conversation_item_added fires, the item lands in session.history), but the TUI stays silent. The same applies to any agent-initiated message between turns (e.g. a background tool result woven in while idle).

Audio mode is unaffected (these turns are heard via the transcript synchronizer).

Root cause

Text mode renders agent output exclusively from the events returned by session.run(user_input=...) (cli/_legacy.py::_text_mode), and it detaches the streaming path (sess.output.transcription = None in _update_sess_io). So the only messages that can ever appear are direct replies to typed input. The new TCP console has the same two decisions on the Python side (cli/cli.py).

Repro (minimal, no network)

# greeter_agent.py — FakeLLM from tests/fake_llm.py
class Greeter(Agent):
    def __init__(self) -> None:
        super().__init__(instructions="You are a test agent.")
    async def on_enter(self) -> None:
        self.session.generate_reply(instructions="GREET_NOW")

Run python greeter_agent.py console --text → expected: the greeting renders as an ● Agent block on start; actual: nothing until you type, and the greeting itself never appears.

Environment

Reproduced on livekit-agents 1.5.13 and on current main (1.6.7).

I have a fix ready — PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions