Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 70 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](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)
[![pypi](https://img.shields.io/pypi/v/agent-server-sdk-python)](https://pypi.python.org/pypi/agent-server-sdk-python)

The Agora Conversational AI SDK provides convenient access to the Agora Conversational AI APIs,
enabling you to build voice-powered AI agents with support for both cascading flows (ASR -> LLM -> TTS)
The Agora Conversational AI SDK provides convenient access to the Agora Conversational AI APIs,
enabling you to build voice-powered AI agents with support for both cascading flows (ASR -> LLM -> TTS)
and multimodal flows (MLLM) for real-time audio processing.


## Table of Contents

- [Installation](#installation)
- [Quick Start](#quick-start)
- [Documentation](#documentation)
- [Reference](#reference)
- [Mllm Flow Multimodal](#mllm-flow-multimodal)
- [Mllm Flow Multimodal](#mllm-flow-multimodal)
- [Usage](#usage)
- [Async Client](#async-client)
- [Exception Handling](#exception-handling)
Expand Down Expand Up @@ -152,6 +154,71 @@ A full reference for this library is available [here](https://github.com/AgoraIO

For real-time audio processing using OpenAI's Realtime API or Google Gemini Live, use the MLLM (Multimodal Large Language Model) flow instead of the cascading ASR -> LLM -> TTS flow. See the [MLLM Overview](https://docs.agora.io/en/conversational-ai/models/mllm/overview) for more details.

```python
from agora_agent import Agora, Area
from agora_agent.agentkit import (
AdvancedFeatures,
TurnDetectionConfig,
TurnDetectionTypeValues,
)
from agora_agent.agents import (
StartAgentsRequestProperties,
StartAgentsRequestPropertiesMllm,
StartAgentsRequestPropertiesMllmVendor,
StartAgentsRequestPropertiesTts,
StartAgentsRequestPropertiesTtsVendor,
StartAgentsRequestPropertiesLlm,
)

client = Agora(
area=Area.US,
app_id="YOUR_APP_ID",
app_certificate="YOUR_APP_CERTIFICATE",
)

client.agents.start(
client.app_id,
name="mllm_agent",
properties=StartAgentsRequestProperties(
channel="channel_name",
token="your_token",
agent_rtc_uid="1001",
remote_rtc_uids=["1002"],
idle_timeout=120,
advanced_features=AdvancedFeatures(enable_mllm=True),
mllm=StartAgentsRequestPropertiesMllm(
url="wss://api.openai.com/v1/realtime",
api_key="<your_openai_api_key>",
vendor=StartAgentsRequestPropertiesMllmVendor.OPENAI,
params={
"model": "gpt-4o-realtime-preview",
"voice": "alloy",
},
input_modalities=["audio"],
output_modalities=["text", "audio"],
greeting_message="Hello! I'm ready to chat in real-time.",
),
turn_detection=TurnDetectionConfig(
type=TurnDetectionTypeValues.SERVER_VAD, # deprecated; use config.end_of_speech instead
threshold=0.5,
silence_duration_ms=500,
),
# TTS and LLM are still required but not used when MLLM is enabled
tts=StartAgentsRequestPropertiesTts(
vendor=StartAgentsRequestPropertiesTtsVendor.MICROSOFT,
params={},
),
llm=StartAgentsRequestPropertiesLlm(
url="https://api.openai.com/v1/chat/completions",
),
),
)
```

## MLLM Flow (Multimodal)

For real-time audio processing using OpenAI's Realtime API or Google Gemini Live, use the MLLM (Multimodal Large Language Model) flow instead of the cascading ASR -> LLM -> TTS flow. See the [MLLM Overview](https://docs.agora.io/en/conversational-ai/models/mllm/overview) for more details.

```python
from agora-agent-server-sdk import Agora
from agora-agent-server-sdk.agents import (
Expand Down Expand Up @@ -212,6 +279,7 @@ client.agents.start(
)
```


## Usage

Instantiate and use the client with the following:
Expand Down
Loading
Loading