agora-agents 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agora_agents-2.0.0/PKG-INFO +365 -0
- agora_agents-2.0.0/README.md +337 -0
- agora_agents-2.0.0/pyproject.toml +84 -0
- agora_agents-2.0.0/src/agora_agent/__init__.py +94 -0
- agora_agents-2.0.0/src/agora_agent/agent_management/__init__.py +4 -0
- agora_agents-2.0.0/src/agora_agent/agent_management/client.py +258 -0
- agora_agents-2.0.0/src/agora_agent/agent_management/raw_client.py +230 -0
- agora_agents-2.0.0/src/agora_agent/agent_management/types/__init__.py +4 -0
- agora_agents-2.0.0/src/agora_agent/agent_management/types/agent_think_agent_management_request_on_listening_action.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agent_management/types/agent_think_agent_management_request_on_speaking_action.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agent_management/types/agent_think_agent_management_request_on_thinking_action.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agent_management/types/agent_think_agent_management_response.py +33 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/__init__.py +387 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/agent.py +861 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/agent_session.py +1046 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/avatar_types.py +144 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/constants.py +110 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/presets.py +205 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/token.py +325 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/vendors/__init__.py +96 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/vendors/avatar.py +208 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/vendors/base.py +94 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/vendors/llm.py +449 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/vendors/mllm.py +230 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/vendors/stt.py +255 -0
- agora_agents-2.0.0/src/agora_agent/agentkit/vendors/tts.py +451 -0
- agora_agents-2.0.0/src/agora_agent/agents/__init__.py +4 -0
- agora_agents-2.0.0/src/agora_agent/agents/client.py +1209 -0
- agora_agents-2.0.0/src/agora_agent/agents/raw_client.py +1114 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/__init__.py +4 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_agents_response.py +50 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_agents_response_status.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_history_agents_response.py +39 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_history_agents_response_contents_item.py +31 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_history_agents_response_contents_item_role.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response.py +50 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response_pagination.py +37 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response_turns_item.py +51 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response_turns_item_end.py +43 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response_turns_item_end_metadata.py +62 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response_turns_item_end_type.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response_turns_item_metrics.py +41 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response_turns_item_metrics_segmented_latency_ms_item.py +42 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response_turns_item_start.py +43 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response_turns_item_start_metadata.py +51 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/get_turns_agents_response_turns_item_start_type.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/interrupt_agents_response.py +33 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/list_agents_request_state.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/list_agents_response.py +35 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/list_agents_response_data.py +37 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/list_agents_response_data_list_item.py +34 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/list_agents_response_data_list_item_status.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/list_agents_response_meta.py +32 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/speak_agents_request_priority.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/speak_agents_response.py +33 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties.py +137 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_advanced_features.py +42 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_asr.py +47 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_asr_vendor.py +10 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_avatar.py +42 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_avatar_vendor.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_filler_words.py +41 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_filler_words_content.py +38 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_filler_words_content_static_config.py +39 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_filler_words_content_static_config_selection_rule.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_filler_words_trigger.py +38 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_filler_words_trigger_fixed_time_config.py +27 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_geofence.py +34 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_geofence_area.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_geofence_exclude_area.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_interruption.py +57 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_interruption_disabled_config.py +34 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_interruption_disabled_config_strategy.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_interruption_keywords_config.py +27 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_interruption_mode.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_llm.py +115 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_llm_greeting_configs.py +43 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_llm_greeting_configs_mode.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_llm_mcp_servers_item.py +54 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_llm_style.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_mllm.py +86 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_mllm_turn_detection.py +61 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_mllm_turn_detection_agora_vad_config.py +42 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_mllm_turn_detection_mode.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_mllm_turn_detection_semantic_vad_config.py +32 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_mllm_turn_detection_semantic_vad_config_eagerness.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_mllm_turn_detection_server_vad_config.py +62 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_mllm_turn_detection_server_vad_config_end_of_speech_sensitivity.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_mllm_turn_detection_server_vad_config_start_of_speech_sensitivity.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_mllm_vendor.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_parameters.py +69 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_parameters_audio_scenario.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_parameters_data_channel.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_parameters_farewell_config.py +34 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_parameters_silence_config.py +44 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_parameters_silence_config_action.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_rtc.py +45 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_sal.py +42 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_sal_sal_mode.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection.py +105 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config.py +47 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config_end_of_speech.py +52 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config_end_of_speech_mode.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config_end_of_speech_semantic_config.py +35 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config_end_of_speech_vad_config.py +24 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config_start_of_speech.py +63 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config_start_of_speech_disabled_config.py +34 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config_start_of_speech_disabled_config_strategy.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config_start_of_speech_keywords_config.py +26 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config_start_of_speech_mode.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_config_start_of_speech_vad_config.py +26 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_eagerness.py +5 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_interrupt_mode.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_request_properties_turn_detection_type.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_response.py +40 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/start_agents_response_status.py +7 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/update_agents_request_properties.py +39 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/update_agents_request_properties_llm.py +32 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/update_agents_request_properties_mllm.py +27 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/update_agents_response.py +40 -0
- agora_agents-2.0.0/src/agora_agent/agents/types/update_agents_response_status.py +7 -0
- agora_agents-2.0.0/src/agora_agent/client.py +246 -0
- agora_agents-2.0.0/src/agora_agent/core/__init__.py +34 -0
- agora_agents-2.0.0/src/agora_agent/core/api_error.py +23 -0
- agora_agents-2.0.0/src/agora_agent/core/client_wrapper.py +114 -0
- agora_agents-2.0.0/src/agora_agent/core/datetime_utils.py +28 -0
- agora_agents-2.0.0/src/agora_agent/core/domain.py +204 -0
- agora_agents-2.0.0/src/agora_agent/core/file.py +67 -0
- agora_agents-2.0.0/src/agora_agent/core/force_multipart.py +18 -0
- agora_agents-2.0.0/src/agora_agent/core/http_client.py +543 -0
- agora_agents-2.0.0/src/agora_agent/core/http_response.py +55 -0
- agora_agents-2.0.0/src/agora_agent/core/http_sse/__init__.py +42 -0
- agora_agents-2.0.0/src/agora_agent/core/http_sse/_api.py +112 -0
- agora_agents-2.0.0/src/agora_agent/core/http_sse/_decoders.py +61 -0
- agora_agents-2.0.0/src/agora_agent/core/http_sse/_exceptions.py +7 -0
- agora_agents-2.0.0/src/agora_agent/core/http_sse/_models.py +17 -0
- agora_agents-2.0.0/src/agora_agent/core/jsonable_encoder.py +100 -0
- agora_agents-2.0.0/src/agora_agent/core/pagination.py +82 -0
- agora_agents-2.0.0/src/agora_agent/core/pydantic_utilities.py +260 -0
- agora_agents-2.0.0/src/agora_agent/core/query_encoder.py +58 -0
- agora_agents-2.0.0/src/agora_agent/core/remove_none_from_dict.py +11 -0
- agora_agents-2.0.0/src/agora_agent/core/request_options.py +35 -0
- agora_agents-2.0.0/src/agora_agent/core/serialization.py +276 -0
- agora_agents-2.0.0/src/agora_agent/core/unchecked_base_model.py +376 -0
- agora_agents-2.0.0/src/agora_agent/environment.py +7 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/__init__.py +4 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/client.py +589 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/raw_client.py +554 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/__init__.py +4 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/add_phone_numbers_request_inbound_config.py +27 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/add_phone_numbers_request_outbound_config.py +37 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/add_phone_numbers_request_provider.py +5 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/add_phone_numbers_response.py +49 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/add_phone_numbers_response_associated_pipeline.py +32 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/get_phone_numbers_response.py +62 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/get_phone_numbers_response_associated_pipeline.py +32 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/get_phone_numbers_response_provider.py +5 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/list_phone_numbers_response_item.py +62 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/list_phone_numbers_response_item_associated_pipeline.py +32 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/list_phone_numbers_response_item_provider.py +5 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/update_phone_numbers_request_inbound_config.py +27 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/update_phone_numbers_request_outbound_config.py +27 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/update_phone_numbers_response.py +62 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/update_phone_numbers_response_associated_pipeline.py +32 -0
- agora_agents-2.0.0/src/agora_agent/phone_numbers/types/update_phone_numbers_response_provider.py +5 -0
- agora_agents-2.0.0/src/agora_agent/pool_client.py +546 -0
- agora_agents-2.0.0/src/agora_agent/py.typed +0 -0
- agora_agents-2.0.0/src/agora_agent/telephony/__init__.py +4 -0
- agora_agents-2.0.0/src/agora_agent/telephony/client.py +554 -0
- agora_agents-2.0.0/src/agora_agent/telephony/raw_client.py +557 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/__init__.py +4 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/call_telephony_request_properties.py +44 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/call_telephony_request_sip.py +42 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/call_telephony_response.py +23 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/get_telephony_response.py +78 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/get_telephony_response_reason.py +5 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/get_telephony_response_state.py +5 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/get_telephony_response_type.py +5 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/hangup_telephony_response.py +18 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/list_telephony_request_type.py +5 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/list_telephony_response.py +35 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/list_telephony_response_data.py +37 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/list_telephony_response_data_list_item.py +69 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/list_telephony_response_data_list_item_state.py +5 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/list_telephony_response_data_list_item_type.py +5 -0
- agora_agents-2.0.0/src/agora_agent/telephony/types/list_telephony_response_meta.py +32 -0
- agora_agents-2.0.0/src/agora_agent/types/__init__.py +4 -0
- agora_agents-2.0.0/src/agora_agent/types/agent_error_response.py +46 -0
- agora_agents-2.0.0/src/agora_agent/types/agent_error_response_reason.py +24 -0
- agora_agents-2.0.0/src/agora_agent/types/amazon_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/amazon_tts_params.py +42 -0
- agora_agents-2.0.0/src/agora_agent/types/cartesia_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/cartesia_tts_params.py +39 -0
- agora_agents-2.0.0/src/agora_agent/types/cartesia_tts_voice.py +32 -0
- agora_agents-2.0.0/src/agora_agent/types/deepgram_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/deepgram_tts_params.py +52 -0
- agora_agents-2.0.0/src/agora_agent/types/eleven_labs_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/eleven_labs_tts_params.py +47 -0
- agora_agents-2.0.0/src/agora_agent/types/fish_audio_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/fish_audio_tts_params.py +32 -0
- agora_agents-2.0.0/src/agora_agent/types/google_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/google_tts_params.py +42 -0
- agora_agents-2.0.0/src/agora_agent/types/hume_ai_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/hume_ai_tts_params.py +32 -0
- agora_agents-2.0.0/src/agora_agent/types/microsoft_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/microsoft_tts_params.py +42 -0
- agora_agents-2.0.0/src/agora_agent/types/minimax_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/minimax_tts_params.py +44 -0
- agora_agents-2.0.0/src/agora_agent/types/minimax_tts_params_voice_setting.py +23 -0
- agora_agents-2.0.0/src/agora_agent/types/murf_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/murf_tts_params.py +37 -0
- agora_agents-2.0.0/src/agora_agent/types/open_ai_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/open_ai_tts_params.py +37 -0
- agora_agents-2.0.0/src/agora_agent/types/rime_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/rime_tts_params.py +37 -0
- agora_agents-2.0.0/src/agora_agent/types/sarvam_tts.py +29 -0
- agora_agents-2.0.0/src/agora_agent/types/sarvam_tts_params.py +37 -0
- agora_agents-2.0.0/src/agora_agent/types/telephony_error_response.py +34 -0
- agora_agents-2.0.0/src/agora_agent/types/tts.py +238 -0
- agora_agents-2.0.0/src/agora_agent/version.py +3 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: agora-agents
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary:
|
|
5
|
+
Requires-Python: >=3.8,<4.0
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Operating System :: MacOS
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Operating System :: POSIX
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Dist: httpx (>=0.21.2)
|
|
22
|
+
Requires-Dist: pydantic (>=1.9.2)
|
|
23
|
+
Requires-Dist: pydantic-core (>=2.18.2)
|
|
24
|
+
Requires-Dist: typing_extensions (>=4.0.0)
|
|
25
|
+
Project-URL: Repository, https://github.com/AgoraIO-Conversational-AI/agent-server-sdk-python
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Agora Conversational AI Python SDK
|
|
29
|
+
|
|
30
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FAgoraIO-Conversational-AI%2Fagent-server-sdk-python)
|
|
31
|
+
[](https://pypi.python.org/pypi/agora-agents)
|
|
32
|
+
|
|
33
|
+
The Agora Conversational AI SDK provides convenient access to the Agora Conversational AI APIs,
|
|
34
|
+
enabling you to build voice-powered AI agents with support for both cascading flows (ASR -> LLM -> TTS)
|
|
35
|
+
and multimodal flows (MLLM) for real-time audio processing.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
pip install agora-agents
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Requirements
|
|
44
|
+
|
|
45
|
+
- Python 3.8+
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
Start with the `Agent` builder: create a client with app credentials, choose your ASR, LLM, and TTS providers, then start a session. Omit vendor API keys for supported Agora-managed models, or provide keys when you want BYOK.
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import os
|
|
53
|
+
import time
|
|
54
|
+
|
|
55
|
+
from agora_agent import (
|
|
56
|
+
Agent,
|
|
57
|
+
Agora,
|
|
58
|
+
Area,
|
|
59
|
+
DataChannel,
|
|
60
|
+
DeepgramSTT,
|
|
61
|
+
GenericAvatar,
|
|
62
|
+
MiniMaxTTS,
|
|
63
|
+
OpenAI,
|
|
64
|
+
XaiGrok,
|
|
65
|
+
expires_in_hours,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
AGENT_PROMPT = (
|
|
69
|
+
"You are a concise, technically credible voice assistant. "
|
|
70
|
+
"Keep replies short unless the user asks for detail."
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
GREETING = "Hi there! I am your Agora voice assistant. How can I help?"
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def start_conversation() -> str:
|
|
77
|
+
app_id = os.environ["AGORA_APP_ID"]
|
|
78
|
+
app_certificate = os.environ["AGORA_APP_CERTIFICATE"]
|
|
79
|
+
|
|
80
|
+
client = Agora(
|
|
81
|
+
area=Area.US,
|
|
82
|
+
app_id=app_id,
|
|
83
|
+
app_certificate=app_certificate,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
agent = Agent(
|
|
87
|
+
name=f"conversation-{int(time.time())}",
|
|
88
|
+
instructions=AGENT_PROMPT,
|
|
89
|
+
greeting=GREETING,
|
|
90
|
+
failure_message="Please wait a moment.",
|
|
91
|
+
max_history=50,
|
|
92
|
+
turn_detection={
|
|
93
|
+
"config": {
|
|
94
|
+
"speech_threshold": 0.5,
|
|
95
|
+
"start_of_speech": {
|
|
96
|
+
"mode": "vad",
|
|
97
|
+
"vad_config": {
|
|
98
|
+
"interrupt_duration_ms": 160,
|
|
99
|
+
"prefix_padding_ms": 300,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
"end_of_speech": {
|
|
103
|
+
"mode": "vad",
|
|
104
|
+
"vad_config": {
|
|
105
|
+
"silence_duration_ms": 480,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
advanced_features={
|
|
111
|
+
"enable_rtm": True,
|
|
112
|
+
"enable_tools": True,
|
|
113
|
+
},
|
|
114
|
+
parameters={
|
|
115
|
+
"data_channel": DataChannel.RTM,
|
|
116
|
+
"enable_error_message": True,
|
|
117
|
+
},
|
|
118
|
+
).with_stt(
|
|
119
|
+
DeepgramSTT(
|
|
120
|
+
model="nova-3",
|
|
121
|
+
language="en",
|
|
122
|
+
)
|
|
123
|
+
).with_llm(
|
|
124
|
+
OpenAI(
|
|
125
|
+
model="gpt-4o-mini",
|
|
126
|
+
greeting_message=GREETING,
|
|
127
|
+
failure_message="Please wait a moment.",
|
|
128
|
+
max_history=15,
|
|
129
|
+
params={
|
|
130
|
+
"max_tokens": 1024,
|
|
131
|
+
"temperature": 0.7,
|
|
132
|
+
"top_p": 0.95,
|
|
133
|
+
},
|
|
134
|
+
)
|
|
135
|
+
).with_tts(
|
|
136
|
+
MiniMaxTTS(
|
|
137
|
+
model="speech_2_6_turbo",
|
|
138
|
+
voice_id="English_captivating_female1",
|
|
139
|
+
)
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
session = agent.create_session(
|
|
143
|
+
client,
|
|
144
|
+
channel=f"demo-channel-{int(time.time())}",
|
|
145
|
+
agent_uid="123456",
|
|
146
|
+
remote_uids=["*"],
|
|
147
|
+
idle_timeout=30,
|
|
148
|
+
expires_in=expires_in_hours(1),
|
|
149
|
+
debug=False,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
return session.start()
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Why no token or vendor key in the example?
|
|
156
|
+
|
|
157
|
+
`Agora` generates the required ConvoAI REST auth and RTC join tokens automatically when you provide `app_id` and `app_certificate`. For supported Agora-managed models, leave vendor API keys unset; provide keys when you want BYOK.
|
|
158
|
+
|
|
159
|
+
### BYOK version
|
|
160
|
+
|
|
161
|
+
Use the same `Agent` builder shape, but provide credentials explicitly when you want vendor-managed billing and routing instead of Agora-managed models.
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
agent = Agent(
|
|
165
|
+
instructions=AGENT_PROMPT,
|
|
166
|
+
greeting=GREETING,
|
|
167
|
+
).with_stt(
|
|
168
|
+
DeepgramSTT(
|
|
169
|
+
api_key=os.environ["DEEPGRAM_API_KEY"],
|
|
170
|
+
model="nova-3",
|
|
171
|
+
language="en",
|
|
172
|
+
)
|
|
173
|
+
).with_llm(
|
|
174
|
+
OpenAI(
|
|
175
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
176
|
+
model="gpt-4o-mini",
|
|
177
|
+
max_tokens=1024,
|
|
178
|
+
temperature=0.7,
|
|
179
|
+
top_p=0.95,
|
|
180
|
+
)
|
|
181
|
+
).with_tts(
|
|
182
|
+
MiniMaxTTS(
|
|
183
|
+
key=os.environ["MINIMAX_API_KEY"],
|
|
184
|
+
group_id=os.environ["MINIMAX_GROUP_ID"],
|
|
185
|
+
model="speech_2_6_turbo",
|
|
186
|
+
voice_id="English_captivating_female1",
|
|
187
|
+
url="wss://api-uw.minimax.io/ws/v1/t2a_v2",
|
|
188
|
+
)
|
|
189
|
+
)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Migrating from `agora-agent-server-sdk` on PyPI? Use `pip install agora-agents`; imports stay `agora_agent` — see [changelog migration notes](./changelog.md#migration-notes) or [installation guide](./docs/getting-started/installation.md#migrating-from-a-previous-package-name).
|
|
193
|
+
|
|
194
|
+
## BYOK
|
|
195
|
+
|
|
196
|
+
If you want to bring your own vendor credentials instead of using Agora-managed models, use the BYOK guide:
|
|
197
|
+
|
|
198
|
+
- [BYOK Guide](./docs/guides/byok.md)
|
|
199
|
+
|
|
200
|
+
## MLLM (Realtime / Multimodal)
|
|
201
|
+
|
|
202
|
+
Use `with_mllm()` for OpenAI Realtime, Gemini Live, Vertex AI, or xAI Grok. No STT, LLM, or TTS vendor is needed when MLLM mode is enabled.
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
from agora_agent import Agent, OpenAIRealtime
|
|
206
|
+
|
|
207
|
+
agent = Agent(name="realtime-assistant").with_mllm(
|
|
208
|
+
OpenAIRealtime(
|
|
209
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
210
|
+
model="gpt-4o-realtime-preview",
|
|
211
|
+
greeting_message="Hello! Ready to chat.",
|
|
212
|
+
)
|
|
213
|
+
)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
See the [MLLM Flow guide](./docs/guides/mllm-flow.md) for full examples with Gemini Live and Vertex AI.
|
|
217
|
+
|
|
218
|
+
## Documentation
|
|
219
|
+
|
|
220
|
+
API reference documentation is available [here](https://docs.agora.io/en/conversational-ai/overview).
|
|
221
|
+
|
|
222
|
+
## Reference
|
|
223
|
+
|
|
224
|
+
A full reference for this library is available [here](https://github.com/AgoraIO-Conversational-AI/agent-server-sdk-python/blob/HEAD/./reference.md).
|
|
225
|
+
|
|
226
|
+
## Exception Handling
|
|
227
|
+
|
|
228
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
229
|
+
will be thrown.
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
from agora_agent.core.api_error import ApiError
|
|
233
|
+
|
|
234
|
+
try:
|
|
235
|
+
client.agents.start(...)
|
|
236
|
+
except ApiError as e:
|
|
237
|
+
print(e.status_code)
|
|
238
|
+
print(e.body)
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Pagination
|
|
242
|
+
|
|
243
|
+
Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the returned object.
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
from agora_agent import Agora, Area
|
|
247
|
+
|
|
248
|
+
client = Agora(
|
|
249
|
+
area=Area.US,
|
|
250
|
+
app_id="your-app-id",
|
|
251
|
+
app_certificate="your-app-certificate",
|
|
252
|
+
)
|
|
253
|
+
response = client.agents.list(
|
|
254
|
+
appid=client.app_id,
|
|
255
|
+
)
|
|
256
|
+
for item in response:
|
|
257
|
+
yield item
|
|
258
|
+
# alternatively, you can paginate page-by-page
|
|
259
|
+
for page in response.iter_pages():
|
|
260
|
+
yield page
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```python
|
|
264
|
+
# You can also iterate through pages and access the typed response per page
|
|
265
|
+
pager = client.agents.list(...)
|
|
266
|
+
for page in pager.iter_pages():
|
|
267
|
+
print(page.response) # access the typed response for each page
|
|
268
|
+
for item in page:
|
|
269
|
+
print(item)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Advanced
|
|
273
|
+
|
|
274
|
+
### Access Raw Response Data
|
|
275
|
+
|
|
276
|
+
The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
|
|
277
|
+
The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
|
|
278
|
+
|
|
279
|
+
```python
|
|
280
|
+
from agora_agent import Agora
|
|
281
|
+
|
|
282
|
+
client = Agora(
|
|
283
|
+
...,
|
|
284
|
+
)
|
|
285
|
+
response = client.agents.with_raw_response.start(...)
|
|
286
|
+
print(response.headers) # access the response headers
|
|
287
|
+
print(response.data) # access the returned object
|
|
288
|
+
pager = client.agents.list(...)
|
|
289
|
+
print(pager.response) # access the typed response for the first page
|
|
290
|
+
for item in pager:
|
|
291
|
+
print(item) # access the returned object(s)
|
|
292
|
+
for page in pager.iter_pages():
|
|
293
|
+
print(page.response) # access the typed response for each page
|
|
294
|
+
for item in page:
|
|
295
|
+
print(item) # access the returned object(s)
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Retries
|
|
299
|
+
|
|
300
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
301
|
+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
|
302
|
+
retry limit (default: 2).
|
|
303
|
+
|
|
304
|
+
A request is deemed retryable when any of the following HTTP status codes is returned:
|
|
305
|
+
|
|
306
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
307
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
308
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
309
|
+
|
|
310
|
+
Use the `max_retries` request option to configure this behavior.
|
|
311
|
+
|
|
312
|
+
```python
|
|
313
|
+
client.agents.start(..., request_options={
|
|
314
|
+
"max_retries": 1
|
|
315
|
+
})
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Timeouts
|
|
319
|
+
|
|
320
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
321
|
+
|
|
322
|
+
```python
|
|
323
|
+
|
|
324
|
+
from agora_agent import Agora
|
|
325
|
+
|
|
326
|
+
client = Agora(
|
|
327
|
+
...,
|
|
328
|
+
timeout=20.0,
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
# Override timeout for a specific method
|
|
333
|
+
client.agents.start(..., request_options={
|
|
334
|
+
"timeout_in_seconds": 1
|
|
335
|
+
})
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Custom Client
|
|
339
|
+
|
|
340
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
341
|
+
and transports.
|
|
342
|
+
|
|
343
|
+
```python
|
|
344
|
+
import httpx
|
|
345
|
+
from agora_agent import Agora
|
|
346
|
+
|
|
347
|
+
client = Agora(
|
|
348
|
+
...,
|
|
349
|
+
httpx_client=httpx.Client(
|
|
350
|
+
proxy="http://my.test.proxy.example.com",
|
|
351
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
352
|
+
),
|
|
353
|
+
)
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
## Contributing
|
|
357
|
+
|
|
358
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
359
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
360
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
361
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
362
|
+
an issue first to discuss with us!
|
|
363
|
+
|
|
364
|
+
On the other hand, contributions to the README are always very welcome!
|
|
365
|
+
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# Agora Conversational AI Python SDK
|
|
2
|
+
|
|
3
|
+
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FAgoraIO-Conversational-AI%2Fagent-server-sdk-python)
|
|
4
|
+
[](https://pypi.python.org/pypi/agora-agents)
|
|
5
|
+
|
|
6
|
+
The Agora Conversational AI SDK provides convenient access to the Agora Conversational AI APIs,
|
|
7
|
+
enabling you to build voice-powered AI agents with support for both cascading flows (ASR -> LLM -> TTS)
|
|
8
|
+
and multimodal flows (MLLM) for real-time audio processing.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
pip install agora-agents
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
17
|
+
|
|
18
|
+
- Python 3.8+
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
Start with the `Agent` builder: create a client with app credentials, choose your ASR, LLM, and TTS providers, then start a session. Omit vendor API keys for supported Agora-managed models, or provide keys when you want BYOK.
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
import os
|
|
26
|
+
import time
|
|
27
|
+
|
|
28
|
+
from agora_agent import (
|
|
29
|
+
Agent,
|
|
30
|
+
Agora,
|
|
31
|
+
Area,
|
|
32
|
+
DataChannel,
|
|
33
|
+
DeepgramSTT,
|
|
34
|
+
GenericAvatar,
|
|
35
|
+
MiniMaxTTS,
|
|
36
|
+
OpenAI,
|
|
37
|
+
XaiGrok,
|
|
38
|
+
expires_in_hours,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
AGENT_PROMPT = (
|
|
42
|
+
"You are a concise, technically credible voice assistant. "
|
|
43
|
+
"Keep replies short unless the user asks for detail."
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
GREETING = "Hi there! I am your Agora voice assistant. How can I help?"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def start_conversation() -> str:
|
|
50
|
+
app_id = os.environ["AGORA_APP_ID"]
|
|
51
|
+
app_certificate = os.environ["AGORA_APP_CERTIFICATE"]
|
|
52
|
+
|
|
53
|
+
client = Agora(
|
|
54
|
+
area=Area.US,
|
|
55
|
+
app_id=app_id,
|
|
56
|
+
app_certificate=app_certificate,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
agent = Agent(
|
|
60
|
+
name=f"conversation-{int(time.time())}",
|
|
61
|
+
instructions=AGENT_PROMPT,
|
|
62
|
+
greeting=GREETING,
|
|
63
|
+
failure_message="Please wait a moment.",
|
|
64
|
+
max_history=50,
|
|
65
|
+
turn_detection={
|
|
66
|
+
"config": {
|
|
67
|
+
"speech_threshold": 0.5,
|
|
68
|
+
"start_of_speech": {
|
|
69
|
+
"mode": "vad",
|
|
70
|
+
"vad_config": {
|
|
71
|
+
"interrupt_duration_ms": 160,
|
|
72
|
+
"prefix_padding_ms": 300,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
"end_of_speech": {
|
|
76
|
+
"mode": "vad",
|
|
77
|
+
"vad_config": {
|
|
78
|
+
"silence_duration_ms": 480,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
advanced_features={
|
|
84
|
+
"enable_rtm": True,
|
|
85
|
+
"enable_tools": True,
|
|
86
|
+
},
|
|
87
|
+
parameters={
|
|
88
|
+
"data_channel": DataChannel.RTM,
|
|
89
|
+
"enable_error_message": True,
|
|
90
|
+
},
|
|
91
|
+
).with_stt(
|
|
92
|
+
DeepgramSTT(
|
|
93
|
+
model="nova-3",
|
|
94
|
+
language="en",
|
|
95
|
+
)
|
|
96
|
+
).with_llm(
|
|
97
|
+
OpenAI(
|
|
98
|
+
model="gpt-4o-mini",
|
|
99
|
+
greeting_message=GREETING,
|
|
100
|
+
failure_message="Please wait a moment.",
|
|
101
|
+
max_history=15,
|
|
102
|
+
params={
|
|
103
|
+
"max_tokens": 1024,
|
|
104
|
+
"temperature": 0.7,
|
|
105
|
+
"top_p": 0.95,
|
|
106
|
+
},
|
|
107
|
+
)
|
|
108
|
+
).with_tts(
|
|
109
|
+
MiniMaxTTS(
|
|
110
|
+
model="speech_2_6_turbo",
|
|
111
|
+
voice_id="English_captivating_female1",
|
|
112
|
+
)
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
session = agent.create_session(
|
|
116
|
+
client,
|
|
117
|
+
channel=f"demo-channel-{int(time.time())}",
|
|
118
|
+
agent_uid="123456",
|
|
119
|
+
remote_uids=["*"],
|
|
120
|
+
idle_timeout=30,
|
|
121
|
+
expires_in=expires_in_hours(1),
|
|
122
|
+
debug=False,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
return session.start()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Why no token or vendor key in the example?
|
|
129
|
+
|
|
130
|
+
`Agora` generates the required ConvoAI REST auth and RTC join tokens automatically when you provide `app_id` and `app_certificate`. For supported Agora-managed models, leave vendor API keys unset; provide keys when you want BYOK.
|
|
131
|
+
|
|
132
|
+
### BYOK version
|
|
133
|
+
|
|
134
|
+
Use the same `Agent` builder shape, but provide credentials explicitly when you want vendor-managed billing and routing instead of Agora-managed models.
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
agent = Agent(
|
|
138
|
+
instructions=AGENT_PROMPT,
|
|
139
|
+
greeting=GREETING,
|
|
140
|
+
).with_stt(
|
|
141
|
+
DeepgramSTT(
|
|
142
|
+
api_key=os.environ["DEEPGRAM_API_KEY"],
|
|
143
|
+
model="nova-3",
|
|
144
|
+
language="en",
|
|
145
|
+
)
|
|
146
|
+
).with_llm(
|
|
147
|
+
OpenAI(
|
|
148
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
149
|
+
model="gpt-4o-mini",
|
|
150
|
+
max_tokens=1024,
|
|
151
|
+
temperature=0.7,
|
|
152
|
+
top_p=0.95,
|
|
153
|
+
)
|
|
154
|
+
).with_tts(
|
|
155
|
+
MiniMaxTTS(
|
|
156
|
+
key=os.environ["MINIMAX_API_KEY"],
|
|
157
|
+
group_id=os.environ["MINIMAX_GROUP_ID"],
|
|
158
|
+
model="speech_2_6_turbo",
|
|
159
|
+
voice_id="English_captivating_female1",
|
|
160
|
+
url="wss://api-uw.minimax.io/ws/v1/t2a_v2",
|
|
161
|
+
)
|
|
162
|
+
)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Migrating from `agora-agent-server-sdk` on PyPI? Use `pip install agora-agents`; imports stay `agora_agent` — see [changelog migration notes](./changelog.md#migration-notes) or [installation guide](./docs/getting-started/installation.md#migrating-from-a-previous-package-name).
|
|
166
|
+
|
|
167
|
+
## BYOK
|
|
168
|
+
|
|
169
|
+
If you want to bring your own vendor credentials instead of using Agora-managed models, use the BYOK guide:
|
|
170
|
+
|
|
171
|
+
- [BYOK Guide](./docs/guides/byok.md)
|
|
172
|
+
|
|
173
|
+
## MLLM (Realtime / Multimodal)
|
|
174
|
+
|
|
175
|
+
Use `with_mllm()` for OpenAI Realtime, Gemini Live, Vertex AI, or xAI Grok. No STT, LLM, or TTS vendor is needed when MLLM mode is enabled.
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from agora_agent import Agent, OpenAIRealtime
|
|
179
|
+
|
|
180
|
+
agent = Agent(name="realtime-assistant").with_mllm(
|
|
181
|
+
OpenAIRealtime(
|
|
182
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
183
|
+
model="gpt-4o-realtime-preview",
|
|
184
|
+
greeting_message="Hello! Ready to chat.",
|
|
185
|
+
)
|
|
186
|
+
)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
See the [MLLM Flow guide](./docs/guides/mllm-flow.md) for full examples with Gemini Live and Vertex AI.
|
|
190
|
+
|
|
191
|
+
## Documentation
|
|
192
|
+
|
|
193
|
+
API reference documentation is available [here](https://docs.agora.io/en/conversational-ai/overview).
|
|
194
|
+
|
|
195
|
+
## Reference
|
|
196
|
+
|
|
197
|
+
A full reference for this library is available [here](https://github.com/AgoraIO-Conversational-AI/agent-server-sdk-python/blob/HEAD/./reference.md).
|
|
198
|
+
|
|
199
|
+
## Exception Handling
|
|
200
|
+
|
|
201
|
+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
|
|
202
|
+
will be thrown.
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
from agora_agent.core.api_error import ApiError
|
|
206
|
+
|
|
207
|
+
try:
|
|
208
|
+
client.agents.start(...)
|
|
209
|
+
except ApiError as e:
|
|
210
|
+
print(e.status_code)
|
|
211
|
+
print(e.body)
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Pagination
|
|
215
|
+
|
|
216
|
+
Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the returned object.
|
|
217
|
+
|
|
218
|
+
```python
|
|
219
|
+
from agora_agent import Agora, Area
|
|
220
|
+
|
|
221
|
+
client = Agora(
|
|
222
|
+
area=Area.US,
|
|
223
|
+
app_id="your-app-id",
|
|
224
|
+
app_certificate="your-app-certificate",
|
|
225
|
+
)
|
|
226
|
+
response = client.agents.list(
|
|
227
|
+
appid=client.app_id,
|
|
228
|
+
)
|
|
229
|
+
for item in response:
|
|
230
|
+
yield item
|
|
231
|
+
# alternatively, you can paginate page-by-page
|
|
232
|
+
for page in response.iter_pages():
|
|
233
|
+
yield page
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
# You can also iterate through pages and access the typed response per page
|
|
238
|
+
pager = client.agents.list(...)
|
|
239
|
+
for page in pager.iter_pages():
|
|
240
|
+
print(page.response) # access the typed response for each page
|
|
241
|
+
for item in page:
|
|
242
|
+
print(item)
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Advanced
|
|
246
|
+
|
|
247
|
+
### Access Raw Response Data
|
|
248
|
+
|
|
249
|
+
The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
|
|
250
|
+
The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
from agora_agent import Agora
|
|
254
|
+
|
|
255
|
+
client = Agora(
|
|
256
|
+
...,
|
|
257
|
+
)
|
|
258
|
+
response = client.agents.with_raw_response.start(...)
|
|
259
|
+
print(response.headers) # access the response headers
|
|
260
|
+
print(response.data) # access the returned object
|
|
261
|
+
pager = client.agents.list(...)
|
|
262
|
+
print(pager.response) # access the typed response for the first page
|
|
263
|
+
for item in pager:
|
|
264
|
+
print(item) # access the returned object(s)
|
|
265
|
+
for page in pager.iter_pages():
|
|
266
|
+
print(page.response) # access the typed response for each page
|
|
267
|
+
for item in page:
|
|
268
|
+
print(item) # access the returned object(s)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Retries
|
|
272
|
+
|
|
273
|
+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
|
|
274
|
+
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
|
|
275
|
+
retry limit (default: 2).
|
|
276
|
+
|
|
277
|
+
A request is deemed retryable when any of the following HTTP status codes is returned:
|
|
278
|
+
|
|
279
|
+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
|
|
280
|
+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
|
|
281
|
+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
|
|
282
|
+
|
|
283
|
+
Use the `max_retries` request option to configure this behavior.
|
|
284
|
+
|
|
285
|
+
```python
|
|
286
|
+
client.agents.start(..., request_options={
|
|
287
|
+
"max_retries": 1
|
|
288
|
+
})
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Timeouts
|
|
292
|
+
|
|
293
|
+
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
|
|
294
|
+
|
|
295
|
+
```python
|
|
296
|
+
|
|
297
|
+
from agora_agent import Agora
|
|
298
|
+
|
|
299
|
+
client = Agora(
|
|
300
|
+
...,
|
|
301
|
+
timeout=20.0,
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
# Override timeout for a specific method
|
|
306
|
+
client.agents.start(..., request_options={
|
|
307
|
+
"timeout_in_seconds": 1
|
|
308
|
+
})
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Custom Client
|
|
312
|
+
|
|
313
|
+
You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
|
|
314
|
+
and transports.
|
|
315
|
+
|
|
316
|
+
```python
|
|
317
|
+
import httpx
|
|
318
|
+
from agora_agent import Agora
|
|
319
|
+
|
|
320
|
+
client = Agora(
|
|
321
|
+
...,
|
|
322
|
+
httpx_client=httpx.Client(
|
|
323
|
+
proxy="http://my.test.proxy.example.com",
|
|
324
|
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
|
325
|
+
),
|
|
326
|
+
)
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## Contributing
|
|
330
|
+
|
|
331
|
+
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
332
|
+
Additions made directly to this library would have to be moved over to our generation code,
|
|
333
|
+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
|
|
334
|
+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
|
|
335
|
+
an issue first to discuss with us!
|
|
336
|
+
|
|
337
|
+
On the other hand, contributions to the README are always very welcome!
|