fragJulia
Changelog

2026-04-25 — ChatContext.messages() + SynthesizeStream/ChunkedStream tts+conn_options init

Description

Two more livekit-agents 1.5+ API drift fixes surfaced after PR-K's sync-method fix deployed:

File "/app/custom_plugins/bedrock_mistral_llm.py", line 122, in _build_messages
    for msg in chat_ctx.messages:
TypeError: 'method' object is not iterable

File "/app/custom_plugins/voxtral_tts.py", line 206, in __init__
    super().__init__()
TypeError: SynthesizeStream.__init__() missing 2 required keyword-only arguments: 'tts' and 'conn_options'

What changed

voice/agent/custom_plugins/bedrock_mistral_llm.py

  • _build_messages: chat_ctx.messageschat_ctx.messages(). ChatContext.messages was a list-attribute pre-1.5; it's now a regular method (filters items to ChatMessage instances). Verified at livekit/agents/llm/chat_context.py:403 — it has no @property decorator, just a plain def messages(self) -> list[ChatMessage].

voice/agent/custom_plugins/voxtral_tts.py

  • VoxtralChunkedStream.__init__: accepts tts: Any, conn_options: Any (keyword-only, required) and forwards super().__init__(tts=tts, input_text=text, conn_options=conn_options). Parent tts.ChunkedStream.__init__(*, tts: TTS, input_text: str, conn_options: APIConnectOptions) requires all three.
  • VoxtralSynthesizeStream.__init__: accepts tts: Any, conn_options: Any and forwards super().__init__(tts=tts, conn_options=conn_options). Parent tts.SynthesizeStream.__init__(*, tts: TTS, conn_options: APIConnectOptions) requires both.
  • VoxtralTTS.synthesize: same sync-fix as PR-K's stream (was async def synthesize(self, text: str), now def synthesize(self, text, *, conn_options=None, **kwargs)). Forwards tts=self, conn_options=conn_options to VoxtralChunkedStream. Body otherwise unchanged.
  • VoxtralTTS.stream: now also forwards tts=self, conn_options=conn_options to VoxtralSynthesizeStream (PR-K added the conn_options accept; this PR adds the forwarding to satisfy the parent init).

voice/tests/conftest.py

  • _ChunkedStream.__init__: now accepts tts=None, input_text="", conn_options=None, **kwargs to match the new parent signature. Body unchanged (still mocks event channel).
  • _SynthesizeStream.__init__: now accepts tts=None, conn_options=None, **kwargs. Body unchanged.

voice/tests/test_bedrock_mistral_llm.py

  • _make_chat_context helper: ctx.messages = [...] (list attribute) → ctx.messages = lambda: msg_list (callable). Mirrors the new ChatContext.messages() method shape so the test's stub matches what the production code now expects.

voice/tests/test_voxtral_tts.py

  • TestVoxtralSynthesizeStreamInit (3 tests): direct instantiations of VoxtralSynthesizeStream(...) now also pass tts=None, conn_options=None to satisfy the new required kwargs.

Cross-check (read-only)

Source of truth confirmed in the running container:

  • livekit/agents/llm/chat_context.py:387–410class ChatContext with @property def items and plain def messages(self) -> list[ChatMessage]
  • livekit/agents/tts/tts.py:174ChunkedStream.__init__(*, tts: TTS, input_text: str, conn_options: APIConnectOptions)
  • livekit/agents/tts/tts.py:422SynthesizeStream.__init__(*, tts: TTS, conn_options: APIConnectOptions)

Why now

Surfaced during R-10 #670 E2E re-probe right after PR-K (#694, sync chat/stream) deployed. With LLM/TTS now sync, the framework reaches the actual call path and immediately hits both bugs. Same class of API drift as PR-I/J/K.

Test plan

  • CI: 4 BedrockMistralLLM tests + 3 VoxtralSynthesizeStream tests still pass with the new signatures.
  • Image rebuild + recreate on EC2.
  • R-10 Probe 2 re-run: no 'method' object is not iterable, no SynthesizeStream.__init__() missing 2 required keyword-only arguments. Pipeline runs LLM call (Bedrock streaming) and TTS synth (Voxtral) to completion.
  • Probe receives non-silent audio response from the actual TTS pipeline (not framework placeholder). Pipeline log shows output_guard stage firing on the LLM output.

Rollout / reversibility

Reversible via revert. EC2 rebuild + recreate (~10 s combined).

Out of scope

turn_detection= deprecation warning, production wiring — same as previous PRs in this series.

On this page