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

# Recording & Audio

> Python API reference for Recording & Audio.

Capture and play audio during a session: recording configuration and storage,
transcript output, and background-audio playback.

## RecordingConfig

Configuration for capturing and storing session recordings.

### Fields

<ParamField path="enabled" type="bool" default="False">
  Whether recording is enabled.
</ParamField>

<ParamField path="auto_start" type="bool" default="True">
  Whether recording starts automatically with the session.
</ParamField>

<ParamField path="format" type="Literal['wav', 'ogg_opus', 'mp3', 'flac']" default="ogg_opus">
  Audio format for the recording, one of `'wav'`, `'ogg_opus'`, `'mp3'` or `'flac'`.
</ParamField>

<ParamField path="channel_mode" type="Literal['mixed', 'dual_channel']" default="dual_channel">
  Channel layout, either `'mixed'` or `'dual_channel'`.
</ParamField>

<ParamField path="sample_rate" type="int" default="0">
  Sample rate in Hz; `0` uses the default.
</ParamField>

<ParamField path="bitrate_kbps" type="int" default="0">
  Audio bitrate in kbps; `0` uses the default.
</ParamField>

<ParamField path="storage" type="S3StorageConfig | None">
  Storage destination configuration, or `None` for the default.
</ParamField>

<ParamField path="transcript" type="RecordingTranscriptConfig | None">
  Transcript generation configuration, or `None` to disable.
</ParamField>

<ParamField path="max_duration_seconds" type="int" default="0">
  Maximum recording duration in seconds; `0` is unlimited.
</ParamField>

<ParamField path="max_file_size_mb" type="int" default="0">
  Maximum recording file size in megabytes; `0` is unlimited.
</ParamField>

<ParamField path="recording_beep" type="bool" default="False">
  Whether to play a beep indicating recording is active.
</ParamField>

<ParamField path="redact_dtmf" type="bool" default="False">
  Whether to redact DTMF tones from the recording.
</ParamField>

<ParamField path="custom_metadata" type="Dict[str, str]" default="…">
  Custom metadata to associate with the recording.
</ParamField>

<ParamField path="recording_name" type="str" default="">
  Name assigned to the recording.
</ParamField>

<ParamField path="recording_group" type="str" default="">
  Group identifier the recording belongs to.
</ParamField>

<ParamField path="apply_denoise" type="bool" default="False">
  Whether to apply denoising to the recorded audio.
</ParamField>

<ParamField path="normalize_audio" type="bool" default="False">
  Whether to normalize the audio levels.
</ParamField>

<ParamField path="trim_silence" type="bool" default="False">
  Whether to trim silent segments from the recording.
</ParamField>

<ParamField path="record_video" type="bool" default="False">
  Whether to record video.
</ParamField>

<ParamField path="record_screen_share" type="bool" default="False">
  Whether to record shared screens.
</ParamField>

<ParamField path="record_screen_audio" type="bool" default="False">
  Whether to record screen-share audio.
</ParamField>

***

## S3StorageConfig

Configuration for uploading recordings to S3-compatible object storage.

### Fields

<ParamField path="bucket" type="str" default="">
  Target bucket name.
</ParamField>

<ParamField path="region" type="str" default="">
  Region of the bucket.
</ParamField>

<ParamField path="prefix" type="str" default="">
  Key prefix prepended to uploaded objects.
</ParamField>

<ParamField path="access_key_id" type="str" default="">
  Access key identifier for authentication.
</ParamField>

<ParamField path="secret_access_key" type="str" default="">
  Secret access key for authentication.
</ParamField>

<ParamField path="session_token" type="str" default="">
  Optional session token for temporary credentials.
</ParamField>

<ParamField path="endpoint_url" type="str" default="">
  Custom endpoint URL for S3-compatible providers.
</ParamField>

<ParamField path="storage_class" type="str" default="">
  Storage class to apply to uploaded objects.
</ParamField>

<ParamField path="server_side_encryption" type="str" default="">
  Server-side encryption algorithm to use.
</ParamField>

<ParamField path="kms_key_id" type="str" default="">
  KMS key identifier used when encryption requires one.
</ParamField>

<ParamField path="acl" type="str" default="">
  Canned access control list to apply to uploaded objects.
</ParamField>

<ParamField path="multipart_upload" type="bool" default="True">
  Whether to use multipart uploads.
</ParamField>

<ParamField path="multipart_part_size_mb" type="int" default="8">
  Part size, in megabytes, for multipart uploads.
</ParamField>

<ParamField path="upload_timeout_seconds" type="int" default="0">
  Upload timeout in seconds; `0` uses the default.
</ParamField>

<ParamField path="max_retry_attempts" type="int" default="3">
  Maximum number of upload retry attempts.
</ParamField>

<ParamField path="tags" type="Dict[str, str]" default="…">
  Object tags to attach to uploaded files.
</ParamField>

<ParamField path="user_metadata" type="Dict[str, str]" default="…">
  Custom user metadata to attach to uploaded objects.
</ParamField>

<ParamField path="content_type_override" type="str" default="">
  Explicit content type to set instead of the inferred one.
</ParamField>

***

## RecordingTranscriptConfig

Configuration for generating transcripts alongside a recording.

### Fields

<ParamField path="enabled" type="bool" default="False">
  Whether transcript generation is enabled.
</ParamField>

<ParamField path="format" type="Literal['json', 'srt', 'vtt']" default="json">
  Transcript output format, one of `'json'`, `'srt'` or `'vtt'`.
</ParamField>

<ParamField path="include_word_timestamps" type="bool" default="False">
  Whether to include per-word timestamps.
</ParamField>

<ParamField path="include_confidence" type="bool" default="False">
  Whether to include confidence scores.
</ParamField>

<ParamField path="speaker_labels" type="bool" default="True">
  Whether to label speakers in the transcript.
</ParamField>

<ParamField path="language" type="str" default="">
  Language hint for transcription; empty to auto-detect.
</ParamField>

***

## RecordingFormat

Audio container and codec formats available for recordings.

```python theme={null}
class RecordingFormat(Enum):
    WAV = 'wav'
    OGG_OPUS = 'ogg_opus'
    MP3 = 'mp3'
    FLAC = 'flac'
```

***

## RecordingChannelMode

Channel layouts for recorded audio.

```python theme={null}
class RecordingChannelMode(Enum):
    MIXED = 'mixed'
    DUAL_CHANNEL = 'dual_channel'
```

***

## RecordingTranscriptFormat

Output formats for recording transcripts.

```python theme={null}
class RecordingTranscriptFormat(Enum):
    JSON = 'json'
    SRT = 'srt'
    VTT = 'vtt'
```

***

## RecordingState

Lifecycle states of a recording, from idle through completion or failure.

```python theme={null}
class RecordingState(Enum):
    IDLE = 'idle'
    RECORDING = 'recording'
    FINALIZING = 'finalizing'
    UPLOADING = 'uploading'
    COMPLETED = 'completed'
    FAILED = 'failed'
```

***

## BackgroundAudioHandlerConfig

Configuration for background audio playback during an agent session.

### Fields

<ParamField path="file" type="str" default="">
  Path to the audio file to play in the background.
</ParamField>

<ParamField path="volume" type="float" default="1.0">
  Playback volume multiplier, where `1.0` is the original level.
</ParamField>

<ParamField path="looping" type="bool" default="False">
  Whether the audio should loop continuously.
</ParamField>

<ParamField path="enabled" type="bool" default="True">
  Whether background audio is active.
</ParamField>

<ParamField path="mode" type="Literal['playback', 'mixing']" default="mixing">
  Playback strategy. `'mixing'` blends the audio with agent output, while `'playback'` plays it on its own.
</ParamField>

<ParamField path="chunk_size" type="int" default="320">
  Number of audio samples processed per chunk.
</ParamField>

***

## load\_audio\_file

```python theme={null}
def load_audio_file(path: str) -> bytes
```

Read the raw bytes of an audio file from disk.

<ParamField path="path" type="str" required>
  Filesystem path to the audio file.
</ParamField>

<ResponseField name="returns" type="bytes">
  The file contents as bytes, or an empty `bytes` object if the file does not exist, is a directory, or cannot be read due to permissions.
</ResponseField>

***

## TTSAudioCache

In-memory cache mapping keys to synthesized audio byte payloads.

### Constructor

```python theme={null}
TTSAudioCache(*args, **kwargs) -> None
```

### add

```python theme={null}
def add(self, key: str, data: bytes) -> None
```

Store audio data under the given key.

<ParamField path="key" type="str" required>
  Identifier under which to store the audio.
</ParamField>

<ParamField path="data" type="bytes" required>
  Raw audio bytes to cache.
</ParamField>

### clear

```python theme={null}
def clear(self) -> None
```

Remove all cached audio entries.

### get

```python theme={null}
def get(self, key: str) -> Optional[bytes]
```

Retrieve cached audio data for a key.

<ParamField path="key" type="str" required>
  Identifier of the cached audio.
</ParamField>

<ResponseField name="returns" type="Optional">
  The cached audio bytes, or `None` if the key is not present.
</ResponseField>
