Understanding the Flux State Machine
Emitted events adhere to the below state machine for managing turns:
Updatemessages are sent for approximately every 0.25 seconds of transcribed audio, regardless of transcript updates, unless a state change has occurred.- An
EagerEndOfTurnmessage always contains a nonempty transcript. - A
TurnResumedmessage can only follow a precedingEagerEndOfTurnmessage. - The
EndOfTurntranscript will always match the immediately precedingEagerEndOfTurntranscript. If the transcript changes after anEagerEndOfTurn, aTurnResumedevent will occur first. - The
turn_indexincrements immediately following anEndOfTurnmessage. - When using
flux-general-multi, allTurnInfoevents includelanguages(detected languages sorted by word count) andlanguages_hinted(active language hints). See Language Prompting. - Every
EndOfTurnevent includes atriggerfield —model(native detection),manual(ForceEndTurn), ortimeout(eot_timeout_ms) — indicating what ended the turn. - You can end the current turn at any time by sending a
ForceEndTurnmessage. Flux emits anEndOfTurnwithtrigger: "manual"from any in-turn state.
Turn Lifecycle Example
Section titled “Turn Lifecycle Example”Here’s how Flux processes a customer calling support saying “Hi I need to cancel my subscription please.”
Notice how confidence builds up and how the EagerEndOfTurn event fires before the final EndOfTurn. With EagerEndOfTurn, your voice agent can begin preparing a response before the user has fully finished speaking. This allows you to send a synchronous request with early context, creating the effect of a faster, more natural reply.
{
"event": "Update",
"turn_index": 0,
"audio_window_start": 0.0,
"audio_window_end": 0.2,
"transcript": "",
"words": [],
"end_of_turn_confidence": 0.1
}
{
"event": "Update",
"turn_index": 0,
"audio_window_start": 0.0,
"audio_window_end": 0.5,
"transcript": "",
"words": [],
"end_of_turn_confidence": 0.1
}
{
"event": "StartOfTurn",
"turn_index": 0,
"audio_window_start": 0.0,
"audio_window_end": 0.6,
"transcript": "Hi I",
"words": [
{
"word": "Hi",
"confidence": 0.95,
"start": 0.42,
"end": 0.56
},
{
"word": "I",
"confidence": 0.92,
"start": 0.56,
"end": 0.6
}
],
"end_of_turn_confidence": 0.1
}
{
"event": "Update",
"turn_index": 0,
"audio_window_start": 0.0,
"audio_window_end": 0.8,
"transcript": "Hi I need to",
"words": [...],
"end_of_turn_confidence": 0.1
}
{
"event": "Update",
"turn_index": 0,
"audio_window_start": 0.0,
"audio_window_end": 1.0,
"transcript": "Hi I need to cancel my subscription.",
"words": [...],
"end_of_turn_confidence": 0.3
}
{
"event": "EagerEndOfTurn",
"turn_index": 0,
"audio_window_start": 0.0,
"audio_window_end": 1.1,
"transcript": "Hi I need to cancel my subscription.",
"words": [...],
"end_of_turn_confidence": 0.3
}
{
"event": "TurnResumed",
"turn_index": 0,
"audio_window_start": 0.0,
"audio_window_end": 1.2,
"transcript": "Hi I need to cancel my subscription please",
"words": [...],
"end_of_turn_confidence": 0.1
}
{
"event": "Update",
"turn_index": 0,
"audio_window_start": 0.0,
"audio_window_end": 1.4,
"transcript": "Hi I need to cancel my subscription please.",
"words": [...],
"end_of_turn_confidence": 0.3
}
{
"event": "EagerEndOfTurn",
"turn_index": 0,
"audio_window_start": 0.0,
"audio_window_end": 1.5,
"transcript": "Hi I need to cancel my subscription please.",
"words": [...],
"end_of_turn_confidence": 0.3
}
{
"event": "Update",
"turn_index": 0,
"audio_window_start": 0.1,
"audio_window_end": 1.6,
"transcript": "Hi I need to cancel my subscription please.",
"words": [...],
"end_of_turn_confidence": 0.5
}
{
"event": "EndOfTurn",
"turn_index": 0,
"audio_window_start": 0.0,
"audio_window_end": 1.7,
"transcript": "Hi I need to cancel my subscription please.",
"words": [...],
"end_of_turn_confidence": 0.7,
"trigger": "model"
}