agora-realtime-react

React hooks and voice UI primitives for Agora voice agents in Vercel and React apps.


Keywords
agora, realtime, voice-ai, ai-agents, react, hooks, rtc, vercel, nextjs, shadcn-ui
Install
npm install agora-realtime-react@0.1.1

Documentation

Agora Agent Pipeline

Reference implementation for a standalone Agora Realtime React npm package, a public demo website, and an Agora Agent Pipeline template.

Research baseline: 2026-07-02.

Current Direction

The active product shape is a publishable React package plus examples that consume it. The browser uses Agora Web SDK / RTC directly, while the app server owns session setup and teardown:

Browser device
  - mic, speaker, typed text
  - useAgoraRealtime hook from agora-realtime-react
  - Agora Web SDK joins the RTC channel directly
        |
        v
Next.js demo routes
  - POST /api/agora/realtime/setup
  - POST /api/agora/realtime/end
  - mint browser RTC token and start/stop ConvoAI agent
        |
        v
Agora RTC channel + ConvoAI
  - browser publishes mic audio
  - ConvoAI agent subscribes, runs ASR/Turn/LLM/TTS, and publishes speaker audio

packages/agora-realtime-react exports useAgoraRealtime, useVoiceMeter, and the reusable VoiceRingButton UI primitive. It is designed to be published as a standalone npm package. Its React hook ergonomics stay close to @ai-sdk/react experimental_useRealtime where useful, but the primary media plane is Agora RTC, not an AI SDK WebSocket provider.

Implemented Layout

apps/
  website/                  Public SDK/template landing page with local PCM voice demo
templates/
  agora-agent-pipeline/    Agent pipeline template with direct Agora RTC setup/end routes
packages/
  agora-realtime-react/    Publishable React realtime package using agora-rtc-sdk-ng
registry/
  default/voice-ring-button/ shadcn registry source for the voice ring primitive

Run Locally

npm install
npm run lint
npm run typecheck
npm --workspace agora-realtime-react run build
npm --workspace agora-agent-pipeline-website run build
npm --workspace agora-agent-pipeline-template run build

Useful dev servers:

npm run dev:website   # http://localhost:3001
npm run dev:template  # http://localhost:3000

The website runs from local PCM demo assets and does not require Agora credentials.

The template requires Agora app credentials and ConvoAI access:

AGORA_APP_ID=... \
AGORA_APP_CERTIFICATE=... \
AGORA_CONVOAI_PIPELINE_ID=bf6a5c2396714f81a0de57ab2fbe2b72 \
npm run dev:template

AGORA_CONVOAI_PIPELINE_ID should point at the published AI Studio pipeline. The setup route sends it as top-level pipeline_id, generates the RTC channel, UIDs, and tokens server-side, and avoids overriding the pipeline's published ASR/LLM/TTS/turn settings.

Documentation Map