Engineering depth · Healthcare applications

Voice AI Systems

Engineer speech recognition, streaming synthesis, turn-taking, tool execution, context, memory and agent skills as one accountable healthcare workflow.

10 lessons10 decision labsExportable workbook

Recommended: AI Fundamentals, ML Systems and Agent Engineering. Expect timing traces, resource calculations and a written operating decision.

Your decisions save in this browser. Export a workbook to keep a portable copy.

All cases, budgets, latencies and results labeled as exercises are synthetic. Calculators show their assumptions; they do not size or certify a production system. Provider examples were checked October 24, 2026.

01

Speech is a live control loop

Choose the voice architecture

Three architectures, three places to draw the boundary

A voice agent is a system that senses audio, manages a conversation and may invoke external work. One architecture chains speech-to-text, a text-based agent and text-to-speech. Another uses a model that directly accepts and produces speech. A third places a continuous conversational voice interface in front of a separate task agent. These are useful architectural categories, not a ranking from obsolete to advanced. Current provider APIs differ in the events and controls they expose.

A chained system gives you an explicit text boundary between recognition, reasoning and synthesis. That can simplify transcript inspection, model replacement and deterministic text checks. It also creates coordination work: interim recognition can change, the text model may stream unstable clauses, and synthesis may begin before a decision is final. The sum of these stages can create delay unless the pipeline overlaps work carefully.

Native speech does not remove application responsibilities

A speech-to-speech model can preserve aspects of timing, prosody and conversational information that may be flattened by a text transcript. It can reduce the number of separately orchestrated stages. You still need to understand how it represents conversation history, emits tool calls, cancels responses and reports audio progress. A transcript generated alongside audio should not automatically be treated as an exact account of every acoustic cue or of what the caller heard.

A conversational front end with a separate task agent can acknowledge, clarify and manage interruptions while a backend performs longer work. The interface must distinguish a conversational acknowledgment from a completed task. It also needs a contract for delegation, progress, cancellation and result delivery. If both layers independently own the same appointment write, retries and conflicting confirmations become difficult to reason about.

Choose around the consequential boundary

For a fictional rescheduling call, the critical event is an authorized appointment change committed by the scheduling system. The voice layer can gather intent, ask a clarifying question and read a verified result. The backend should own the transaction identity, current record version, authorization checks and receipt. That separation can be implemented with any of the three voice architectures; an architecture label alone does not enforce it.

Map every boundary where information changes form: audio samples to words, words to intent, intent to structured arguments, arguments to a state transition, result to spoken output. At each boundary, identify a possible loss. A date may be misrecognized, a correction may arrive after a tool proposal, an external write may time out, or a confirmation may be generated but never played. These losses are more important than whether a demo sounds polished.

A useful first experiment compares whole systems

Benchmark architecture candidates on the same recorded or consented test scenarios, transport conditions and backend simulator. Include interruptions, corrections, noisy names, ambiguous dates and delayed tools. Measure task correctness, critical-field accuracy, turn behavior, response latency, recovery and cost. Use human listening for qualities that automated metrics do not capture, while evaluating actual state transitions independently of the spoken wording.

Keep the comparison fair. A chained candidate with carefully designed tools should not be compared with a native-speech candidate that lacks the same backend enforcement. Conversely, forcing every native model through an unnecessary transcript-only bottleneck may erase the feature being evaluated. Write down what each candidate is allowed to vary, what is held constant and what failure would disqualify it. Then choose the architecture whose evidence fits the intended operating lane.

ArchitectureUseful inspection boundaryMain coordination burden
STT → text agent → TTSTranscript, tool arguments and spoken textInterim revisions, chunking and accumulated latency
Speech-to-speechProvider events, tools and audio stateUnderstanding cancellation, history and playback semantics
Voice front end + task agentExplicit task delegation and receiptsTwo runtimes, progress, cancellation and result ownership

Decision lab 1: Choose the voice architecture

A synthetic evaluation compares three systems on the same scheduling simulator. Chained: 92% valid completion, 1.5 s median useful-answer latency. Native speech: 94%, 0.9 s. Voice front end plus task agent: 93%, 0.7 s acknowledgment but 1.8 s useful answer. Only the chained version currently enforces appointment-version checks. Each test has 100 calls and no interruption cases.

What should the architecture decision be at this point?

The choice has a reference answer. Your reasoning is saved for self-assessment; it is not automatically graded. At least 60 non-space characters are required only to discourage an empty explanation.

Change one fact

Now all three share the same transaction controls and task outcomes. One has substantially better interruption handling, while another produces more accurate critical-field transcriptions. Specify the workflow segment and listening test that would decide between them.

Listen to this lesson

Marin · 7:28 recorded · AI narration

02

Words, entities and turn boundaries

Measure what the recognizer gets wrong

Recognition is a changing hypothesis

Speech-to-text estimates words from an audio signal. In a live stream, partial results may be revised as more sound arrives. A final result can mean a segment is stable; it does not necessarily mean the caller has finished the conversational turn. An endpoint event, a finalized segment and a complete user intent are separate concepts. Read the provider's event semantics instead of assigning meaning from a field name alone.

For example, a caller says, Move it to Tuesday, then pauses, then adds, not this Tuesday, the following one. A stable transcription of the first clause is still an incomplete instruction. Starting an irreversible action at that point is a workflow error even if every recognized word is correct. You can use partial text to prepare a lookup or update a draft, provided later revisions invalidate dependent work.

Word error rate answers a narrow question

Word error rate is substitutions plus deletions plus insertions, divided by the number of reference words. It requires a defined alignment and normalization policy. Insertions can make the rate exceed one hundred percent. Case folding, punctuation, number formatting and tokenization choices change what the score counts, so comparisons need the same scoring pipeline.

A low aggregate WER can hide a serious entity mistake. Confusing fifteen with fifty, dropping not, or selecting the wrong clinician may affect the task much more than omitting a filler word. Define critical entities for the workflow and score them separately: dates, locations, names, identifiers or other fields that determine an action. Do not claim clinical or operational safety from an overall transcription score.

Normalize without silently changing meaning

Normalization can turn spoken numbers into digits, resolve date phrases or map names to candidate records. Each step introduces assumptions. Next Friday depends on a reference date and local convention; a name may match several people. Preserve the original utterance or source reference where permitted, the normalized value, confidence or ambiguity indicators and the clarification that resolved it.

The application should verify critical fields against the intended record and ask a focused question when ambiguity would change the action. Repeating a misheard value with confidence is not verification. If the caller corrects a date, invalidate the earlier draft and any approval tied to it. A model's ability to infer likely intent is useful for proposing a candidate, not permission to treat a guess as an authoritative fact.

Evaluate the acoustic and conversational conditions

Build a test set that reflects the actual channel: telephone bandwidth, background speech, speaker overlap, accents, names, code-switching, silence and packet loss. Keep results stratified so a strong average does not hide a weak subgroup. Word-level labels alone cannot measure endpoint latency or whether the system repeatedly interrupts a slow speaker. Add turn-boundary and task-outcome metrics, plus listening review.

Voice activity detection estimates whether speech is present. Endpointing tries to decide when an utterance or turn has ended, sometimes using silence and sometimes richer context. A shorter silence threshold can reduce delay while cutting off thought pauses; a longer threshold can improve completion but feel unresponsive. Tune this tradeoff on representative conversations. The right threshold is a measured product choice, not a universal number copied from an example configuration.

WER and critical-entity errors

WER=(S+D+I)/N. The entity measure here counts each annotated entity once as correct or incorrect; it is separate from word-level alignment and does not model task severity.

Decision lab 2: Measure what the recognizer gets wrong

Two synthetic recognizers are evaluated on the same 1,000-word set with 100 critical entities. A has 15 substitutions, 10 deletions and 5 insertions, with 8 entity errors. B has 20 substitutions, 15 deletions and 10 insertions, with 2 entity errors. The downstream task changes appointments, and both systems ask for confirmation only when their own confidence is low.

Which conclusion is supported?

The choice has a reference answer. Your reasoning is saved for self-assessment; it is not automatically graded. At least 60 non-space characters are required only to discourage an empty explanation.

Change one fact

Now B waits an extra second at the end of nearly every turn, while A has better endpoint timing. Propose a pipeline experiment that separates recognition choice from turn policy and measures whether the added delay causes interruptions or abandonment.

Listen to this lesson

Cedar · 6:40 recorded · AI narration

03

Generated, queued and heard are different

Stream speech without changing the promise

Text-to-speech is a production stage

Text-to-speech converts text or another supported conditioning input into speech. It controls pronunciation, rhythm, pauses and voice characteristics within the model's capabilities. Choosing a pleasant voice is only one part of the system. A production pipeline also needs stable content, a supported output format, bounded buffering, cancellation and an account of what the listener actually heard.

Streaming can refer to different interfaces. Some APIs accept incremental text and produce audio as it arrives. Others accept a complete text request but stream the resulting audio bytes. A file-transcription API that streams its output is different again from accepting live microphone input. Be precise about the direction of the stream, when the request can be revised and what constitutes completion.

Chunk at a boundary you can defend

A text model can stream a sentence whose meaning changes near the end. Consider, Your appointment is confirmed, followed later by, only after the office checks availability. If synthesis speaks the first clause immediately, the caller receives a stronger promise than the final text supports. A fast first sound is not worth an unsupported commitment. Hold consequential assertions until their evidence and wording are stable.

You can still overlap safe work. An acknowledgment such as I am checking the available times can begin while a read-only lookup runs, if that statement accurately describes the system. Segment at stable semantic boundaries, retain enough context for natural prosody, and avoid sending every token as a separate synthesis request. Tiny chunks can create discontinuities; very large chunks increase latency and the amount of unheard audio waiting in a buffer.

Pronunciation is part of correctness

Names, dates, abbreviations, confirmation codes and amounts need explicit testing. A transcript can be correct while the spoken rendering is ambiguous. Decide whether an identifier should be read as a number or digit by digit, and preserve leading zeros where they matter. Do not normalize a code into a more natural phrase if the listener must reproduce its exact characters.

Use provider-supported pronunciation controls where available, or prepare unambiguous spoken wording. Test the actual voice and model version, because a spelling trick that helps one system may hurt another. Keep the written transcript aligned with intentional spoken adaptations. Do not describe an automated transcript comparison as a complete human listening review; automatic recognition can repeat or miss the same error as the synthesizer.

Track playback, not just generation

A successful synthesis response means audio was produced. It does not mean all of it reached the transport or was played. Maintain separate progress for generated audio, queued audio and acknowledged playback where the transport supports it. On interruption, discard stale queued output and prevent late chunks from a canceled response from entering the new turn. Response or generation identifiers make that filtering explicit.

For long-form lessons, prioritize complete content, useful chapters, transcripts, stable loudness and portable downloads. For a live voice agent, prioritize turn coordination, low useful-answer latency and correct interruption behavior. The same voice model can serve both tasks, but the pipelines have different acceptance tests. Our narrated season uses Marin and Cedar for a listening format; that selection is not evidence that either voice is best for every real-time healthcare workflow.

  1. 0 ms Text generation begins: a safe acknowledgment is available.
  2. 120 ms The stable acknowledgment is sent to synthesis.
  3. 700 ms Audio begins playing; the scheduling result remains pending.
  4. 1,900 ms Caller interrupts. Cancel the old response and clear unplayed audio.
  5. 2,100 ms A late chunk from the old response arrives. Its response ID must prevent playback.

Decision lab 3: Stream speech without changing the promise

A synthetic response produces four seconds of audio. Only 1.2 seconds have played when the caller interrupts. The spoken prefix is I can check that. The queued remainder says Your appointment is confirmed, but the scheduling tool has not returned a commit receipt. The synthesis API reports success.

Which handling preserves the correct conversation and task state?

The choice has a reference answer. Your reasoning is saved for self-assessment; it is not automatically graded. At least 60 non-space characters are required only to discourage an empty explanation.

Change one fact

Now the appointment did commit before the interruption, but the confirmation was never heard. Explain why the correct recovery is a current-status explanation rather than an automatic retry of the write.

Listen to this lesson

Marin · 6:58 recorded · AI narration

04

Cancellation is a state transition

Reconstruct an interrupted turn

Silence is not the same as completion

A live agent must decide when to listen, when to respond and when to stop. Voice activity detection can identify likely speech, but a pause may be hesitation, a breath or an unfinished thought. Endpointing adds a policy for treating the input as a completed segment or turn. Some systems use semantic signals as well as timing. The useful outcome is not simply the shortest pause threshold; it is fewer interruptions and acceptable response latency for the intended callers.

A barge-in occurs when the caller begins speaking while the agent is speaking. Treat it as an event that changes the active turn. The application may need to cancel model generation, stop synthesis, clear transport buffers, record how much output played and start processing the new input. These operations involve different systems and may complete at different times.

Make response identity explicit

Assign identifiers to input turns, generated responses and tool operations. When a new turn invalidates an old response, mark that response canceled and reject late output associated with it. A socket can still deliver bytes after cancellation because they were already in transit. If the playback queue accepts them without checking identity, the agent can resume an obsolete sentence after the caller has corrected it.

A tool operation needs its own identity because its lifetime may outlast the voice response. Canceling a response does not prove the tool was canceled, and canceling a tool request does not prove an external side effect was rolled back. Record the operation as canceled only when the relevant system establishes that result. Otherwise retain an unknown or pending state and reconcile it before retrying or announcing success.

Keep model history consistent with the conversation

If an agent generated ten seconds but the listener heard two, retaining the full generated message as though it were delivered can distort the next turn. The model may refer to an explanation or question the caller never heard. Use the provider's supported interruption and history controls to align retained output with playback progress.

For example, OpenAI's Realtime documentation distinguishes transports: WebRTC and SIP can use server-managed playback tracking, while a WebSocket client must manage its own output and send the supported truncation information. The specific event names and responsibilities belong to that API version. The general design principle is broader: keep the amount generated, the amount transmitted and the amount heard distinct, and verify the provider contract for the transport you actually use.

Turn state and business state can diverge

Imagine a caller approves Tuesday at the north office, then interrupts with Actually, Thursday at the south office. The new utterance creates a different intended action. It invalidates any draft or approval tied to Tuesday at the north office. If the original write already committed, the system needs a fresh, authorized correction workflow; it cannot pretend the earlier action never happened. If the write is uncertain, first determine its state.

Test these sequences with controlled event ordering: interruption before dispatch, during dispatch, after commit but before receipt, and after receipt but before playback. Add duplicate events, delayed callbacks and a disconnect. A successful happy-path call tells you little about these races. The test should inspect both conversation history and the external ledger, because a natural-sounding recovery can still leave the wrong appointment in place.

  1. R7 / O9 Response R7 and business operation O9 have separate identities.
  2. Barge-in New speech cancels R7 output and invalidates the old proposed payload.
  3. Clear + mark A returned mark may refer to cleared audio; do not infer it was heard.
  4. Timeout O9 remains unknown until a receipt or authoritative reconciliation resolves it.
  5. Late chunk Discard R7 audio even if its network delivery succeeds.

Decision lab 4: Reconstruct an interrupted turn

A synthetic trace shows response R7 queued for playback, operation O9 dispatched with approval for Tuesday/north, then caller interruption requesting Thursday/south. The client clears audio and receives a playback mark for R7. O9 times out without a receipt. A late R7 chunk arrives. The transport returns marks for both played and cleared media.

Which state reconstruction is justified?

The choice has a reference answer. Your reasoning is saved for self-assessment; it is not automatically graded. At least 60 non-space characters are required only to discourage an empty explanation.

Change one fact

Change the trace so O9 has a verified commit receipt before the caller interrupts. Explain the new conversational response and why a correction must be recorded as another action rather than rewriting the historical receipt.

Listen to this lesson

Cedar · 6:46 recorded · AI narration

05

Codecs, buffers and latency distributions

Budget the whole speech path

Audio bytes need a contract

A stream of audio bytes is meaningful only with an agreed encoding, sample rate, channel count and framing. A telephone interface may use eight-kilohertz mu-law audio, while a model endpoint may expect a different PCM format. Renaming a content type does not convert the samples. Resampling and codec conversion must happen at a defined boundary, with tests for duration, speed, clipping and channel handling.

Twilio's Media Streams documentation, for example, specifies base64-encoded mu-law audio at eight kilohertz for outbound media messages. That is a transport-specific contract, not a universal requirement for every voice model. Base64 expands byte representation; it does not improve sound quality. Accidentally treating encoded data as raw PCM can produce noise even when every network request succeeds.

WebRTC, WebSocket and SIP solve different problems

WebRTC provides a real-time media stack with mechanisms for transport, timing and network adaptation. WebSocket provides a bidirectional message channel, leaving more audio framing, buffering and playback work to the application. SIP is used for session signaling in telephony environments; the actual media and provider integration still have their own contracts. Choosing one of these does not automatically select a speech model or a business workflow.

Measure both directions of the path. Input audio can wait in capture buffers, travel over a network, accumulate at a recognizer and wait for an endpoint decision. Output can wait for reasoning, a tool, synthesis, delivery and a playback buffer. A jitter buffer can smooth irregular arrival while adding delay. Too little buffering risks gaps; too much can make interruptions feel sluggish and leave more stale speech queued.

Separate first sound from useful completion

The calculator models one sequential trace. Add endpoint delay, recognition finalization, reasoning to the first stable phrase, synthesis startup, network allowance and playback buffering to estimate the first acknowledgment. If a useful answer requires a tool result first, add that tool time. Real systems may overlap stages, so the critical path is a dependency graph rather than always a simple sum.

Do not add component ninety-fifth percentiles and call the result the end-to-end ninety-fifth percentile. Quantiles depend on the joint distribution and correlations between stages. Record end-to-end traces under load, then inspect where slow calls spend time. The sum of measured durations for one trace is valid when the stages are sequential; the sum of separately measured marginal quantiles is a different statistic.

Backpressure and cancellation belong in the design

A producer can generate audio faster than the consumer plays it. Without bounded queues, latency and memory grow while stale speech accumulates. Apply backpressure, bound pending audio and cancel obsolete generation when the active turn changes. Keep sequence numbers or response identifiers where the protocol supports them, and ensure a reconnection cannot replay old output into a new conversation.

For a healthcare receptionist, test the path with the real channel conditions before setting a service objective. Include slow backend reads, bursty arrivals, packet loss, device changes and interruptions during buffered output. A laboratory model latency is only one component. Your budget should identify the measured values, assumed allowances, overlap opportunities and failure handling. Optimize the largest verified contributor without quietly weakening task correctness or cutting off callers to make the latency chart look better.

One sequential latency trace

This is a synthetic sequential trace. An acknowledgment may precede the tool result. Actual overlap must be measured, and end-to-end percentiles come from full traces rather than sums of component percentiles.

Decision lab 5: Budget the whole speech path

A synthetic sequential trace has endpoint delay 250 ms, recognition finalization 120 ms, reasoning 300 ms, tool work 850 ms, synthesis startup 200 ms, network allowance 80 ms and playback buffer 100 ms. The acknowledgment does not wait for the tool; the useful result must. A dashboard separately reports a P95 for each stage.

What can you calculate from the trace without mislabeling a percentile?

The choice has a reference answer. Your reasoning is saved for self-assessment; it is not automatically graded. At least 60 non-space characters are required only to discourage an empty explanation.

Change one fact

Now recognition and reasoning overlap by 150 ms, but the tool result must still precede the final phrase. Recompute the trace. Then explain what additional measurements are needed before claiming that the same reduction occurs at P95 under load.

Listen to this lesson

Marin · 7:21 recorded · AI narration

06

Compare the operating point

Evaluate models as complete systems

Model names are not a test plan

A speech system may use a recognizer, a text or speech reasoning model, a synthesizer and a turn detector. Some providers combine several of these. Compare capabilities at the interface you need: live input or file input, streaming output, language coverage, timestamps, turn events, tools, interruption controls and version pinning. A model that transcribes a recording well may not expose the events needed for a live agent.

As checked on October 24, 2026, OpenAI documents chained, speech-to-speech and delegated voice architectures; Deepgram documents Flux with integrated turn-taking; Cartesia documents Sonic 3.6 for text-to-speech. These examples illustrate different roles in a stack. Their documentation is evidence of available interfaces, not independent proof that a vendor is the most accurate, fastest or best choice for your callers. Recheck model identifiers and behavior before implementation.

Pin the candidate you actually evaluate

A product family name can point to changing versions. Cartesia's documentation distinguishes a rolling Sonic 3.6 identifier from dated snapshots, for example. Record the exact model or snapshot, voice, configuration, prompt, tool schema and transport used in each evaluation. If a provider updates a rolling alias, repeat the relevant tests before attributing changed behavior to your own code.

Use the same scenario set and backend controls across candidates. Include varied speaking rates, accents, noise, overlap, names, numbers, corrections and disconnected calls. Keep a separate held-out set from the examples used to tune prompts or thresholds. Repeatedly optimizing against one small test set can create a convincing benchmark that does not generalize to new callers.

Score errors and selective coverage together

A system that escalates difficult calls can reduce automated errors while increasing the work sent to humans. Report automated completion, abstention, unsupported completion claims, critical-field errors and reviewer minutes. A single success percentage hides the operating point. Include severity: a small increase in a consequential wrong action can outweigh a large gain in conversational smoothness.

Suppose candidate A completes 88 of 100 tasks automatically with one invalid change, while B completes 76 with zero invalid changes and sends twenty-four to review. That packet does not establish a universal winner. You need the review capacity, error severity, confidence intervals and the exact escalation policy. You may choose different operating lanes, or keep both candidates below a release gate until more evidence is available.

Cost belongs to the completed workflow

Provider billing units differ: audio duration, characters, tokens, cached input, output and connection time may all matter depending on the service. Use current account-specific pricing when estimating a real deployment. For teaching, state hypothetical costs explicitly and include retries, idle time, tool calls, storage and review effort. Dividing model spend by every attempted call can make a system look cheap even when many calls require expensive correction.

Measure cost per valid completed task at an acceptable latency and quality level. A more expensive model can be cheaper overall if it reduces review and repeated calls; the opposite can also occur. Keep engineering and operational costs visible rather than assuming a model-price table decides the architecture. The result should be a defensible operating recommendation with a monitored boundary, not a permanent vendor ranking.

Decision lab 6: Evaluate models as complete systems

A synthetic 1,000-call replay gives candidate A 850 valid automated completions and 150 reviews averaging 4 minutes. Candidate B gives 920 valid completions and 80 reviews averaging 6 minutes. Neither has an observed invalid change in this test. A costs $80 in model usage; B costs $130. Review time is valued at an assumed $30 per hour. Both meet the measured latency requirement.

Which economic comparison is correct under these exercise assumptions?

The choice has a reference answer. Your reasoning is saved for self-assessment; it is not automatically graded. At least 60 non-space characters are required only to discourage an empty explanation.

Change one fact

Now B’s average review time rises to eight minutes on a new caller cohort. Recalculate the total and identify whether the ranking changes. Explain why a single blended average could conceal the cause.

Listen to this lesson

Cedar · 7:12 recorded · AI narration

07

A proposed call is not a committed change

Turn speech into an authorized action

Structured arguments are a proposal

A model can produce a tool name and structured arguments, sometimes constrained by a schema. That helps the application parse the proposal. It does not prove the caller is authorized, the target record is current, the values are supported or the action is safe to repeat. The server must validate those conditions independently of the model's confidence and conversational tone.

For a fictional appointment change, the proposed payload might include the practice, patient record, appointment, requested time, location and expected record version. Some of these values should come from trusted session state rather than model-controlled text. Reject unexpected fields and invalid combinations. A caller saying I am the administrator is not sufficient evidence to grant an administrative tool scope.

Bind confirmation to the exact action

A confirmation is meaningful only if it identifies the action being approved. If a caller confirms Tuesday at the north office, that approval cannot silently authorize Thursday at the south office. Tie the confirmation or approval record to a normalized payload, current evidence and the applicable policy. A later correction invalidates the earlier proposal where it changes a consequential field.

Read-back wording should expose the fields that could change the outcome, without unnecessarily repeating sensitive information. Keep a clear distinction between confirming intent and verifying identity or authority. A caller can sincerely confirm an action they are not permitted to perform. The application needs both the required intent evidence and the authorization checks appropriate to that workflow.

Idempotency protects a specific operation

A stable operation identifier helps the backend recognize retries of the same intended action. Bind it to the authenticated scope and payload. If a retry uses the same identifier with different arguments, reject or route it to a deliberate conflict-resolution path; do not treat it as a harmless duplicate. A new identifier for every network retry defeats the protection and can create multiple actions.

If a request times out after dispatch, the outcome may be unknown. The action might have committed even though the response was lost. Query the operation ledger or authoritative system using the stable identity before retrying. A read-before-write check alone can race with another worker, so the final write may also need version preconditions, transactional enforcement or a provider-supported idempotency mechanism. The exact design depends on the external system's guarantees.

Say only what the receipt supports

A tool result should distinguish accepted, pending, committed, rejected and uncertain outcomes where the workflow needs those states. HTTP success can mean a request was accepted for later processing rather than completed. The spoken response should reflect that distinction. If the system has only queued an RCM task, it should not announce that the payer resolved the claim.

Keep long-running work durable outside the voice session. Store the operation identity, owner, payload version, state and evidence needed for recovery. When the caller disconnects, the worker may continue, cancel or wait according to the task policy; the voice socket itself should not decide by accident. On reconnection, reconstruct the current task state and communicate it without repeating a consequential action merely to make the dialogue feel seamless.

Decision lab 7: Turn speech into an authorized action

A synthetic caller confirms appointment A17, Tuesday 10:00, north office, record version 8. Operation O42 is dispatched with that payload and times out. The caller then requests Thursday 11:00 at the south office. A retry worker proposes sending the new payload with O42 to avoid duplicate work. The scheduling service supports payload-bound idempotency and version preconditions.

Which execution sequence respects those guarantees?

The choice has a reference answer. Your reasoning is saved for self-assessment; it is not automatically graded. At least 60 non-space characters are required only to discourage an empty explanation.

Change one fact

Now the service has no idempotency support and cannot query operations by identifier. Explain what can still be checked, what remains uncertain and why blind automatic retries may need to stop at an escalation boundary.

Listen to this lesson

Marin · 6:47 recorded · AI narration

08

Different stores answer different questions

Persist the work, not just the conversation

Context is the current request budget

A model's context is the material available to a particular inference: instructions, conversation, retrieved evidence, tool messages, audio representations and reserved output, depending on the API. A larger window can hold more, but it is still finite and provider-specific. Audio seconds do not map to one universal token count. Use the provider's actual accounting or measured usage instead of assuming that transcript length captures the entire audio cost.

Prompt caching can change processing cost or latency without making the supplied content free of context limits. Likewise, retaining a session identifier does not establish that every earlier detail remains available forever. Providers may truncate, compact or summarize history. Important business facts should have explicit application persistence rather than depending on an opaque conversation window.

A checkpoint is not a business ledger

A workflow checkpoint records execution state at a point in a run. A conversation transcript records communication. A task ledger records operation states and receipts. A preference store retains approved facts or preferences under a defined scope. A retrieval index helps find source material. These stores can refer to one another, but none automatically replaces all the others.

A checkpointer can resume a workflow after interruption, yet replaying a step that already caused an external side effect can still be unsafe. The task ledger and idempotency mechanism establish whether that effect occurred. Similarly, a transcript saying confirmed is not a receipt from the scheduling system. Persist the external operation identity and authoritative result separately from the model's summary of the conversation.

Memory needs scope, provenance and expiry

A useful memory record names what it asserts, who or what supplied it, the applicable practice or project, the subject, its observation time, expiry or review rule, and its source. A preference such as call after three may be useful across sessions if collected and retained appropriately. It is not an open-ended grant to contact every person or perform unrelated work.

Enforce scope in the storage and retrieval layer. Do not ask the model to avoid cross-practice data while giving it an unfiltered memory search over every tenant. A caller-provided project identifier should not override trusted authorization context. When memory conflicts with a current authoritative record, preserve the conflict and resolve it according to the workflow instead of letting whichever sentence sounds more confident win.

Summarize for continuity, preserve evidence for decisions

A compact session summary can retain goals, unresolved questions and relevant background. It can also omit a negation, approval limit or uncertain operation. Keep decision-critical fields and receipts in structured state, and make the summary point to them. On reconnect, load the minimum scoped information needed, recheck current permissions and freshness, and align the conversation with what was actually heard before disconnect.

The context calculator is a budgeting exercise, not an automatic compression policy. Reducing history may recover tokens but lose an unresolved correction. Removing retrieved evidence may preserve a fluent conversation while weakening its factual basis. Reserve output space deliberately, select relevant evidence and test the summaries on cases where one omitted qualifier changes the action. The goal is recoverable, evidence-based work across sessions, not the largest possible memory dump.

Budget the next request

Synthetic token accounting. The actual API may impose separate modality or output limits; check those too. Prompt caching does not remove content from the context budget.

Decision lab 8: Persist the work, not just the conversation

A synthetic request has a 16,000-token window: 2,000 instruction tokens, 6,000 history tokens, 4,000 retrieved-evidence tokens, 3,000 measured audio tokens and 2,000 reserved output tokens. The conversation summary says appointment confirmed, while operation O42 in the task ledger is unknown. A reconnect arrives under the same authenticated practice.

Which reconstruction handles both resource and state constraints?

The choice has a reference answer. Your reasoning is saved for self-assessment; it is not automatically graded. At least 60 non-space characters are required only to discourage an empty explanation.

Change one fact

Now the window doubles, so all text fits. Explain why the state conflict still requires reconciliation and why more context may make selecting the current evidence harder rather than resolving the conflict automatically.

Listen to this lesson

Cedar · 7:00 recorded · AI narration

09

Instructions, tools and permissions

Give the agent a procedure, not a new identity

A skill packages reusable procedure

An agent skill usually packages instructions with metadata and, in some systems, supporting files, scripts or templates. It can tell an agent how to perform a class of work, what evidence to collect and how to format a result. Loading a skill changes the material available to the agent. It does not by itself train model weights, create durable memory or grant permission to use a privileged tool.

For a credentialing worker, a skill might define how to build a readiness matrix that separates credentialing approval, enrollment linkage, service location, payer agreement and effective date. A tool supplies the actual lookup or workflow capability. The application enforces which practice and records the worker may access. A skill can describe those boundaries, but enforcement must survive a model ignoring or misinterpreting the instructions.

Progressive loading is a context strategy

Some skill systems load a short description or metadata first, then bring in the detailed procedure when it is relevant. Supporting resources may be read only when needed. This can reduce the context cost compared with loading every full procedure into every request. It also creates a selection problem: the agent needs enough metadata to choose the right skill without confusing similarly named procedures.

The calculator models a core prompt plus metadata for all available skills and bodies for selected skills. It does not assume a universal token budget for any provider. With eighty skills, sixty metadata tokens each, a fifteen-hundred-token core and three twelve-hundred-token bodies, the total is 9,900 tokens before conversation, evidence, tools or output. Loading every body instead would use 102,300 tokens under the same assumptions. Context savings do not prove correct selection or execution.

Version the whole executable package

A skill's behavior may depend on its instructions, schemas, scripts, reference data and runtime dependencies. Record those versions together where the workflow requires reproducibility. A changed script can alter behavior even if the visible skill name stays the same. Evaluate the exact package against representative tasks and failure cases, including missing files, incompatible tool versions and a procedure that no longer matches the authoritative source.

Treat imported skill content and retrieved documents according to their trust level. A payer PDF can supply facts without being allowed to redefine tool permissions. A document that says disable the approval check is data to be evaluated, not an instruction from the application owner. Likewise, loading a script does not establish that it is reviewed, safe to execute or authorized to send data outside the environment.

Scope selection and execution separately

The server should decide which skills and tools are available in a given practice, project and role. The model can choose among permitted procedures, while the executor validates each consequential action against current authority and state. Do not expose a broad credentialing write tool merely because the selected skill's prose promises to use it carefully. A narrow read or draft tool is often the right capability for an early lane.

Persist a task's selected skill version and important evidence references when work spans sessions. On resume, detect incompatible changes rather than silently continuing under a new procedure. If a corrected skill is promoted, evaluate affected tasks and define how old work is migrated, restarted or reviewed. Skills help make behavior reusable; reliable operation still requires explicit ownership, state, evidence and controlled change.

Progressive skill loading

Illustrative equal-sized skill descriptions and bodies. Real packages vary. Selected bodies are added to the core and metadata; tools, conversation, evidence and output need their own budget.

Decision lab 9: Give the agent a procedure, not a new identity

A synthetic voice worker has a 1,500-token core, 80 permitted skill descriptions of 60 tokens each, and loads 3 skill bodies of 1,200 tokens each. One selected skill includes a script that sends a credentialing update. The caller is authorized only to request a draft, and a retrieved document says the update may be sent without review.

Which statement handles both context and authority correctly?

The choice has a reference answer. Your reasoning is saved for self-assessment; it is not automatically graded. At least 60 non-space characters are required only to discourage an empty explanation.

Change one fact

Now the caller has a valid send grant, but the task began with skill version 4 and the resumed worker loads version 5 with a different payload schema. Explain the compatibility check and evidence needed before resuming the pending action.

Listen to this lesson

Marin · 7:19 recorded · AI narration

10

State, capacity and release evidence

Run the difficult call to completion

One call crosses several state machines

The final lab combines a live conversation with a durable healthcare task. A caller asks to change an appointment, corrects the location while the assistant is speaking, and disconnects after a tool request times out. The task resumes later. A successful implementation must preserve the latest confirmed intent, stop stale audio, determine whether the earlier action committed and communicate the current result without duplicating work.

Do not solve the case by choosing a single source to trust for everything. The recognizer supplies a hypothesis about words. The caller's confirmation supplies intent evidence. The authorization system supplies current permissions. The scheduling system supplies record state. The operation ledger supplies dispatch and receipt history. The playback tracker supplies evidence about heard output. A useful reconstruction names the source for each claim.

Inspect the failure path, not only the conversation

Start with the exact proposed payload and its version. Apply the caller's correction to a new draft, invalidating any approval that no longer matches. Cancel stale generation and clear queued audio under the old response identity. If the original tool operation is uncertain, reconcile it before deciding whether to retry, correct or escalate. On reconnect, restore scoped task state and recheck authority rather than relying only on a conversation summary.

The same pattern applies to other healthcare operations. A voice worker checking RCM status should distinguish a payer response from a model's paraphrase and a queued follow-up from a resolved claim. A credentialing conversation should preserve separate approval, linkage, agreement and effective-date evidence where relevant. The voice interface can make the work easier to access without changing what proves that the work is complete.

Review capacity is a system constraint

Escalation is not free. A pilot can produce few automated errors by sending every uncertain call to a human, then overwhelm the review queue. Estimate arrival volume, escalation fraction, review time and productive reviewer capacity. Include bursts and variation rather than treating an average as a guarantee. Track queue age and unresolved work alongside completion rates.

For example, one thousand calls a day with a twenty-percent review rate and six minutes per review requires twelve hundred review minutes, or twenty hours. Two reviewers with six productive hours each provide twelve hours. The queue grows by eight hours of work per day under those averages. A nominal capacity limit is six hundred calls, but operating exactly at that mean leaves no allowance for bursts, absence or harder cases. A staged pilot should reserve headroom and monitor the actual distribution.

Release a bounded lane with explicit evidence

Define the eligible call type, allowed reads and writes, identity checks, confirmation policy, escalation owner and stop conditions. Separate automated replay, human listening, supervised pilot and broader operation. A passing simulated call is evidence about that test, not proof of clinical readiness, regulatory compliance or reliable behavior under every carrier and caller condition.

Zero observed severe errors in a small test is also limited evidence. Under a simple independent-trial approximation, the rule of three gives an approximate upper 95% bound of three divided by the number of trials when no events are observed. Zero in two hundred is therefore compatible with a rate around 1.5% under that approximation. Real calls may be correlated and the test distribution may be incomplete, so the calculation cannot replace judgment about severity and coverage. State uncertainty, gather more evidence and keep the release boundary proportionate to what has actually been tested.

Failure injectionRequired observationUnacceptable shortcut
Caller changes a confirmed fieldOld proposal invalidated; new payload checkedReuse the old approval
Timeout after possible commitStable operation reconciledRetry with a new identity
Barge-in before playback completesOld response cleared; unheard output distinguishedTreat generation as delivery
Reconnect in another practiceScope independently revalidatedLoad memory by caller-provided thread ID
Review queue exceeds capacityAdmission or escalation policy respondsHide unresolved cases in a completion average

Decision lab 10: Run the difficult call to completion

A synthetic pilot expects 1,000 calls/day, 20% escalation and 6 minutes per review. Two reviewers each have 6 productive hours/day. A 200-call replay found no severe errors, but did not include timeout-after-commit or interruption-before-playback cases. The proposed release enables all appointment writes immediately.

Which operating recommendation follows from the packet?

The choice has a reference answer. Your reasoning is saved for self-assessment; it is not automatically graded. At least 60 non-space characters are required only to discourage an empty explanation.

Change one fact

Now review capacity doubles, but the timeout-after-commit test creates duplicate appointments. Explain why additional staffing does not resolve the release blocker and what evidence would establish the recovery fix.

Listen to this lesson

Cedar · 7:12 recorded · AI narration

Write the voice system operating memo

Use the interrupted appointment-change trace and the final capacity packet. Defend a bounded operating lane, including architecture, event ordering, durable state and a measurable release decision.

Complete every decision lab and write at least 80 non-space characters per memo field before saving a complete workbook. This checks completeness, not correctness or operational readiness.