Skip to content

Latest commit

 

History

History
148 lines (100 loc) · 3.82 KB

File metadata and controls

148 lines (100 loc) · 3.82 KB

Setup

Prerequisites

  • Android Studio with JDK 17+
  • An Android device or emulator with microphone support
  • Agora CLI

Recommended Setup

The easiest path is to let the Agora CLI scaffold the app and write Android credentials to local.properties.

curl -fsSL https://dl.agora.io/cli/install.sh | sh
agora --help
agora login
agora init my-android-demo --template android
cd my-android-demo
JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home" ./gradlew :app:assembleDebug

agora init clones this starter, selects or creates an Agora project, writes .agora/project.json, and writes Agora credentials to root local.properties.

Working From A Clone

Use this if you already cloned this repository:

git clone https://github.com/AgoraIO-Conversational-AI/agent-quickstart-android.git
cd agent-quickstart-android
agora login
agora quickstart env write . --template android --project <your-project>
agora project doctor --deep
JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home" ./gradlew :app:assembleDebug

The env command writes:

AGORA_APP_ID=...
AGORA_APP_CERTIFICATE=...

to root local.properties.

Manual Setup

Use this only if you are not using the Agora CLI.

1. Create An Agora Project

Create or choose an Agora project with Conversational AI enabled.

You need:

  • App ID
  • App Certificate
  • access to RTC and RTM for the project

2. Clone This Repo

git clone <your-fork-or-repo-url>
cd agent-quickstart-android

3. Add Agora Config

Put the following values in local.properties at the repo root:

AGORA_APP_ID=your_agora_app_id
AGORA_APP_CERTIFICATE=your_agora_app_certificate
AGORA_AGENT_UID=123456

Optional values:

AGORA_CONVOAI_BASE_URL=https://api.agora.io/api/conversational-ai-agent/v2/projects
AGORA_AREA=US

4. Build And Run

JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home" ./gradlew :app:assembleDebug

Open the project in Android Studio, or run it from the command line, then launch it on a device or emulator.

Tap Start voice session, allow microphone permission, speak to the agent, and watch transcripts appear in realtime. Use the end-session control to stop the conversation cleanly.

Required Configuration

Required in local.properties:

  • AGORA_APP_ID
  • AGORA_APP_CERTIFICATE

Optional in local.properties:

  • AGORA_AGENT_UID, defaults to 123456
  • AGORA_CONVOAI_BASE_URL, defaults to https://api.agora.io/api/conversational-ai-agent/v2/projects
  • AGORA_AREA, defaults to US

Notes:

  • AGORA_APP_ID also supports the legacy key agora.app.id
  • AGORA_AREA maps to the ConvoAI REST geofence.area value

Default Agent Setup

The demo starts the agent with the default Agora-managed stack:

  • deepgram_nova_3
  • openai_gpt_4o_mini
  • minimax_speech_2_6_turbo

It also enables:

  • RTM event delivery
  • RTM data channel transcripts
  • RTM pipeline metrics
  • agent subscription scoped to the generated requester RTC UID
  • chorus audio scenario for the agent and local RTC engine
  • start-of-speech interruption
  • VAD-based end-of-speech detection

Production Security

This repo is intentionally a direct REST demo.

It is useful when you want to:

  • learn how Agora Conversational AI works end to end
  • ship a quick prototype without a backend
  • build a reusable Android template for your team
  • understand the minimum code needed for a voice AI app

It is not production-safe as-is because the App Certificate is packaged into the Android app and used for local token generation.

For production:

  • move token generation to your backend
  • move REST join, interrupt, and leave calls to your backend
  • keep the Android app as a thin UI client
  • never ship the App Certificate inside the app