Pre-built Agents
Voice Agent

Voice Agent

The AI-Horizon Voice Agent provides vocal conversation capabilities, speech-to-text transcriptions, and text-to-speech audio outputs. It abstracts the complex components of audio chunking, automatic speech recognition (ASR), and synthesis, enabling your systems to speak and listen using a unified interface.


Features

  • Automated Speech Recognition (ASR): Converts voice recordings (WAV, MP3, M4A, etc.) into high-fidelity text.
  • RAG-Powered Answering: Integrates with the vector databases of your project to answer questions based on your custom documentation.
  • Text-to-Speech (TTS): Synthesizes response messages back into organic audio files or streams.
  • Stateless & Statefull Modes: Supports standalone single-shot vocal requests or multi-turn vocal conversations.

Technical Architecture

Below is the execution flow of the voice agent processing pipeline:


Python SDK Usage

You can invoke the Voice Agent directly in Python via the VoiceBot class:

from aih import VoiceBot
 
# Initialize the Voice Bot Agent
voice_bot = VoiceBot(
    api_key="your_aih_api_key",
    system_prompt="You are a warm, professional customer care agent."
)
 
# Start a voice processing session with an audio file path
result = voice_bot.process_audio(
    audio_file_path="./records/voice_query.wav",
    output_audio_path="./records/voice_response.wav"
)
 
print("User Spoke:", result.transcription)
print("Agent Response:", result.text_response)
print("Output Audio Saved to:", result.output_audio_path)

Core Configuration Options

ParameterTypeDefaultDescription
api_keystringNoneYour AI-Horizon API authorization key.
system_promptstringNoneGuides the persona, speech tone, and vocabulary.
language_codestring"en-US"Language code for speech recognition transcription.
voice_namestring"en-US-Standard-A"The synthetic voice configuration for audio output.
temperaturenumber0.1Controls the variance of generated text responses.