Skip to main content

Overview

AWSNovaSonicLLMService enables natural, real-time conversations with AWS Nova Sonic. It provides built-in audio transcription, voice activity detection, and context management for creating interactive AI experiences with bidirectional audio streaming, text generation, and function calling capabilities.

AWS Nova Sonic API Reference

Pipecat’s API methods for AWS Nova Sonic integration

Example Implementation

Complete AWS Nova Sonic conversation example

AWS Bedrock Documentation

Official AWS Bedrock and Nova Sonic documentation

AWS Console

Access AWS Bedrock and manage Nova Sonic models

Installation

To use AWS Nova Sonic services, install the required dependencies:

Prerequisites

AWS Account Setup

Before using AWS Nova Sonic services, you need:
  1. AWS Account: Set up at AWS Console
  2. Bedrock Access: Enable AWS Bedrock service in your region
  3. Model Access: Request access to Nova Sonic models in Bedrock
  4. IAM Credentials: Configure AWS access keys with Bedrock permissions

Required Environment Variables

  • AWS_SECRET_ACCESS_KEY: Your AWS secret access key
  • AWS_ACCESS_KEY_ID: Your AWS access key ID
  • AWS_REGION: AWS region where Bedrock is available

Key Features

  • Real-time Speech-to-Speech: Direct audio input to audio output processing
  • Built-in Transcription: Automatic speech-to-text with real-time streaming
  • Voice Activity Detection: Automatic detection of speech start/stop
  • Function Calling: Support for external function and API integration
  • Multiple Voices: See AWS Nova 2 Sonic voice support for available voices

Configuration

AWSNovaSonicLLMService

str
required
AWS secret access key for authentication.
str
required
AWS access key ID for authentication.
str
default:"None"
AWS session token for temporary credentials (e.g., when using AWS STS).
str
required
AWS region where the service is hosted. Supported regions: "us-east-1", "us-west-2", "eu-north-1", "ap-northeast-1".
str
default:"amazon.nova-2-5-sonic"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=AWSNovaSonicLLMService.Settings(model=...) instead.
str
default:"matthew"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=AWSNovaSonicLLMService.Settings(voice=...) instead.
Params
default:"Params()"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=AWSNovaSonicLLMService.Settings(...) for inference settings and audio_config=AudioConfig(...) for audio configuration.
AudioConfig
default:"None"
Audio configuration (sample rates, sample sizes, channel counts). If not provided, defaults are used (16kHz input, 24kHz output, 16-bit, mono). See AudioConfig below.
AWSNovaSonicLLMService.Settings
default:"None"
Inference and voice settings. See Settings below.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=AWSNovaSonicLLMService.Settings(system_instruction=...) instead.
ToolsSchema | List[FunctionSchema | DirectFunction]
default:"None"
Available tools for the model: a ToolsSchema, or a plain list of direct functions and/or FunctionSchema objects.
SessionContinuationParams
default:"None"
Configuration for automatic session continuation. When enabled (the default), sessions are seamlessly rotated before the AWS time limit (~8 minutes) with no user-perceptible interruption. See SessionContinuationParams below.

Settings

Settings passed via the settings constructor argument using AWSNovaSonicLLMService.Settings(...). Changing them mid-conversation with LLMUpdateSettingsFrame is not supported: the service stores the change and logs a warning, but doesn’t apply it to the session in progress. See Service Settings for details.
When endpointing_sensitivity is None it is omitted, so the model’s default applies. temperature, max_tokens, and top_p are always sent and must not be None.

AudioConfig

Audio configuration passed via the audio_config constructor argument.

SessionContinuationParams

Configuration for automatic session continuation, passed via the session_continuation constructor argument. Nova Sonic sessions have an AWS-imposed time limit (~8 minutes). When enabled, session continuation proactively creates a new session in the background before the limit is reached, buffers user audio during the transition, and hands off to it. The new session gets the conversation as transcript text (the initial context plus what the user and assistant have said since, up to the most recent 200 KB), so function call results and messages added with LLMMessagesAppendFrame don’t carry over.

Usage

Basic Setup

With Settings

With Function Calling

With Session Continuation

Methods

reset_conversation()

Disconnects and reconnects, seeding the new session with the context’s messages. A trailing user message is sent for the model to answer. Before the service has received its first context, it only logs a warning.

Notes

  • Transcription frames: User speech transcription frames are always emitted upstream. Assistant text transcripts are delivered in real-time using speculative text events, providing text synchronized with audio output for responsive client UIs.
  • Connection resilience: If a connection error occurs while the service wants to stay connected, it automatically resets the conversation and reconnects. The same happens when the model calls a function that has no registered handler.
  • No user turn frames: The service emits no UserStartedSpeakingFrame or UserStoppedSpeakingFrame, so processors that depend on them (RTVI user speaking events, user idle and mute handling, turn recording) do nothing unless LLMUserAggregatorParams has a vad_analyzer.
  • System instruction precedence: The system_instruction from service settings takes precedence over an initial system message in the LLM context. A warning is logged when both are set. Tools provided in the LLM context take precedence over those provided at initialization time.
  • Audio format: Uses LPCM (Linear PCM) audio format for both input and output. Input defaults to 16kHz and output defaults to 24kHz. Input audio is sent without resampling, so input_sample_rate must match the input audio’s sample rate (audio_in_sample_rate, 16000 by default).