Expand description
SessionSpec — a whole Live session as one serializable JSON document.
Where Flow made the governance DAG data, SessionSpec makes the
application data: session framing (instruction, greeting, modality),
declarative tool bindings (mock, HTTP, MCP), schema-as-JSON extraction that
fills the state guards read, data-driven phases and watchers over the same
closed Guard vocabulary, reusable flow fragments, and an embedded test
suite that replays scripted conversations through the real
FlowMonitor offline.
The invariants:
- What serializes, runs.
SessionSpec::applyconfigures aLivebuilder from the document; nothing in the document needs Rust. - What can fail, fails at load time.
SessionSpec::validateruns the flow compiler, cross-checks tool names, and diffs the state keys guards read against the keys the session writes — the flow-level analogue ofcompile_with_toolsfor the dominant silent failure in data-authored flows (a guard waiting on a key nothing sets). - The escape hatches stay in code. Custom closures (guards, tools,
callbacks) are added on the returned builder after
apply, exactly as before; the spec never pretends to serialize them.
Structs§
- Audio
Spec - Input-audio hardening: the measured mic chain (denoiser, noise gate),
client input-VAD tuning, and interruption authority. Lowers to
Live::mic_denoise/mic_noise_gate/input_vad/client_interruption_authority; see the hardening chapter for the benchmark behind each default. - Client
VadSpec - Client input-VAD tuning: start from a preset, override individual knobs.
- Computed
Spec - A computed (derived) state variable authored as data:
keyis written toderived:{key}whenever theExprevaluates to a value. Dependencies are inferred from the expression’sExpr::keys_read, so the runtime’s dependency-orderedComputedRegistryinvariants hold with nothing extra to declare. Guards read the result by its bare key (thederived:fallback). - Extract
Spec - Schema-as-JSON out-of-band extraction: an OOB model fills
schemafrom the transcript, the result lands in state undername, andpromoterules write individual fields to bare keys — closing the loop that lets a flow advance from speech alone (capturedguards latch with no tool call). - Http
Binding - An HTTP binding for a declared tool: the call is executed as an HTTP
request with
{args.field}/{state.key}interpolation in the URL, headers, and body strings, and the JSON response is returned to the model. - Memory
Slot Spec - Project one remembered fact into a governed state slot: when memory holds
a value for
predicate, it is written to thetostate key — whereneeds,captured, and every other guard reads it exactly as if the caller had just said it. - Memory
Spec - The session’s durable-memory declaration. Installing it wires the memory
subsystem in through a
MemoryBindingsupplied inSpecResources: therecall_context/manage_memorytools (ambient, so stepallowlists don’t switch recall off), turn ingestion, end-of-session reconciliation, and the slot projections below.EffectSpec::Rememberwrites through the same binding. - Noise
Gate Spec - Noise-gate stage parameters.
- Pattern
Spec - A data-driven temporal pattern: fire effects when a state condition holds
continuously — for a duration (
sustained_secs) or a number of consecutive turns (turns). Exactly one of the two must be set. - Phase
Spec - A data-driven conversation phase.
- Promote
Spec - Promote one extracted field into a session state key, where flow guards
(
captured,is_true, …) read it. - Repair
Spec - Conversation-repair thresholds (unmet phase
needs). - Runtime
Spec - Control-plane and voice tuning — every session capability that is
configuration rather than conversation, in one section. Everything here
lowers to a
Livebuilder setter; omitted fields keep the builder’s defaults. - Session
Spec - A complete Live session as one JSON document. See the module docs.
- SimSnapshot
- One per-event snapshot of the flow’s state during a scripted replay — the Studio’s Preview scrubber steps through these, lighting up the DAG exactly as a live session would, with no model and no API key.
- Spec
Resources - External resources a spec cannot carry: model handles and capability bindings.
- Spec
Test - A named, scripted conformance test embedded in the spec.
- Spec
Validation - Structured result of validating a
SessionSpec. - State
Field Spec - One declared state key: its type, meaning, and optional starting value.
- Test
Expectation - Assertions at a checkpoint. Every listed item must hold; omitted fields are not checked.
- Test
Report - The outcome of one
SpecTest. - Test
Step Result - The outcome of one scripted event.
- Tool
Spec - A declared tool. Without an
httpbinding it is a mock: it returnsresponse(default{"ok": true}) and writesset_state— enough to model, validate, and demo a governed conversation before any real tool exists. Withhttpit performs the request instead (and still appliesset_stateafterwards, so guards latch identically) — swap a mock for a binding without touching the flow. - Transcription
Spec - Input/output transcription toggles.
- Transition
Spec - A data-driven phase transition: fire
whenthe guard holds over state. - UseFragment
- Splice a named flow fragment into the session’s flow under a namespace.
- VadSpec
- Voice-activity-detection tuning — the knobs that decide how eagerly the session hears speech start and stop.
- Watch
Spec - A data-driven state watcher: when
keysatisfies the condition, run the effects. Watchers receive the live session writer, so the fullEffectSpecvocabulary applies — a watcher can set state, inject context, prompt the model, or remember durably.
Enums§
- Authority
Spec - Interruption authority (measured trade: client is ~2× faster to barge in; server posted zero false interruptions in every benchmark run).
- Client
VadPreset - Named client-VAD starting points.
- Context
Delivery Spec - When batched context turns hit the wire.
- Effect
Spec - A serializable side effect for phase entry, watcher, and pattern actions —
the closed-effect counterpart to
Guard’s closed predicates. One vocabulary, honored identically wherever effects fire. - Persistence
Spec - Session persistence backend.
- Promote
Policy - How extracted fields are promoted into bare state keys.
- Scheduling
Spec - Delivery mode for a background tool’s response.
- Sensitivity
Spec - Speech-detection sensitivity for
VadSpec. - SimEvent
- One scripted event in a
SpecTest. - Spec
Modality - Output modality for a spec-driven session.
- State
Type - Declared JSON type of a state key.
- Steering
Spec - How phase instructions are steered to the model.
- Trigger
Spec - When an extractor runs.
- Watch
Condition - A data-driven state watcher condition.
Constants§
- MEMORY_
TOOL_ NAMES - Tool names a
MemoryBindinginstalls (ambient on the flow).
Traits§
- Memory
Binding - The seam through which a memory engine plugs into a spec-driven session.
Functions§
- trace_
test - Replay one named test and return a snapshot after every event (plus an initial “start” snapshot), for scrubbing. Errors when the flow cannot be built or the test name is unknown.