Observed since 21 Oct, 09:21 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A Python SDK for Agora Server
Supported Linux versions:
Supported Mac versions:
Python version:
pip install agora_python_server_sdk
for linux os, should set env to :/site_packages/agora/agora_sdk/, like: export LD_LIBRARY_PATH=/site_packages/agora/agora_sdk/
python agora_rtc/examples/example_audio_pcm_send.py --appId=xxx --channelId=xxx --userId=xxx --audioFile=./test_data/demo.pcm --sampleRate=16000 --numOfChannels=1
SimulcastStreamConfig unit of bitrate to kbpsVideoEncoderConfiguration unit of bitrate to kbpssend_stream_message.ctypes.POINTER.encryptionconfigure.ut test caseNew Features:
RTCConnection.get_sid() and RTCConnection.set_simulcast_stream() interfaces for retrieving SID and configuring Simulcast stream capabilities.EncryptionConfig, added the datastream_encryption_enabled option to support data stream encryption.Improvements and Enhancements:
LocalVideoTrack.enable_simulcast_stream().capture_time_ms is not set, the current time will be used by default.Examples and Documentation:
pcm_consumer_ when calling interrupt_audio.connection::send_intra_request API, allowing you to initiate an intra request to remote users and trigger them to send a key frame.# Configure incremental send parameters
publish_config.send_external_audio_parameters = SendExternalAudioParameters(
enabled=True,
send_ms=2000,
send_speed=2,
deliver_mute_data_for_fake_adm=False
)
# Create an RTC connection
connection = agora_service.create_rtc_connection(con_config, publish_config)
external_Audio_Processor.example_external_Audio_Processor.py to demonstrate external audio data processing.4.4.32/1025setup.py and __init__.py, including version/URL and MD5 processing.To-Do Items:
Notes:
Usage Examples:
-- update: to support rtm -- adjust sdk's directory structure -- change requests to urllib
-- update arm64 rtc sdk:Fixed a JNI referencing issue in the previous arm64 build. This issue only outputs logs to the console and does not affect functionality.
#2025.09.01 release 2.3.0
Overview
Agora Python SDK version 2.3.0 introduces significant enhancements for real-time audio and video communication, with particular optimizations for AI server scenarios. This release includes API improvements, automation of previously manual processes, and increased flexibility in connection configuration.
New Features
• Added support for the AudioScenarioAiServer scenario type, now set as the default AudioScenario.
• Enables configuration of different scenarios and profiles for connections within the same process.
• Important: When using AI server scenario, client-side must use AIClient scenario to avoid audio abnormalities. Please consult Agora support for SDK versions supporting AIClient scenario.
• Introduced PublishConfigure parameter in connection creation for setting:
• Scenario and profile configurations
• Audio/Video publication settings
• Other publication parameters
• Added multiple observer registration methods to connections:
• RegisterLocalUserObserver
• RegisterAudioFrameObserver
• RegisterVideoFrameObserver
• RegisterVideoEncodedFrameObserver
• Added publication control methods:
• PublishAudio/UnpublishAudio
• PublishVideo/UnpublishVideo
• Added data pushing methods:
• PushAudioPcmData/PushAudioEncodedData
• PushVideoFrame/PushVideoEncodedData
• Added InterruptAudio method for supporting interruption functionality
• Added IsPushToRTCCompleted method for checking push status
• Added SendAudioMetaData method for audio metadata transmission
• Eliminated manual CreateDataStream calls - now handled automatically
• Automatic observer unregistration on Release() instead of manual unregistering
• Internal handling of media node factory creation:
• No longer requires manual calls to newMediaNodeFactory
• Automatic handling of track creation (NewCustomAudioTrackPcm, NewCustomAudioTrackEncoded, NewCustomVideoTrack)
• Automatic management of audio data senders (NewAudioPcmDataSender)
Integration Process
The updated integration workflow is as follows:
Initialize Agora Service (once per process startup): config = AgoraServiceConfig() agora_service = AgoraService() agora_service.initialize(config)
Connection Management (can be looped for multiple connections):
con = agora_service.create_rtc_connection(con_config, publish_config)
con.register_observer(conHandler) con.register_audio_frame_observer(audioFrameObserver) con.register_local_user_observer(localUserObserver)
con.connect(token, channelName, userId) con.publish_audio() # or con.publish_video()
con.push_audio_pcm_data() # or push_audio_encoded_data()
con.disconnect() con.release()
Release Agora Service (once during process termination): agora_service.release()
Performance Recommendations
For AI Scenarios: • Use AudioScenarioAIServer for server-side applications
• Provides optimized performance with lower latency (20-30ms reduction on iPhone compared to chorus)
• Enhanced experience in weak network conditions
• Mandatory: Client must use AIClient scenario
For Non-AI Scenarios: • Consult Agora technical support for appropriate scenario configuration
• Ensure configuration matches specific business use cases
Bug Fixes
• Updated RTC SDK with 2 bug fixes
Important Notes
• Backward Compatibility: Review integration code for manual calls that are now automated
• Scenario Matching: Ensure client-server scenario compatibility (AIServer requires AIClient)
• Resource Management: Connection release now automatically handles observer unregistration
• Consult Support: For specific integration guidance and upgrade assistance, contact Agora SA
Summary of Core Changes
Before After 2.3.0
Manual CreateDataStream ✅ Automatic
Manual observer unregistration ✅ Automatic on Release()
Fixed per-process scenario ✅ Multi-scenario per process
Client/Server scenario mismatch ❗ AIClient mandatory for AI use
For detailed implementation guidance and version-specific support, please consult Agora technical support.
-- Update: update rtc sdk from 4.4.31 to 4.4.32
-- Fix: -- Fixed a bug in the salt processing in enable_encryption -- Updated the logic in enable_encryption, no processing when enable is 0 2025.04.10 Release 2.2.2 -- Additions:
2025.02.26 Release 2.2.1 --Update: - Reduced buffer size from 180ms to 100ms to minimize latency. -- Added:
2025.01.08 Release 2.2.0 -- Updates:
Fixed the typeError issue in LocalUser::sub/unsub audio/video. Adjusted the default stopRecogCount for VAD from 30 to 50. Modified sample_vad.
user_id in the AudioVolumeInfoInner and AudioVolumeInfo structure to str type._on_audio_volume_indication callback, where it could only handle one callback to speaker_numberIRTCLocalUserObserver::on_audio_volume_indication callback to list type.Add audio VAD interface of version 2 and corresponding example.
Fixed some bug.
Call _vad_instance.init(AudioVadConfigV2) to initialize the vad instance. Reference: voice_detection.py. Assume the instance is: _vad_instance
In audio_frame_observer::on_playback_audio_frame_before_mixing(audio_frame):
Call the process of the vad module: state, bytes = _vad_instance.process(audio_frame) Judge the value of state according to the returned state, and do corresponding processing.
A. If state is _vad_instance._vad_state_startspeaking, it indicates that the user is "starting to speak", and speech recognition (STT/ASR) operations can be started. Remember: be sure to pass the returned bytes to the recognition module instead of the original audio_frame, otherwise the recognition result will be incorrect.
B. If state is _vad_instance._vad_state_stopspeaking, it indicates that the user is "stopping speaking", and speech recognition (STT/ASR) operations can be stopped. Remember: be sure to pass the returned bytes to the recognition module instead of the original audio_frame, otherwise the recognition result will be incorrect.
C. If state is _vad_instance._vad_state_speaking, it indicates that the user is "speaking", and speech recognition (STT/ASR) operations can be continued. Remember: be sure to pass the returned bytes to the recognition module instead of the original audio_frame, otherwise the recognition result will be incorrect.
If the vad module is used and it is expected to use the vad module for speech recognition (STT/ASR) and other operations, then be sure to pass the returned bytes to the recognition module instead of the original audio_frame, otherwise the recognition result will be incorrect.
- A . Save the data of audio_frame to a local file, reference: example_audio_pcm_send.py. This is to record the original audio data. For example, it can be named: source_{time.time()*1000}.pcm
- B.Save the result of each vad processing:
- a When state == start_speaking: create a new binary file, for example, named: vad_{time.time()*1000}.pcm, and write bytes to the file.
- b When state == speaking: write bytes to the file.
- c When state == stop_speaking: write bytes to the file and close the file.
Note: In this way, problems can be troubleshot based on the original audio file and the audio file processed by vad. This function can be disabled in the production environment.
localuser.unpublish_audio(audio_track)
localuser.unpublish_video(video_track)
audio_track.set_enabled(0)
video_track.set_enabled(0)
localuser.unregister_audio_frame_observer()
localuser.unregister_video_frame_observer()
localuser.unregister_local_user_observer()
connection.disconnect()
connection.unregister_observer()
localuser.release()
connection.release()
audio_track.release()
video_track.release()
pcm_data_sender.release()
video_data_sender.release()
audio_consumer.release()
media_node_factory.release()
agora_service.release()
#set to None
audio_track = None
video_track = None
audio_observer = None
video_observer = None
local_observer = None
localuser = None
connection = None
agora_service = None
In human-machine dialogue, an interrupt refers to the situation where a user suddenly interrupts the robot's response, requesting the robot to stop its current response immediately and shift to answer the user's new question. This behavior is called an interrupt.
Interrupts can be defined in different ways depending on the product. There are generally two modes:
Mode 1: Voice Activation Mode When it detects that the user is speaking, the interrupt strategy is triggered. For example, when the system recognizes speech, it triggers the interrupt strategy to stop the robot's response.
Mode 2: ASR Activation Mode When the system detects that the user is speaking and receives a result from ASR (Automatic Speech Recognition) or STT (Speech-to-Text), the interrupt strategy is triggered.
Voice Activation Interrupt
Advantages: Reduces the user's wait time and the likelihood of interrupts, as the robot will stop its response immediately when the user starts speaking, eliminating the need for the user to wait for the robot to finish speaking. Disadvantages: Since this is voice-activated, it may be triggered by meaningless audio signals, depending on the accuracy of the VAD (Voice Activity Detection). For example, if someone is typing on the keyboard while the AI is speaking, it might trigger the interrupt incorrectly. ASR Activation Interrupt
Advantages: Reduces the probability of unnecessary interrupts because the interrupt strategy is triggered only after ASR or STT has recognized the user’s speech. Disadvantages: Since this is ASR/STT-triggered, it requires converting the audio signal into text, which introduces a delay before the interrupt can be processed.
If the interrupt delay is not sensitive, the ASR Activation Mode is recommended. This mode can filter out non-speech signals more effectively and reduce the probability of an unintended interrupt.
How to Implement Interrupts? What Actions Are Required? In a human-machine dialogue system, conversations are typically structured in "rounds," where each round consists of a question from the user, followed by a response from the robot, and so on. For each round, we can assign a roundId, incrementing it with each new round. A round consists of the following stages:
VAD (Voice Activity Detection): This marks the start of the dialogue, where the system detects the beginning and end of the user's speech. It then passes this information to the ASR for further processing.
ASR (Automatic Speech Recognition): This phase involves recognizing the user's speech and converting it into text, which is then passed to the LLM (Large Language Model).
LLM (Large Language Model): This is the generation phase, where the LLM processes the recognized user input and generates a response.
TTS (Text-to-Speech): In this phase, the LLM’s response is converted into an audio format.
RTC Streaming: The generated audio is streamed via RTC (Real-Time Communication) to be played back to the user.
Therefore, an interrupt happens when, in the next round (roundId+1), either through Voice Activation (triggered by the VAD phase) or ASR Activation (triggered when ASR recognizes the user’s speech), the following actions must be performed:
Stop the LLM Generation in the current round (roundId). Stop the TTS Synthesis in the current round (roundId). Stop the RTC Streaming in the current round (roundId). API Call References: Call: AudioConsumer.clear() Call: LocalAudioTrack.clear_sender_buffer() Business Layer: Clear any remaining TTS-related data (if applicable)
LLM (Large Language Model) results are returned asynchronously and in a streaming manner. When should the results from the LLM be passed to TTS (Text-to-Speech) for synthesis?
Two main factors need to be considered:
Ensure that the TTS synthesized speech is unambiguous: The speech synthesized by TTS must be clear, complete, and continuous. For example, if the LLM returns the text: "中间的首都是北京吗?", and we pass it to TTS as:
"中", "国首", "是北", "京吗?", This would result in ambiguous synthesis because there are no spaces between certain words (e.g., between "中" and "国", "首" and "是", and "京" and "吗"). Proper segmentation must be ensured to avoid such ambiguities. Minimize overall processing delay: If the LLM results are passed to TTS only after the entire response is generated, the speech synthesis will be unambiguous and continuous. However, this approach introduces significant delay, which negatively affects the user experience.
Recommended Approach To achieve a balance between clarity and minimal delay, the following steps should be followed:
Store the LLM results in a cache as they are received. Perform a reverse scan of the cached data to find the most recent punctuation mark. Truncate the data from the start to the most recent punctuation mark and pass it to TTS for synthesis. Remove the truncated data from the cache. The remaining data should be moved to the beginning of the cache and continue waiting for additional data from the LLM.
##VAD Configuration Parameters AgoraAudioVadConfigV2 Properties
Property Name Type Description Default Value Value Range preStartRecognizeCount int Number of audio frames saved before detecting speech 16 [0, ] startRecognizeCount int Total number of audio frames to detect speech start 30 [1, max] stopRecognizeCount int Number of audio frames to detect speech stop 50 [1, max] activePercent float Percentage of active frames in startRecognizeCount frames 0.7 [0.0, 1.0] inactivePercent float Percentage of inactive frames in stopRecognizeCount frames 0.5 [0.0, 1.0] startVoiceProb int Probability that an audio frame contains human voice 70 [0, 100] stopVoiceProb int Probability that an audio frame contains human voice 70 [0, 100] startRmsThreshold int Energy dB threshold for detecting speech start -50 [-100, 0] stopRmsThreshold int Energy dB threshold for detecting speech stop -50 [-100, 0] Notes: startRmsThreshold and stopRmsThreshold:
The higher the value, the louder the speaker's voice needs to be compared to the surrounding background noise. In quiet environments, it is recommended to use the default value of -50. In noisy environments, you can increase the threshold to between -40 and -30 to reduce false positives. Adjusting these thresholds based on the actual use case and audio characteristics can achieve optimal performance. stopRecognizeCount:
This value reflects how long to wait after detecting non-human voice before concluding that the user has stopped speaking. It controls the gap between consecutive speech utterances. Within this gap, VAD will treat adjacent sentences as part of the same speech. A shorter gap will increase the likelihood of adjacent sentences being recognized as separate speech segments. Typically, it is recommended to set this value between 50 and 80. For example: "Good afternoon, [interval_between_sentences] what are some fun places to visit in Beijing?"
If the interval_between_sentences between the speaker's phrases is greater than the stopRecognizeCount, the VAD will recognize the above as two separate VADs:
VAD1: Good afternoon VAD2: What are some fun places to visit in Beijing? If the interval_between_sentences is less than stopRecognizeCount, the VAD will recognize the above as a single VAD:
VAD: Good afternoon, what are some fun places to visit in Beijing?
If latency is a concern, you can lower this value, or consult with the development team to determine how to manage latency while ensuring semantic continuity in speech recognition. This will help avoid the AI being interrupted too sensitively.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 2.4.10 | 21 Oct 2026 | 0 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 21 Oct, 09:21 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:1bf6aeb1cd6753d978fdaa7234626852e031f283d5d0d2e8e0b4aac2df4f1324