livekit-agents@1.5.4

livekit/agentslivekit-agents@1.5.4Apr 16, 2026by theomonnom

AI Summary

This release refines preemptive generation behavior to reduce costs and improve handling of long speech by introducing granular configuration options for developers.

Key Highlights

  • Introduced PreemptiveGenerationOptions for fine-grained control
  • Refined default behavior for long or intermittent user speech
  • Added configurable max_speech_duration and max_retries limits

New Features

  • PreemptiveGenerationOptions (enabled, preemptive_tts, max_speech_duration, max_retries)

Full Release Notes

## New features
### Preemptive generation: added more granular options
Refines default behavior for preemptive generation to better handle long or intermittent user speech, reducing unnecessary downstream inference and associated cost increases.

Also introduces `PreemptiveGenerationOptions` for developers who need fine-grained control over this behavior.

https://github.com/livekit/agents/blob/78a66bcf79c5cea82989401c408f1dff4b961a5b/livekit-agents/livekit/agents/voice/turn.py#L115
```python
class PreemptiveGenerationOptions(TypedDict, total=False):
    """Configuration for preemptive generation."""

    enabled: bool
    """Whether preemptive generation is enabled. Defaults to ``True``."""

    preemptive_tts: bool
    """Whether to also run TTS preemptively before the turn is confirmed.
    When ``False`` (default), only LLM runs preemptively; TTS starts once the
    turn is confirmed and the speech is scheduled."""

    max_speech_duration: float
    """Maximum user speech duration (s) for which preemptive generation
    is attempted. Beyond this threshold, preemptive generation is skipped
    since long utterances are more likely to change and users may expect
    slower responses. Defaults to ``10.0``."""

    max_retries: int
    """Maximum number of preemptive generation attempts per user turn.
    The counter resets when the turn completes. Defaults to ``3``."""
```

## What's Changed
* fix(voice): add PreemptiveGenerationOptions for fine-grained control by @longcw in https://github.com/livekit/agents/pull/5428


**Full Changelog**: https://github.com/livekit/agents/compare/livekit-agents@1.5.3...livekit-agents@1.5.4