Asks a decision model about each turn, and attaches the answers to the turn: who the speaker is talking to, and whether an assistant could usefully answer. The agent's gate uses them to decide whether to reply.
Each turn goes to a decision model (ReqLLM.evaluate/4), which answers
calibrated questions in one call. The turn (Transcription or
UserAudio) goes on with decision set to
%{addressee: "assistant" | "person" | "group" | "nobody",
confidence: 0.81, probabilities: %{...}, answerable: 0.95,
answers: %{...}, latency_ms: 430, audio_ms: 2100, questions_id: nil}where answers are the model's raw answers by question (custom
questions included), and the other fields read the "addressee" and
"answerable" questions when they're asked; audio_ms is only there
when the audio was judged.
or nil when the call failed or was too slow.
:input picks what the model judges:
:audio- the turn's audio, which carries tone and pauses. Only Gemini Decisions (google:gemini-decision-1) takes audio.:transcript- the turn's final transcript, for text-only decision models such as"openrouter:cloudflare/clef-flash"(Cloudflare's Clef Flash). The call can't start until the transcript is final, so it adds its whole latency to the turn. Half-cascaded turns have no transcript and go on without a decision.
It defaults to :audio for google: models and :transcript for any
other.
With :audio, place it in a front end after the turn stage. Behind an
STT turn stage it
records each turn from VADUserStartedSpeaking (with preroll_ms before
it) and starts the call at the VAD's stop, so it runs while the STT
finalizes; the transcript is held for at most max_wait_ms for the
answers. A pause that turns out not to be the end of the turn cancels the
call, and the turn is evaluated again when it ends. Behind AudioTurns
(half-cascaded), the turn's own UserAudio is evaluated when it arrives.
Options: :model (needed, such as "google:gemini-decision-1"), :input (see
above), :api_key (default ReqLLM's key for the model's provider, such
as GOOGLE_API_KEY or OPENROUTER_API_KEY), :request_options,
:questions (see default_questions/0), :max_wait_ms (1500),
:preroll_ms (1000), :max_audio_ms (30000), :min_audio_ms (300), and
:evaluate, a fn wav_or_text -> {:ok, answers} | {:error, reason} end
that replaces the API call (for tests). Under a host, it warms the
connection with one call when it starts (on half a second of silence, or
a short line of text).
Changing the questions
An Octoroom.Agent.Frames.UpdateStage naming this stage can change
:questions while it runs, so each part of a conversation asks only what
it needs. Pass :questions_id with them (any term, such as the name of
the part of the conversation they're for): every decision carries the
questions_id of the questions it answered, so whoever reads it can tell
answers to old questions, from a turn that was being judged when they
changed. :questions_id is also an option here, nil by default.
With no questions (%{}), nothing is asked: turns go on at once, with
decision: nil.
Summary
Functions
The questions asked by default (addressee and answerable).