https://github.com/ag2ai/realtime-agent-over-webrtc
Basic demo of AG2 RealtimeAgent communication over WebRTC
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.7%) to scientific vocabulary
Repository
Basic demo of AG2 RealtimeAgent communication over WebRTC
Basic Info
- Host: GitHub
- Owner: ag2ai
- License: apache-2.0
- Language: Python
- Default Branch: main
- Size: 43.9 KB
Statistics
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
RealtimeAgent over WebRTC
This project demonstrates how to create a voice assistant using Python, FastAPI and an AG2 RealtimeAgent. The application streams audio from a client browser to OpenAI Realtime API directly over WebRTC.
Key Features
- WebRTC Audio Streaming: Direct real-time audio streaming between the browser and OpenAI API over WebRTC.
- FastAPI Integration: A lightweight Python backend for handling RealtimeAgent connection and function calling.
Prerequisites
Before you begin, ensure you have the following:
- Python 3.9+: The project was tested with 3.9. Download here.
- An OpenAI account and an OpenAI API Key. You can sign up here.
- OpenAI Realtime API access.
Local Setup
Follow these steps to set up the project locally:
1. Clone the Repository
bash
git clone https://github.com/ag2ai/realtime-agent-over-webrtc.git
cd realtime-agent-over-webrtc
2. Set Up Environment Variables
Create a OAI_CONFIG_LIST file based on the provided OAI_CONFIG_LIST_sample:
bash
cp OAI_CONFIG_LIST_sample OAI_CONFIG_LIST
In the OAICONFIGLIST file, update the api_key to your OpenAI API key.
Important note
Currenlty WebRTC can be used only by API keys the begin with:
sk-proj
Other keys may result internal server error (500) on OpenAI server. For more details see: https://community.openai.com/t/realtime-api-create-sessions-results-in-500-internal-server-error/1060964/5
(Optional) Create and use a virtual environment
To reduce cluttering your global Python environment on your machine, you can create a virtual environment. On your command line, enter:
python3 -m venv env
source env/bin/activate
3. Install Dependencies
Install the required Python packages using pip:
bash
pip install -r requirements.txt
4. Start the Server
Run the application with Uvicorn:
bash
uvicorn realtime_over_webrtc.main:app --port 5050
Test the App
With the server running, open the client application in your browser by navigating to http://localhost:5050/start-chat/. Speak into your microphone, and the AI assistant will respond in real time.
License
This project is licensed under the MIT License.
Owner
- Name: ag2ai
- Login: ag2ai
- Kind: organization
- Repositories: 1
- Profile: https://github.com/ag2ai
GitHub Events
Total
- Issues event: 2
- Watch event: 8
- Delete event: 1
- Issue comment event: 1
- Member event: 2
- Push event: 8
- Pull request review event: 6
- Pull request event: 6
- Fork event: 5
- Create event: 3
Last Year
- Issues event: 2
- Watch event: 8
- Delete event: 1
- Issue comment event: 1
- Member event: 2
- Push event: 8
- Pull request review event: 6
- Pull request event: 6
- Fork event: 5
- Create event: 3
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 1
- Total pull requests: 8
- Average time to close issues: about 12 hours
- Average time to close pull requests: about 11 hours
- Total issue authors: 1
- Total pull request authors: 3
- Average comments per issue: 0.0
- Average comments per pull request: 0.13
- Merged pull requests: 7
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 8
- Average time to close issues: about 12 hours
- Average time to close pull requests: about 11 hours
- Issue authors: 1
- Pull request authors: 3
- Average comments per issue: 0.0
- Average comments per pull request: 0.13
- Merged pull requests: 7
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- sternakt (1)
Pull Request Authors
- davorinrusevljan (4)
- marklysze (2)
- sternakt (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- ag2 ==0.7.0
- fastapi ==0.115.0
- jinja2 ==3.1.4
- uvicorn ==0.30.6