Amazon Polly
Updated
Use Amazon Polly for text-to-speech (TTS) in a Conversational AI Platform agent.
Preview documentation
Amazon provides natural-sounding text-to-speech with customizable voice instructions and multiple voice options.
Sample configuration
The following example shows how to configure Amazon Polly as the agent's TTS when you create or update an agent. For a complete example, see Create an agent and start a session.
Amazon Polly supports BYOK only. It isn't available in managed mode. Store your AWS credentials in a secret set, and refer to them from the agent. For details, see Use your own provider keys.
Store both the access key ID and the secret access key in the secret set, and pass a reference to each. In the following example, they're stored as amazon_access_key_id and amazon in the support_prod set:
from agora_agent import Agent, AmazonTTS, secret_ref
# client is your configured Agora client
agent = (
Agent(client=client)
.with_stt(...) # configure your ASR vendor
.with_llm(...) # configure your LLM vendor
.with_tts(
AmazonTTS(
access_key=secret_ref("support_prod", "amazon_access_key_id"),
secret_key=secret_ref("support_prod", "amazon"),
region="<your_aws_region>",
voice_id="Joanna",
engine="neural",
)
)
)Store both the access key ID and the secret access key in the secret set, and pass a reference to each. In the following example, they're stored as amazon_access_key_id and amazon in the support_prod set:
import { Agent, AmazonTTS, secretRef } from 'agora-agents';
// client is your configured Agora client
const agent = new Agent({ client })
.withStt(/* configure your ASR vendor */)
.withLlm(/* configure your LLM vendor */)
.withTts(
new AmazonTTS({
accessKey: secretRef('support_prod', 'amazon_access_key_id'),
secretKey: secretRef('support_prod', 'amazon'),
region: '<your_aws_region>',
voiceId: 'Joanna',
engine: 'neural',
}),
);Store both the access key ID and the secret access key in the secret set, and pass a reference to each. In the following example, they're stored as amazon_access_key_id and amazon in the support_prod set:
// client is your configured Agora client
agent := agentkit.NewAgent(client).
WithStt( /* configure your ASR vendor */ ).
WithLlm( /* configure your LLM vendor */ ).
WithTts(vendors.NewAmazonTTS(vendors.AmazonTTSOptions{
AccessKey: agentkit.SecretRef("support_prod", "amazon_access_key_id"),
SecretKey: agentkit.SecretRef("support_prod", "amazon"),
Region: "<your_aws_region>",
VoiceID: "Joanna",
Engine: "neural",
}))Set credential.mode to byok, and set credential.fields.aws_access_key_id and credential.fields.aws_secret_access_key to references to your AWS access key ID and secret access key. Your AWS region isn't secret. Pass it in params. In the following example, the keys are stored as amazon_access_key_id and amazon in the support_prod set:
"tts": {
"credential": {
"mode": "byok",
"fields": {
"aws_access_key_id": "$secrets.support_prod.amazon_access_key_id",
"aws_secret_access_key": "$secrets.support_prod.amazon"
}
},
"vendor": "amazon",
"params": {
"region_name": "<your_aws_region>",
"voice": "Joanna",
"engine": "neural"
}
}Key parameters
The tts block takes the following fields. In the SDKs, AmazonTTS sets them from its options.
vendorstringSet to amazon.
credentialobjectSet mode to byok, and set fields.aws_access_key_id and fields.aws_secret_access_key to $secrets.<set>.<key> references to your AWS access key ID and secret access key. Get both from the AWS IAM Console.
paramsobjectregion_namestringThe AWS region where the Polly service is hosted, for example, us-east-1, us-west-2, or eu-west-1. See AWS regions for available regions.
voicestringThe voice ID to use for speech synthesis, for example, Joanna, Matthew, or Ivy. See available voices for supported voice IDs.
enginestringThe engine type to use for speech synthesis. Supported values: standard, neural, long-form, generative. See engine documentation for details on each engine type.
Caution
The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in params are passed through directly to Amazon Polly without validation. For a full list of supported options, refer to the Amazon Polly documentation.
This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.
