Skip to content

Add --turn-detection presets to assembly stream#169

Merged
alexkroman merged 1 commit into
mainfrom
feat/stream-turn-detection-presets
Jun 15, 2026
Merged

Add --turn-detection presets to assembly stream#169
alexkroman merged 1 commit into
mainfrom
feat/stream-turn-detection-presets

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

What

Adds assembly stream --turn-detection [aggressive|balanced|conservative], mapping the documented turn-detection quick-start configurations to one flag instead of three raw numbers.

Preset end_of_turn_confidence min_turn_silence max_turn_silence
aggressive 0.4 160 400
balanced 0.4 400 1280
conservative 0.7 800 3600

Values are verbatim from streaming/universal-streaming/turn-detection in the docs.

Behavior

  • Explicit flag wins its slot. --turn-detection conservative --min-turn-silence 200 → min=200, max stays 3600. Lets users start from a preset and tweak one knob.
  • No preset → unchanged. All three turn flags pass through as before (server defaults apply).
  • --vad-threshold is not part of any preset and is untouched.
  • --show-code shows the resolved numbers for free, since the live path and code-gen both read base_flags().

Design

A new isolated module aai_cli/streaming/turn_presets.py holds the preset table + a resolve() merge function — disjoint from shared files, testable on its own. stream/__init__.py gains the option; _exec.py's base_flags() calls resolve().

Scope

stream only. agent has no turn-detection surface today (its AgentRunConfig/voice-agent session never sets turn params), so presets there are a larger follow-up.

Tests

  • tests/test_turn_presets.py — resolver unit tests (each preset's exact values, per-slot override, passthrough)
  • tests/test_stream_exec.pybase_flags() seam
  • tests/test_stream_command_flags.py — argv → StreamingParameters end-to-end
  • Regenerated test_snapshots_help_run.ambr

Full gate (./scripts/check.sh) green: 100% patch coverage, mutation gate clean.

🤖 Generated with Claude Code

Map the documented Aggressive/Balanced/Conservative turn-detection quick-start configs (streaming/universal-streaming/turn-detection) to a single `--turn-detection` flag, so users don't have to hand-set the three raw knobs (--end-of-turn-confidence / --min-turn-silence / --max-turn-silence) from memory.

A new isolated aai_cli/streaming/turn_presets.py holds the preset table and a resolve() merge: the preset supplies all three values, and any explicitly-passed raw flag still overrides its own slot. With no preset, behavior is unchanged. --show-code reflects the resolved values for free since both paths read base_flags().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alexkroman alexkroman added this pull request to the merge queue Jun 15, 2026
Merged via the queue into main with commit e22191c Jun 15, 2026
19 checks passed
@alexkroman alexkroman deleted the feat/stream-turn-detection-presets branch June 15, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants