AssemblyAI

Updated

Use AssemblyAI for speech recognition (ASR) in a Conversational AI Platform agent.

Preview documentation

You're reading the Conversational AI Platform (Preview) docs. Switch to Main.

AssemblyAI provides advanced automatic speech recognition with high accuracy and support for multiple languages, designed for real-time conversational AI applications.

Sample configuration

The following example shows how to configure AssemblyAI as the agent's ASR when you create or update an agent. For a complete example, see Create an agent and start a session.

AssemblyAI supports BYOK only. It isn't available in managed mode. Store your AssemblyAI API key in a secret set, and refer to it from the agent. For details, see Use your own provider keys.

from agora_agent import Agent, AssemblyAISTT, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(
        AssemblyAISTT(
            api_key=secret_ref("support_prod", "assemblyai"),
            language="en-US",
        )
    )
    .with_llm(...)  # configure your LLM vendor
    .with_tts(...)  # configure your TTS vendor
)
import { Agent, AssemblyAISTT, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(
    new AssemblyAISTT({
      apiKey: secretRef('support_prod', 'assemblyai'),
      language: 'en-US',
    }),
  )
  .withLlm(/* configure your LLM vendor */)
  .withTts(/* configure your TTS vendor */);
// client is your configured Agora client
agent := agentkit.NewAgent(client).
	WithStt(vendors.NewAssemblyAISTT(vendors.AssemblyAISTTOptions{
		APIKey:   agentkit.SecretRef("support_prod", "assemblyai"),
		Language: "en-US",
	})).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts( /* configure your TTS vendor */ )

Set credential.mode to byok and credential.fields.api_key to a reference to your AssemblyAI API key in a secret set. In the following example, the key is stored as assemblyai in the support_prod set:

"asr": {
  "credential": {
    "mode": "byok",
    "fields": {
      "api_key": "$secrets.support_prod.assemblyai"
    }
  },
  "vendor": "assemblyai",
  "language": "en-US",
  "url": "wss://streaming.assemblyai.com/v3/ws",
  "params": {
    "language": "en-US"
  }
}

Key parameters

The asr block takes the following fields. In the SDKs, AssemblyAISTT sets them from its options, and passes any other AssemblyAI parameters from its additional parameters option to params.

asrrequired
vendorstring
required

Set to assemblyai.

credentialobject
required

How the agent authenticates with AssemblyAI. Set mode to byok and fields.api_key to a $secrets.<set>.<key> reference to your AssemblyAI API key. Get your API key from the AssemblyAI Dashboard.

languagestring
required

The language code for speech recognition.

urlstring
optional

The WebSocket URL for AssemblyAI's streaming API. Specify this to target a particular region, for example, wss://streaming.assemblyai.com/v3/ws. Omit it to use the default endpoint.

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 AssemblyAI without validation. For a full list of supported options, refer to the AssemblyAI official 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.