> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenetlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Voice guardrails

> Judge a voice-agent turn in real time — transcript rails plus transcript-independent acoustic detectors, streamed over SSE with the verdict ahead of the audio layer.

> [!NOTE]
>
> Voice is a **research preview**, live on `judge.tenetlabs.com`. The request and event shapes may change before general availability.

**Voice guardrails**: `POST /voice/decide/stream` → SSE events for one voice-agent turn, with the transcript verdict sent before the audio detectors run. The transcript is judged by the same `injection` + `pii` rails that judge text; the audio is judged **directly** by transcript-independent acoustic detectors. The two fuse most-restrictive-wins, so an alarming sound on the call can gate a benign transcript.

## When to use it

Use it to guard a voice-AI agent — a LangChain voice agent whose turns you want judged before the agent acts or speaks. The endpoint is real-time SSE only (there is no sync voice endpoint): the transcript rails are the fast layer, so their fused `verdict` reaches the wire before the audio detectors run, and a barge-in / terminate decision can act at that point without waiting for the audio layers to resolve.

For text agents, use [`/decide`](https://docs.tenetlabs.com/api-reference/introduction) or [verdict-first streaming](https://docs.tenetlabs.com/guides/streaming.md) — the voice endpoint adds transcript ingestion and the acoustic layer on top of the same verdict machinery.

## Request

Send one span. Provide the turn's text with the `transcript` shorthand, or a full `voice_context` when you also carry audio signal:

```bash theme={null}
curl -N https://judge.tenetlabs.com/voice/decide/stream \
  -H "Authorization: Bearer $TENET_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "transcript": "sure, i can share the applicant list — what did you need?",
    "span_id": "span-8841",
    "trace_id": "call-8841",
    "session_id": "call-8841"
  }'
```

| Field | Type | Notes |
| - | - | - |
| `transcript` | `string` | Shorthand for `voice_context.transcript`. Ignored when `voice_context` is also present. |
| `voice_context` | `object` | Full turn envelope — see below. Wins over `transcript` when both are sent. |
| `span_id` | `string` | Caller-correlatable id for this turn. Defaults to a fresh canonical id. |
| `trace_id` | `string` | Groups spans in one call/trace. Defaults to `span_id`. |
| `session_id` | `string` | Stable per conversation. |
| `category_hint` | `string` | Optional caller hint. |

### `voice_context`

```json theme={null}
{
  "transcript": "...",
  "asr_confidence": 0.9,
  "audio_ref": "s3://calls/8841.wav",
  "audio_events": ["scream"],
  "acoustic_events": [
    {"label": "scream", "score": 0.94, "start_s": 12.1, "end_s": 13.0}
  ]
}
```

* **`transcript`** — the text the `injection` + `pii` rails scan. When it is empty and only `audio_ref` is present, the audio is transcribed first; with neither, the rails have nothing to scan.
* **`asr_confidence`** — `[0.0, 1.0]`, higher is more confident. `null` means unknown. Governs the ASR-confidence downgrade (below).
* **`audio_ref`** — reference to the raw audio artifact (an `s3://` URI or a media id); carried through, never inlined as bytes.
* **`audio_events`** — bare provider event-tag strings (e.g. `"scream"`, `"(laughter)"`). Trusted as fired — a provider that emits the tag already decided it.
* **`acoustic_events`** — structured, scored acoustic events: `label`, optional `score` (`[0,1]`), optional `start_s` / `end_s`. Transcript-independent — ASR never sees these.

Your STT provider may already emit acoustic event tags; pass them through on `audio_events` or `acoustic_events` and the acoustic gate consumes them.

## Event order

Events arrive in a locked sequence — the `verdict` fires as soon as the transcript rails resolve, before the audio detectors run:

```text theme={null}
request_accepted → transcript_ready → [pii_findings] → [safety_findings]
  → verdict[provisional while audio can still revise it] → [acoustic_findings]
  → [verdict_revised] → done
```

| Event | Payload | Notes |
| - | - | - |
| `request_accepted` | `canonical_id`, `span_id`, `trace_id` | Correlation ids — log them. |
| `transcript_ready` | `source`, `asr_confidence`, `asr_confidence_verifiable`, `transcript_chars` | `source` is `passthrough` (you supplied the text), `stt` (we transcribed `audio_ref`), or `none` (empty turn). |
| `pii_findings` | `findings: [...]` | Emitted when the `pii` rail detects PII in the transcript. |
| `safety_findings` | `findings: [...]` | Transcript safety rails (`injection`, `exfil`) when they fire. |
| `verdict` | `verdict`, `severity`, optional `provisional` | The fused decision over the transcript rails. `provisional: true` while an acoustic finding could still revise it. |
| `acoustic_findings` | `findings: [...]` | Transcript-independent audio findings — see below. |
| `verdict_revised` | `verdict`, `severity` | Emitted only when an audio finding changed the fused verdict after the provisional one. |
| `error` | `retryable`, `detail` | Fail-closed. `retryable: false` → the terminal sequence follows. |
| `done` | `canonical_id`, `verdict_final`, `latency_ms`, `envelope` | Stream complete. `verdict_final` is authoritative; `envelope` is the full span judgment (`span_id`, `trace_id`, `verdict`, `findings`, `summary_severity`, `latency_ms`). |

Treat any unrecognized event type as opaque and keep reading to `done`.

## Acoustic guardrails

The acoustic layer judges the audio directly — no ASR, no transcript — so it catches signal a transcript can't: a scream, an alarm, breaking glass. The default detector is a deterministic **event gate**: it reads the `acoustic_events` / `audio_events` on the turn and escalates a clear alarming non-speech event to an enforcing `route_to_human` — a "get a human on this call now" signal, never a content block.

```text theme={null}
event: acoustic_findings
data: {"findings": [{"domain": "acoustic", "sub_domain": "audio_event",
  "verdict": "route_to_human", "severity": "critical", "enforcement": "enforce",
  "rule_ids": ["ACOUSTIC-EVENT-01"], "risk_labels": [], "evidence_span": null,
  "metadata": {"event": "scream", "score": 0.94}}]}
```

An acoustic finding uses the same shape as any other finding: `domain` is `acoustic`, `sub_domain` is `audio_event`, and `metadata` carries the matched `event`, its `score`, and timing. The gate escalates on clear events (scream, gunshot, alarm, glass-break, sustained crying) above its score threshold; a scoreless provider tag is trusted as fired. Unknown or low-confidence labels produce nothing — the gate never fires on a signal it can't stand behind.

Because acoustic findings are enforcing, the gate fuses with the transcript verdict most-restrictive-wins: a scream in the audio raises a benign transcript to `route_to_human` via `verdict_revised`, and a transcript block stands regardless of the audio.

> [!NOTE]
>
> Acoustic findings are **not** subject to the ASR-confidence downgrade below — they never depended on a transcript.

## ASR-confidence downgrade

The judge never hard-blocks on a transcript it can't stand behind. When an enforcing transcript rail would `exclude` / `block` but the transcript is untrustworthy, the verdict downgrades to `route_to_human` — a mis-transcribed word becomes a human review, never a silent block. A transcript is untrustworthy when either:

* `asr_confidence` is present and below the floor (`low_confidence`), or
* `source` is `passthrough` with no verifiable confidence (`unverified_transcript`).

`transcript_ready.asr_confidence_verifiable` tells you which case you're in before any rail is enforcing. A measured `asr_confidence` is always honored on its number regardless of provenance.

> [!WARNING]
>
> Transcript findings (`pii`, `safety`) report as `audit_only` on this endpoint today: they appear in the stream but don't gate the verdict. Acoustic findings enforce. Read `done.envelope.findings` for the full per-domain record.

## Links

* [Verdict-first streaming](https://docs.tenetlabs.com/guides/streaming.md) — the text endpoint, which sends `verdict` before its findings
* [Multi-verdict responses](https://docs.tenetlabs.com/concepts/multi-verdict.md) — finding shape and the merge rule
* [How the Judge decides](https://docs.tenetlabs.com/concepts/decisions.md) — verdict vocabulary and fail-closed posture
* [API overview](https://docs.tenetlabs.com/api-reference/introduction.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.